Changeset 1923 for branches/blt4/gui/scripts/deviceEditor.tcl
- Timestamp:
- Oct 18, 2010, 11:59:55 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/deviceEditor.tcl
r1719 r1923 23 23 24 24 constructor {owner args} { 25 25 Rappture::ControlOwner::constructor $owner 26 26 } { 27 27 # defined below 28 28 } 29 29 public method value {args} … … 32 32 public method delete {args} 33 33 public method parameters {title args} { 34 34 # do nothing 35 35 } 36 36 public method snap {w h} … … 44 44 45 45 public proc setMolvisServer {namelist} { 46 47 48 49 50 51 } 52 } 53 46 if {[regexp {^[a-zA-Z0-9\.]+:[0-9]+(,[a-zA-Z0-9\.]+:[0-9]+)*$} $namelist match]} { 47 set _molvisHosts $namelist 48 } else { 49 error "bad visualization server address \"$namelist\": should be host:port,host:port,..." 50 } 51 } 52 } 53 54 54 itk::usual DeviceEditor { 55 55 } … … 60 60 itcl::body Rappture::DeviceEditor::constructor {owner args} { 61 61 itk_component add top { 62 62 frame $itk_interior.top 63 63 } 64 64 pack $itk_component(top) -fill x … … 81 81 set i [lsearch -exact $args -check] 82 82 if {$i >= 0} { 83 84 83 set onlycheck 1 84 set args [lreplace $args $i $i] 85 85 } 86 86 87 87 if {[llength $args] == 1} { 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 88 if {$_xmlobj != ""} { 89 if {$itk_option(-autocleanup)} { 90 # delete any existing object 91 itcl::delete object $_xmlobj 92 } 93 set _xmlobj "" 94 } 95 96 set newval [lindex $args 0] 97 if {$newval != ""} { 98 if {$onlycheck} { 99 return 100 } 101 if {![Rappture::library isvalid $newval]} { 102 error "bad value \"$newval\": should be Rappture::Library" 103 } 104 set _xmlobj $newval 105 } 106 _redraw 107 $_current configure -device $_xmlobj 108 event generate $itk_component(hull) <<Value>> 109 109 110 110 } elseif {[llength $args] == 0} { 111 111 sync ;# querying -- must sync controls with the value 112 112 } else { 113 113 error "wrong # args: should be \"value ?-check? ?newval?\"" 114 114 } 115 115 return $_xmlobj … … 127 127 set _xmlobj $dataobj 128 128 if {"" == $_current} { # Make sure viewer instance exists 129 129 _redraw 130 130 } 131 131 eval $_current add $dataobj [list $settings] … … 140 140 itcl::body Rappture::DeviceEditor::delete {args} { 141 141 if {"" != $_current} { 142 143 142 eval $_current delete $args 143 set _xmlobj [lindex [$_current get] end] 144 144 } 145 145 } … … 157 157 itcl::body Rappture::DeviceEditor::download {option args} { 158 158 if {"" != $_current} { 159 159 return [eval $_current download $option $args] 160 160 } 161 161 return "" … … 172 172 itcl::body Rappture::DeviceEditor::_redraw {} { 173 173 if {$_current != ""} { 174 175 174 $_current configure -device "" 175 set _current "" 176 176 } 177 177 switch -- [_type $_xmlobj] { 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 178 molecule { 179 if { ![winfo exists $itk_component(hull).mol] } { 180 catch { 181 destroy $itk_component(hull).dev 182 } 183 set servers [Rappture::VisViewer::GetServerList "pymol"] 184 if { "" != $servers } { 185 Rappture::MolvisViewer $itk_component(hull).mol $servers 186 } else { 187 Rappture::MoleculeViewer $itk_component(hull).mol $this 188 } 189 pack $itk_component(hull).mol -expand yes -fill both 190 } 191 set _current $itk_component(hull).mol 192 } 193 device1D { 194 if { ![winfo exists $itk_component(hull).dev] } { 195 catch { 196 destroy $itk_component(hull).mol 197 } 198 Rappture::DeviceViewer1D $itk_component(hull).dev $this 199 pack $itk_component(hull).dev -expand yes -fill both 200 } 201 set _current $itk_component(hull).dev 202 } 203 203 } 204 204 } … … 214 214 itcl::body Rappture::DeviceEditor::_type {xmlobj} { 215 215 if {$xmlobj == ""} { 216 216 return "" 217 217 } 218 218 if {[llength [$xmlobj children -type molecule components]] > 0} { 219 219 return "molecule" 220 220 } 221 221 return "device1D"
Note: See TracChangeset
for help on using the changeset viewer.