Changeset 168 for trunk/MultiChannelUSB
- Timestamp:
- Oct 12, 2012, 3:41:14 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/UserInterface.tcl
r167 r168 7 7 package require zlib 8 8 9 wm minsize . 990 6 609 wm minsize . 990 680 10 10 11 11 namespace eval ::mca { … … 513 513 frame ${config}.spc6 -width 170 -height 30 514 514 515 516 515 button ${config}.register -text Register \ 517 516 -bg lightblue -activebackground lightblue -command [myproc register] 517 518 frame ${config}.spc7 -width 170 -height 30 519 520 button ${config}.recover -text {Read file} \ 521 -bg lightblue -activebackground lightblue -command [myproc recover] 518 522 519 523 grid ${config}.axis_check -sticky w … … 533 537 grid ${config}.spc6 534 538 grid ${config}.register -sticky ew -pady 3 -padx 5 539 grid ${config}.spc7 540 grid ${config}.recover -sticky ew -pady 3 -padx 5 535 541 536 542 grid ${graph} -row 0 -column 0 -sticky news … … 871 877 # ------------------------------------------------------------------------- 872 878 879 HstDisplay instproc open_data {} { 880 set types { 881 {{Data Files} {.dat} } 882 {{All Files} * } 883 } 884 885 set fname [tk_getOpenFile -filetypes $types] 886 if {[string equal $fname {}]} { 887 return 888 } 889 890 set x [catch { 891 set fid [open $fname r+] 892 fconfigure $fid -translation binary -encoding binary 893 [myvar yvec] set [split [read $fid] \n] 894 close $fid 895 }] 896 897 if { $x || ![file exists $fname] || ![file isfile $fname] || ![file readable $fname] } { 898 tk_messageBox -icon error \ 899 -message "An error occurred while reading \"$fname\"" 900 } else { 901 tk_messageBox -icon info \ 902 -message "File \"$fname\" read successfully" 903 } 904 } 905 906 # ------------------------------------------------------------------------- 907 873 908 HstDisplay instproc register {} { 874 909 my save_data [join [[myvar yvec] range 0 4095] \n] 910 } 911 912 # ------------------------------------------------------------------------- 913 914 HstDisplay instproc recover {} { 915 my open_data 875 916 } 876 917 … … 1001 1042 button ${config}.register -text Register \ 1002 1043 -bg lightblue -activebackground lightblue -command [myproc register] 1044 1045 frame ${config}.spc8 -width 170 -height 30 1046 1047 button ${config}.recover -text {Read file} \ 1048 -bg lightblue -activebackground lightblue -command [myproc recover] 1003 1049 1004 1050 grid ${config}.axis_check -sticky w … … 1019 1065 grid ${config}.spc7 1020 1066 grid ${config}.register -sticky ew -pady 3 -padx 5 1067 grid ${config}.spc8 1068 grid ${config}.recover -sticky ew -pady 3 -padx 5 1021 1069 1022 1070 grid ${graph} -row 0 -column 0 -sticky news … … 1331 1379 # ------------------------------------------------------------------------- 1332 1380 1381 CntDisplay instproc open_data {} { 1382 set types { 1383 {{Data Files} {.dat} } 1384 {{All Files} * } 1385 } 1386 1387 set fname [tk_getOpenFile -filetypes $types] 1388 if {[string equal $fname {}]} { 1389 return 1390 } 1391 1392 set x [catch { 1393 set fid [open $fname r+] 1394 fconfigure $fid -translation binary -encoding binary 1395 [myvar yvec] set [split [read $fid] \n] 1396 close $fid 1397 }] 1398 1399 if { $x || ![file exists $fname] || ![file isfile $fname] || ![file readable $fname] } { 1400 tk_messageBox -icon error \ 1401 -message "An error occurred while reading \"$fname\"" 1402 } else { 1403 tk_messageBox -icon info \ 1404 -message "File \"$fname\" read successfully" 1405 } 1406 } 1407 1408 # ------------------------------------------------------------------------- 1409 1333 1410 CntDisplay instproc register {} { 1334 1411 my save_data [join [[myvar yvec] range 0 9999] \n] 1412 } 1413 1414 # ------------------------------------------------------------------------- 1415 1416 CntDisplay instproc recover {} { 1417 my open_data 1335 1418 } 1336 1419 … … 1464 1547 -bg yellow -activebackground yellow 1465 1548 1466 frame ${config}.spc6 -width 170 -height 101549 frame ${config}.spc6 -width 170 -height 30 1467 1550 1468 1551 button ${config}.recover -text {Read file} \
Note:
See TracChangeset
for help on using the changeset viewer.