Changeset 379
- Timestamp:
- Dec 4, 2009 5:05:11 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/addcmds.tcl
- Property rcs:date changed from 2001/04/03 19:16:41 to 2001/04/16 21:25:33
- Property rcs:lines changed from +68 -4 to +67 -7
- Property rcs:rev changed from 1.17 to 1.18
r378 r379 772 772 set row 0 773 773 set col 0 774 foreach i {Atom\ntype Name x y z Occ Uiso Use} { 775 grid [label $np.l_${row}$i -text $i] -column [incr col] -row $row 776 } 774 grid [label $np.l_${row}0 -text " # "] -column $col -row $row 775 foreach i {Atom\ntype Name x y z Occ Uiso} \ 776 var {type name x y z occ uiso} { 777 grid [button $np.l_${row}$i -text $i -padx 0 -pady 0 \ 778 -command "sortAddAtoms $phase $top $var"] \ 779 -column [incr col] -row $row -sticky nsew 780 } 781 grid [label $np.l_${row}Use -text Use\nFlag] -column [incr col] -row $row 777 782 778 783 set expgui(SetAddAtomsScroll) 0 … … 809 814 -column 3 -row 5 -columnspan 2 -sticky e 810 815 grid [button $top.fr.b3 -text "Import atoms from: " \ 811 -command "ImportAtoms \$expgui(importFormat) $top "] \816 -command "ImportAtoms \$expgui(importFormat) $top $phase"] \ 812 817 -column 0 -row 0 -sticky e 813 818 eval tk_optionMenu $top.fr.b4 expgui(importFormat) \ … … 1251 1256 } 1252 1257 1253 proc ImportAtoms {format top } {1258 proc ImportAtoms {format top phase} { 1254 1259 global expgui 1255 1260 foreach item $expgui(extensions_$format) { … … 1272 1277 } 1273 1278 } 1279 # sort the atoms by number, so that empty entries are at the bottom 1280 sortAddAtoms $phase $top number 1274 1281 } 1275 1282 … … 1484 1491 set row 0 1485 1492 set col 0 1486 foreach i {Atom\ntype Name x y z Occ Uiso Use} { 1487 grid [label $np.l_${row}$i -text $i] -column [incr col] -row $row 1488 } 1493 grid [label $np.l_${row}0 -text " # "] -column $col -row $row 1494 foreach i {Atom\ntype Name x y z Occ Uiso} \ 1495 var {type name x y z occ uiso} { 1496 grid [button $np.l_${row}$i -text $i -padx 0 -pady 0 \ 1497 -command "sortAddAtoms $phase $top $var"] \ 1498 -column [incr col] -row $row -sticky nsew 1499 } 1500 grid [label $np.l_${row}Use -text Use\nFlag] -column [incr col] -row $row 1489 1501 1490 1502 # add the old atoms, if appropriate … … 1535 1547 -column 3 -row 5 -columnspan 2 -sticky e 1536 1548 grid [button $top.fr.b3 -text "Import atoms from: " \ 1537 -command "ImportAtoms \$expgui(importFormat) $top "] \1549 -command "ImportAtoms \$expgui(importFormat) $top $phase"] \ 1538 1550 -column 0 -row 0 -sticky e 1539 1551 eval tk_optionMenu $top.fr.b4 expgui(importFormat) \ … … 1689 1701 } 1690 1702 1703 proc sortAddAtoms {phase top sortvar} { 1704 global expgui 1705 set np $top.canvas.fr 1706 set validlist {} 1707 set invalidlist {} 1708 set row 0 1709 while {![catch {grid info $np.e[incr row]t}]} { 1710 set valid 1 1711 set line $row 1712 if !{$expgui(UseAtom$row)} {set valid 0} 1713 lappend line $expgui(UseAtom$row) 1714 if {[set type [string trim [$np.e${row}t get]]] == ""} {set valid 0} 1715 lappend line [string trim [$np.e${row}t get]] 1716 lappend line [string trim [$np.e${row}n get]] 1717 foreach i {x y z o u} { 1718 set tmp [string trim [$np.e${row}$i get]] 1719 lappend line $tmp 1720 if {$tmp == "" || [catch {expr $tmp}]} {set valid 0} 1721 } 1722 if {$valid} { 1723 lappend validlist $line 1724 } else { 1725 lappend invalidlist $line 1726 } 1727 } 1728 switch $sortvar { 1729 type {set sortlist [lsort -index 2 -dictionary $validlist]} 1730 name {set sortlist [lsort -index 3 -dictionary $validlist]} 1731 x {set sortlist [lsort -index 4 -real $validlist]} 1732 y {set sortlist [lsort -index 5 -real $validlist]} 1733 z {set sortlist [lsort -index 6 -real $validlist]} 1734 occ {set sortlist [lsort -index 7 -real $validlist]} 1735 uiso {set sortlist [lsort -index 8 -real $validlist]} 1736 default {set sortlist $validlist} 1737 } 1738 1739 if {[llength $invalidlist] > 0} {append sortlist " $invalidlist"} 1740 set row 0 1741 foreach line $sortlist { 1742 incr row 1743 set expgui(UseAtom$row) [lindex $line 1] 1744 foreach item [lrange $line 2 end] \ 1745 var {t n x y z o u} { 1746 $np.e${row}$var delete 0 end 1747 $np.e${row}$var insert end $item 1748 } 1749 } 1750 }
Note: See TracChangeset
for help on using the changeset viewer.