Changeset 1964 for trunk/tester/testtree.tcl
- Timestamp:
- Nov 25, 2010, 5:54:57 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tester/testtree.tcl
r1963 r1964 3 3 # 4 4 # Used to display a collapsible view of all tests found in the test 5 # directory. Essentially an Itk Widget wrapper for blt::treeview.6 # Provides methods to get all tests or all currently selected tests.7 # Also helps handle data stored in treeview columns. In each test xml,8 # a label must be located at the path test.label. Test labels may be9 # be organized hierarchically by using dots to separate components of10 # the test label. (example: roomtemp.1eV)5 # directory. The -command configuration option will be called when 6 # the run button is clicked. Provides methods to get all tests or all 7 # currently selected tests. Also helps handle data stored in treeview 8 # columns. In each test xml, a label must be located at the path 9 # test.label. Test labels may be organized hierarchically by using 10 # dots to separate components of the test label. 11 11 # ====================================================================== 12 12 # AUTHOR: Ben Rafferty, Purdue University … … 23 23 24 24 itcl::class Rappture::Regression::TestTree { 25 inherit itk::Widget 26 27 constructor {testdir} { #defined later } 28 public method populate {testdir} 25 inherit itk::Widget 26 27 public variable command 28 public variable testdir 29 30 constructor {testdir args} { #defined later } 29 31 public method getTests {{id 0}} 30 32 public method getSelected {} 31 33 public method getData {id} 32 34 public method setData {id data} 35 public method updateLabel {} 36 37 private method populate {} 33 38 } 34 39 … … 41 46 } 42 47 43 itcl::body Rappture::Regression::TestTree::constructor { testdir} {48 itcl::body Rappture::Regression::TestTree::constructor {args} { 44 49 # TODO: Use separate tree data structure and insert into treeview 45 puts "Constructing TestTree." 50 puts "Constructinig TestTree." 51 46 52 itk_component add treeview { 47 53 blt::treeview $itk_interior.treeview -separator . -autocreate true \ 48 -selectmode multiple 49 } 50 $itk_component(treeview) column insert end xmlfile ran result diffs 54 -selectmode multiple 55 } 56 $itk_component(treeview) column insert 0 result 57 $itk_component(treeview) column insert end xmlfile ran diffs 51 58 $itk_component(treeview) column configure xmlfile ran diffs -hide yes 52 59 pack $itk_component(treeview) -expand yes -fill both 53 populate $testdir 54 # TODO: Fix default column spacing. Column name for the main/first column? 60 61 itk_component add bottomBar { 62 frame $itk_interior.bottomBar 63 } 64 pack $itk_component(bottomBar) -fill x 65 66 itk_component add bSelectAll { 67 button $itk_component(bottomBar).bSelectAll -text "Select all" \ 68 -command "$itk_component(treeview) selection set 0 end" 69 } 70 pack $itk_component(bSelectAll) -side left 71 72 itk_component add bSelectNone { 73 button $itk_component(bottomBar).bSelectNone -text "Select none" \ 74 -command "$itk_component(treeview) selection clearall" 75 } 76 pack $itk_component(bSelectNone) -side left 77 78 itk_component add lSelected { 79 label $itk_component(bottomBar).lSelected -text "0 tests selected" 80 } 81 pack $itk_component(lSelected) -side left -expand yes -fill x 82 $itk_component(treeview) configure -selectcommand "$this updateLabel" 83 84 itk_component add bRun { 85 button $itk_component(bottomBar).bRun -text "Run" -command runHandler \ 86 -state disabled 87 } 88 pack $itk_component(bRun) -side left 89 55 90 # TODO: Fix black empty space when columns are shrunk 56 } 57 91 # TODO: Scrollbar(s) 92 93 eval itk_initialize $args 94 } 95 96 # Repopulate tree if test directory changed 97 itcl::configbody Rappture::Regression::TestTree::testdir { 98 populate 99 } 100 101 itcl::configbody Rappture::Regression::TestTree::command { 102 $itk_component(bRun) configure -command $command 103 } 58 104 59 105 # ---------------------------------------------------------------------- … … 66 112 # any nodes previously contained by the treeview. 67 113 # ---------------------------------------------------------------------- 68 itcl::body Rappture::Regression::TestTree::populate { testdir} {114 itcl::body Rappture::Regression::TestTree::populate {} { 69 115 puts "Populating TestTree." 70 116 $itk_component(treeview) delete 0 71 # TODO: Make file icon background transparent.72 set icon [ image create photo -file images/file.gif]117 # TODO: add an appropriate icon 118 set icon [Rappture::icon download] 73 119 # TODO: Descend through subdirectories inside testdir? 74 120 foreach testxml [glob -nocomplain -directory $testdir *.xml] { … … 150 196 } 151 197 152 198 # ---------------------------------------------------------------------- 199 # USAGE: updateLabel 200 # 201 # Used internally to update the label which indicates how many tests 202 # are currently selected. Also disables the run button if no tests are 203 # selected. 204 # ---------------------------------------------------------------------- 205 itcl::body Rappture::Regression::TestTree::updateLabel {} { 206 set n [llength [getSelected]] 207 $itk_component(lSelected) configure -text "$n tests selcted" 208 if {$n > 0} { 209 $itk_component(bRun) configure -state normal 210 } else { 211 $itk_component(bRun) configure -state disabled 212 } 213 } 214
Note: See TracChangeset
for help on using the changeset viewer.