Changeset 1636 for trunk/gui/scripts
- Timestamp:
- Jan 11, 2010, 10:52:45 PM (15 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/combobox.tcl
r1588 r1636 179 179 # ---------------------------------------------------------------------- 180 180 itcl::body Rappture::Combobox::current {} { 181 return [translate [$itk_component(entry) get]] 181 set raw [$itk_component(entry) get] 182 set value [translate $raw] 183 if { $value != "" } { 184 return $value 185 } 186 return $raw 182 187 } 183 188 -
trunk/gui/scripts/nanovisviewer.tcl
r1632 r1636 665 665 # here? 666 666 continue 667 } 668 if { ![info exists _vol2style($vol)] } { 669 puts stderr "unknown volume $vol" 670 continue; # How does this happen? 667 671 } 668 672 set tf $_vol2style($vol) -
trunk/gui/scripts/xylegend.tcl
r1342 r1636 293 293 } 294 294 foreach node $nodes { 295 set node [$itk_component(legend) index $node]296 295 set elem [$tree_ label $node] 297 296 if { ![$graph_ element exists $elem] } { -
trunk/gui/scripts/xyprint.tcl
r1622 r1636 23 23 option add *XyPrint*Entry*background "white" widgetDefault 24 24 25 array set Rappture::axistypes {26 x x27 y y28 x2 x29 y2 y30 }31 32 25 itcl::class Rappture::XyPrint { 33 26 inherit itk::Widget … … 41 34 private variable _savedSettings; # Array of settings. 42 35 43 private common _settingsFile "~/.rpsettings" 36 private common _oldSettingsFile "~/.rpsettings" 37 private common _settingsFile "~/.rp_settings" 44 38 45 39 public method print { graph toolName plotName } … … 62 56 private method InitClone {} 63 57 private method Pixels2Inches { pixels } 64 private method Inches2Pixels { inches }58 private method Inches2Pixels { inches {defValue ""}} 65 59 private method Color2RGB { color } 66 60 … … 78 72 private method GetOutput {} 79 73 private method Done { state } 74 private method SetLayoutOption { option } 75 private method GetAxisType { axis } 80 76 private method restore { toolName plotName data } 81 77 private common _settings … … 286 282 itcl::body Rappture::XyPrint::CloneGraph { orig } { 287 283 set top $itk_interior 284 if { [winfo exists $top.graph] } { 285 destroy $top.graph 286 } 288 287 set clone [blt::graph $top.graph] 289 288 CopyOptions "configure" $orig $clone … … 399 398 puts stderr "$err: $errorInfo" 400 399 set _settings($this-graph-$opt) $old 400 $_clone configure -$opt $old 401 401 } 402 402 } … … 411 411 puts stderr "$err: $errorInfo" 412 412 set _settings($this-$comp-$opt) $old 413 $_clone $comp configure -$opt $old 413 414 } 414 415 } … … 423 424 puts stderr "$err: $errorInfo" 424 425 set _settings($this-$comp-$opt) $old 426 $_clone $comp configure $name -$opt $old 425 427 } 426 428 } … … 429 431 update 430 432 set img [image create photo] 431 set w [Inches2Pixels $_settings($this-layout-width) ]432 set h [Inches2Pixels $_settings($this-layout-height) ]433 set w [Inches2Pixels $_settings($this-layout-width) 3.4] 434 set h [Inches2Pixels $_settings($this-layout-height) 3.4] 433 435 set pixelsPerInch [winfo pixels . 1i] 434 436 set sx [expr 2.5*$pixelsPerInch/$w] … … 461 463 } 462 464 463 itcl::body Rappture::XyPrint::Inches2Pixels { inches } { 465 itcl::body Rappture::XyPrint::Inches2Pixels { inches {defValue ""}} { 466 set n [scan $inches %g dummy] 467 if { n != 1 && $defValue != "" } { 468 set inches $defValue 469 } 464 470 return [winfo pixels . ${inches}i] 465 471 } … … 474 480 } 475 481 482 itcl::body Rappture::XyPrint::GetAxisType { axis } { 483 foreach type { x y x2 y2 } { 484 set axes [$_clone ${type}axis use] 485 if { [lsearch $axes $axis] >= 0 } { 486 return [string range $type 0 0] 487 } 488 } 489 return "" 490 } 476 491 477 492 itcl::body Rappture::XyPrint::GetAxis {} { … … 480 495 set _settings($this-axis-$option) [$_clone axis cget $axis -$option] 481 496 } 482 set type $Rappture::axistypes($axis)497 set type [GetAxisType $axis] 483 498 if { [$_clone grid cget -map${type}] == $axis } { 484 499 set _settings($this-axis-grid) 1 … … 493 508 itcl::body Rappture::XyPrint::GetElement { args } { 494 509 set index 1 510 array unset _settings $this-element-* 495 511 foreach elem [$_clone element show] { 496 512 set _settings($this-element-$index) $elem … … 1071 1087 itcl::body Rappture::XyPrint::ApplyAxisSettings {} { 1072 1088 set axis [$itk_component(axis_combo) current] 1073 set type $Rappture::axistypes($axis)1089 set type [GetAxisType $axis] 1074 1090 set page $itk_component(axis_page) 1075 1091 if { $_settings($this-axis-grid) } { … … 1111 1127 } 1112 1128 1129 itcl::body Rappture::XyPrint::SetLayoutOption { opt } { 1130 set new [Inches2Pixels $_settings($this-layout-$opt)] 1131 $_clone configure -$opt $new 1132 } 1133 1113 1134 itcl::body Rappture::XyPrint::ApplyLayoutSettings {} { 1114 1135 foreach opt { leftmargin rightmargin topmargin bottommargin } { 1115 set new [Inches2Pixels $_settings($this-layout-$opt)]1116 1136 set old [$_clone cget -$opt] 1117 set code [catch [list $_clone configure -$opt $new]err]1137 set code [catch { SetLayoutOption $opt } err] 1118 1138 if { $code != 0 } { 1119 1139 bell … … 1121 1141 puts stderr "$err: $errorInfo" 1122 1142 set _settings($this-layout-$opt) [Pixels2Inches $old] 1143 $_clone configure -$opt [Pixels2Inches $old] 1123 1144 } 1124 1145 } … … 1133 1154 set _settings($this-general-format) ps 1134 1155 set _settings($this-general-style) ieee 1135 set _settings($this-general-remember) 11156 set _settings($this-general-remember) 0 1136 1157 set page $itk_component(graph_page) 1137 1158 $page.format value [$page.format label $_settings($this-general-format)] … … 1222 1243 if { ![file readable $_settingsFile] } { 1223 1244 return; # No file or not readable 1245 } 1246 if { [file exists $_oldSettingsFile] } { 1247 file delete $_oldSettingsFile 1224 1248 } 1225 1249 # Read the file by sourcing it into a safe interpreter The only commands … … 1271 1295 set plot [lindex $key 1] 1272 1296 puts $f "xyprint \"$tool\" \"$plot\" \{" 1273 puts $f "$_savedSettings($key)" 1297 set settings [string trim $_savedSettings($key) \n] 1298 puts $f "$settings" 1274 1299 puts $f "\}\n" 1275 1300 } … … 1288 1313 array set info [font configure $font] 1289 1314 foreach opt { -family -size -weight -slant } { 1290 append out " $opt \"$info($opt)\"" 1315 set value [list $info($opt)] 1316 append out " $opt $value" 1291 1317 } 1292 1318 append out "\n" … … 1298 1324 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1299 1325 -bottommargin -plotpadx -plotpady } { 1300 append out " $opt \"[$_clone cget $opt]\"" 1326 set value [list [$_clone cget $opt]] 1327 append out " $opt $value" 1301 1328 } 1302 1329 append out "\n" … … 1305 1332 append out " preview legend configure" 1306 1333 foreach opt { -position -anchor -borderwidth -hide } { 1307 append out " $opt \"[$_clone legend cget $opt]\"" 1334 set value [list [$_clone legend cget $opt]] 1335 append out " $opt $value" 1308 1336 } 1309 1337 append out " -font legend\n" … … 1314 1342 append out " preview element configure \"$elem\"" 1315 1343 foreach opt { -symbol -color -dashes -hide -label } { 1316 append out " $opt \"[$_clone element cget $elem $opt]\"" 1344 set value [list [$_clone element cget $elem $opt]] 1345 append out " $opt $value" 1317 1346 } 1318 1347 append out " \}\n" … … 1327 1356 append out " preview axis configure \"$axis\"" 1328 1357 foreach opt { -hide -min -max -loose -title -stepsize -subdivisions } { 1329 append out " $opt \"[$_clone axis cget $axis $opt]\"" 1358 set value [list [$_clone axis cget $axis $opt]] 1359 append out " $opt $value" 1330 1360 } 1331 1361 append out " -tickfont \"$axis-ticks\"" … … 1342 1372 return $out 1343 1373 } 1344
Note: See TracChangeset
for help on using the changeset viewer.