Changeset 1011 for branches/sandbox


Ignore:
Timestamp:
Sep 20, 2010 12:44:02 PM (10 years ago)
Author:
chlake
Message:

Fixed phase choice problems and traces. Added grab restore to fix optionMenu bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/distrest.tcl

    r1010 r1011  
    66#::sr_lookuplist1
    77#::sr_lookuplist2
    8 #::sr_rb
    9 #::sr_top
     8#sr_top
    109#::sr_checkall
    1110#::sr_entryvar(choicenum)
     
    3736#SR_Build
    3837
    39 proc DisplayDistanceRestraints {} {
     38proc DisplayDistanceRestraints {args} {
    4039    global expcons
    4140    eval destroy [winfo children $expcons(distmaster)]
     
    6564    # Pick Phase to be Evaluated **********************************************
    6665    label $phasebox.phlabel -text Phase
    67     set ::sr_phaselist $::expmap(phaselist)
    68     eval tk_optionMenu $phasebox.phase sr_entryvar(softphase) $::sr_phaselist
    69     foreach item [trace vinfo ::sr_entryvar(softphase)] {
    70         eval trace vdelete ::sr_entryvar(softphase) $item
    71     }
    72     #trace variable ::sr_entryvar(softphase) w "SR_Fill_Display  $main"
     66#    set ::sr_phaselist $::expmap(phaselist)
     67
     68    eval tk_optionMenu $phasebox.phase ::sr_entryvar(softphase) $::expmap(phaselist)
     69#    eval tk_optionMenu $phasebox.phase ::sr_entryvar(softphase) $::sr_phaselist
     70#   trace variable ::sr_entryvar(softphase) w DisplayDistanceRestraints
     71#   bind $phasebox.phase <ButtonRelease> {DisplayDistanceRestraints}
     72
    7373    grid $phasebox.phlabel -column 0 -row 0
    7474    grid $phasebox.phase  -column 1 -row 0
     
    117117    grid $top.rlabel2 -column 5 -row 2
    118118
    119     set ::sr_rb ""
    120119    SR_Rest_Only
     120    SR_Show_RestraintsOnly $main $rightfr
     121    foreach item [trace vinfo ::sr_entryvar(softphase)] {
     122    eval trace vdelete ::sr_entryvar(softphase) $item
     123    }
     124    trace add variable ::sr_entryvar(softphase) write "SR_Show_RestraintsOnly $main $rightfr"
     125}
     126proc SR_Show_RestraintsOnly {main rightfr args} {
    121127    SR_Fill_Display  $main
    122128    ResizeScrollTable $rightfr
    123129}
    124 
    125130
    126131#*********************************************************************************************
     
    208213        set num1 [lindex $bond_dist_array($x) 5]
    209214        set num2 [lindex $bond_dist_array($x) 6]
    210         set type1 [atominfo 1 [lindex $bond_dist_array($x) 5] type]
     215        set type1 [atominfo [lindex $bond_dist_array($x) 1] [lindex $bond_dist_array($x) 5] type]
    211216        set type1 [lindex [split $type1 {+-}] 0]
    212         set type2 [atominfo 1 [lindex $bond_dist_array($x) 6] type]
     217        set type2 [atominfo [lindex $bond_dist_array($x) 1] [lindex $bond_dist_array($x) 6] type]
    213218        set type2 [lindex [split $type2 {+-}] 0]
    214219        lappend initsoftpar($x) $type1
    215220        lappend initsoftpar($x) $type2
    216221
    217         lappend initsoftpar($x) [atominfo 1 [lindex $bond_dist_array($x) 5] label]
    218         lappend initsoftpar($x) [atominfo 1 [lindex $bond_dist_array($x) 6] label]
     222        lappend initsoftpar($x) [atominfo [lindex $bond_dist_array($x) 1] [lindex $bond_dist_array($x) 5] label]
     223        lappend initsoftpar($x) [atominfo [lindex $bond_dist_array($x) 1] [lindex $bond_dist_array($x) 6] label]
    219224
    220225        #puts "$initsoftpar($x)"
     
    282287#*********************************************************************************
    283288#Procedure to set up soft display ************************************************
     289# used for editing window
    284290#*********************************************************************************
    285291
     
    287293    #global rprint
    288294    destroy .mainrestraintbox.sr_rvaluebox
    289     set ::sr_rb .mainrestraintbox.sr_rvaluebox
    290     frame $::sr_rb
    291     pack $::sr_rb -side top -fill both -expand 1
    292 
    293     foreach {::sr_top main side lbl} [MakeScrollTable $::sr_rb] {}
     295    set sr_rb .mainrestraintbox.sr_rvaluebox
     296    frame $sr_rb
     297    pack $sr_rb -side top -fill both -expand 1
     298
     299    foreach {sr_top main side lbl} [MakeScrollTable $sr_rb] {}
    294300    set     ::contraintmainbox $main
    295301
    296     button $::sr_top.alabel1 -text "Atom 1 " -width 7   \
    297         -command "SR_Sort atom1 $main $::sr_top.alabel1 $::sr_top.alabel2 $::sr_top.dlabel1"
    298     button $::sr_top.alabel2 -text "Atom 2 " -width 7 \
    299         -command "SR_Sort atom2 $main $::sr_top.alabel1 $::sr_top.alabel2 $::sr_top.dlabel1"
    300     button $::sr_top.dlabel1 -text "Distance " -width 9 \
    301         -command "SR_Sort distance $main $::sr_top.alabel1 $::sr_top.alabel2 $::sr_top.dlabel1"
    302 
    303     grid $::sr_top.alabel1 -column 1 -row 2
    304     grid $::sr_top.alabel2 -column 2 -row 2
    305     grid $::sr_top.dlabel1 -column 3 -row 2
    306 
    307     label  $::sr_top.rlabel1 -text "Restraint"
    308     label  $::sr_top.rlabel2 -text "esd"
    309     grid $::sr_top.rlabel1 -column 4 -row 2 -padx 20
    310     grid $::sr_top.rlabel2 -column 5 -row 2 -padx 20
    311 
    312 
    313     button $::sr_top.rcon1   -text "Check All" -width 10 -command {
     302    button $sr_top.alabel1 -text "Atom 1 " -width 7   \
     303        -command "SR_Sort atom1 $main $sr_top.alabel1 $sr_top.alabel2 $sr_top.dlabel1"
     304    button $sr_top.alabel2 -text "Atom 2 " -width 7 \
     305        -command "SR_Sort atom2 $main $sr_top.alabel1 $sr_top.alabel2 $sr_top.dlabel1"
     306    button $sr_top.dlabel1 -text "Distance " -width 9 \
     307        -command "SR_Sort distance $main $sr_top.alabel1 $sr_top.alabel2 $sr_top.dlabel1"
     308
     309    grid $sr_top.alabel1 -column 1 -row 2
     310    grid $sr_top.alabel2 -column 2 -row 2
     311    grid $sr_top.dlabel1 -column 3 -row 2
     312
     313    label  $sr_top.rlabel1 -text "Restraint"
     314    label  $sr_top.rlabel2 -text "esd"
     315    grid $sr_top.rlabel1 -column 4 -row 2 -padx 20
     316    grid $sr_top.rlabel2 -column 5 -row 2 -padx 20
     317
     318
     319    button $sr_top.rcon1   -text "Check All" -width 10 -command {
    314320        set ::sr_checkall 1
    315321        SR_Set_All_Check_Buttons
    316         grid forget $::sr_top.rcon1
    317         grid $::sr_top.rcon2 -column 6 -row 2 -padx 5
    318     }
    319 
    320     button $::sr_top.rcon2   -text "Clear All" -width 10 -command {
     322        grid forget $sr_top.rcon1
     323        grid $sr_top.rcon2 -column 6 -row 2 -padx 5
     324    }
     325
     326    button $sr_top.rcon2   -text "Clear All" -width 10 -command {
    321327        set ::sr_checkall 0
    322328        SR_Set_All_Check_Buttons
    323         grid forget $::sr_top.rcon2
    324         grid $::sr_top.rcon1 -column 6 -row 2 -padx 5
    325     }
    326 
    327     grid $::sr_top.rcon1   -column 6 -row 2 -padx 5
     329        grid forget $sr_top.rcon2
     330        grid $sr_top.rcon1 -column 6 -row 2 -padx 5
     331    }
     332
     333    grid $sr_top.rcon1   -column 6 -row 2 -padx 5
    328334
    329335    #SR_Sort atom1 $main
    330336    SR_Fill_Display  $main
     337    bind $sr_rb <Configure> "ResizeScrollTable $sr_rb"
     338    # see if reset of grab fixes tk bug with tk_optionMenu
     339    grab release .mainrestraintbox
    331340}
    332341
    333342#*****************************************************************************************
    334343#Procedure to fill in sorted Restraint and esd data **************************************
     344# used for both editing windows and restrain-only display in main EXPGUI window
    335345#*****************************************************************************************
    336346proc SR_Fill_Display {main args} {
     
    386396        }
    387397    }
    388 
    389     bind $::sr_rb <Configure> {ResizeScrollTable $::sr_rb}
    390398}
    391399#****************************************************************************
     
    449457        if {$test == -1} {
    450458            set new_restraint ""
    451             set type1 [atominfo 1 [lindex $temp_res1 1] type]
     459            set type1 [atominfo [lindex $temp_res1 0] [lindex $temp_res1 1] type]
    452460            set type1 [lindex [split $type1 {+-}] 0]
    453             set type2 [atominfo 1 [lindex $temp_res1 2] type]
     461            set type2 [atominfo [lindex $temp_res1 0] [lindex $temp_res1 2] type]
    454462            set type2 [lindex [split $type2 {+-}] 0]
    455463
     
    458466                [lindex $temp_res1 5] [lindex $temp_res1 6] [lindex $temp_res1 7] \
    459467                "?.???" $type1 $type2 \
    460                 [atominfo 1 [lindex $temp_res1 1] label] [atominfo 1 [lindex $temp_res1 2] label] \
     468                [atominfo [lindex $temp_res1 0] [lindex $temp_res1 1] label] [atominfo [lindex $temp_res1 0] [lindex $temp_res1 2] label] \
    461469                $t2
    462470            set x [llength $::sr_bond_list]
     
    630638
    631639    set choice {"Show All Bonds" "Restrained Bonds" "Unrestrained Bonds"}
    632     set ::sr_entryvar(choice) "Show All Bonds"
    633640
    634641    set m1 [eval tk_optionMenu $srcb1.rcon3 sr_entryvar(choice) $choice]
     
    652659    grid $::srcb3.rbutton4     -column 0 -row 1 -pady 5
    653660
    654 
    655 
    656     SR_Display
    657 
     661    # remove traces
    658662    foreach item [trace vinfo ::sr_entryvar(softatom1)] {
    659663        eval trace vdelete ::sr_entryvar(softatom1) $item
    660664    }
    661     trace variable ::sr_entryvar(softatom1) w SR_Display
    662 
    663665    foreach item [trace vinfo ::sr_entryvar(softatom2)] {
    664666        eval trace vdelete ::sr_entryvar(softatom2) $item
    665667    }
    666     trace variable ::sr_entryvar(softatom2) w SR_Display
    667 
    668668    foreach item [trace vinfo ::sr_entryvar(choicenum)] {
    669669        eval trace vdelete ::sr_entryvar(choicenum) $item
    670670    }
     671    # reset filter vars
     672    set ::sr_entryvar(choice) "Show All Bonds"
     673    set ::sr_entryvar(choicenum) 0
     674    set ::sr_entryvar(softatom1) "all"
     675    set ::sr_entryvar(softatom2) "all"
     676    # search out distances
     677    SR_Display
     678    # set traces for future changes to filter vars
     679    trace variable ::sr_entryvar(softatom1) w SR_Display
    671680    trace variable ::sr_entryvar(choicenum) w SR_Display
    672 
     681    trace variable ::sr_entryvar(softatom2) w SR_Display
     682    # make editor window modal (lock it on top)
    673683    putontop $mrb
    674684}
     
    681691    set ::sr_distance_button 1
    682692    set ::sr_entryvar(choicenum) 0
    683     set ::sr_entryvar(softphase) "1"
     693#    set ::sr_entryvar(softphase) "1"
     694#    set ::sr_phaselist $::expmap(phaselist)
    684695    set ::sr_entryvar(softatom1) "all"
    685696    set ::sr_entryvar(softatom2) "all"
Note: See TracChangeset for help on using the changeset viewer.