Changeset 89 for sans/utils/bt5


Ignore:
Timestamp:
Apr 16, 2007 8:16:43 PM (16 years ago)
Author:
ajj
Message:

Basic GUI - two tabs with simple #clicks in first and full command interface in second.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/utils/bt5/tilt/tilt

    r87 r89  
    77################################## 
    88 
     9package require Tix 
     10 
    911proc exec_cmd {cmd_text} { 
     12        global tf 
    1013 
    11         .mf.output insert end "$cmd_text\n" 
     14        $tf.output insert end "$cmd_text\n" 
    1215        exp_send "$cmd_text\r" 
    1316 
     
    1518 
    1619 
     20proc goButProc {changeVal} { 
     21        global tf 
     22 
     23        $tf.output insert end "REL A1 $changeVal G\n" 
     24        exp_send "REL A1 $changeVal G\r" 
     25 
     26} 
     27 
     28log_user 0 
    1729set port /dev/ttyS0 
    1830set serialid [spawn -noecho -open [open $port w+]] 
     
    2234 
    2335 
    24 frame .mf 
    25 text .mf.output 
    26 entry .mf.cmdentry 
    27 button .mf.ver_but -text "Execute Command" -command { exec_cmd [.mf.cmdentry get] } 
    28 button .mf.init -text "Init" -command {exp_send "\r"} 
    29 pack .mf.output -fill both -anchor nw -expand true 
    30 pack .mf.cmdentry -side left 
    31 pack .mf.ver_but .mf.init -side left 
    32 pack .mf 
     36#Build GUI 
     37#Create main frame 
     38frame .fmain 
    3339 
    34 #expect ">" 
    35 #exp_send "VER\r" 
    36 #expect ">" {.mf.output insert end $expect_out(buffer)} 
     40#Create Notebook tabs 
     41set nb  [tixNoteBook .fmain.noteb] 
     42$nb add simple -label "Tilt Adjust" -underline 0 
     43$nb add tiltterm -label "Command line" -underline 0 
     44#Get frames for each tab 
     45set simpletab [frame [$nb subwidget simple].f] 
     46set termtab [frame [$nb subwidget tiltterm].f] 
     47 
     48 
     49#Populate simple tab 
     50set sf [frame $simpletab.sframe -background grey] 
     51 
     52pack [tixLabelEntry $sf.motorval -label "Number of clicks"] -padx 10 -pady 10 
     53pack [button $sf.gobut -text "Change Tilt"\ 
     54         -command {goButProc [ [$sf.motorval subwidget entry] get] } ]\ 
     55         -padx 10 -pady 10 -anchor s 
     56pack $sf -fill both -expand true 
     57 
     58#Populate term tab 
     59set tf [frame $termtab.tframe] 
     60 
     61pack [text $tf.output] -fill both -anchor nw -expand true 
     62pack [entry $tf.cmdentry] -side left -fill x -expand true -anchor w 
     63pack [button $tf.verbut -text "Execute Command"\ 
     64         -command { exec_cmd [$tf.cmdentry get] } ]\ 
     65                 -side right  
     66 
     67pack $tf -fill x 
     68 
     69#Pack up and go 
     70pack $nb $simpletab $termtab -fill both -expand true 
     71pack .fmain -fill both -expand true -anchor nw 
    3772 
    3873expect_background { 
    3974        -re ">" { 
    40                 .mf.output insert end $expect_out(buffer) 
     75                $tf.output insert end $expect_out(buffer) 
    4176        } 
    4277        -re "\\?" { 
    43                 .mf.output insert end $expect_out(buffer) 
     78                $tf.output insert end $expect_out(buffer) 
    4479        } 
    4580}                
Note: See TracChangeset for help on using the changeset viewer.