diff options
author | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
---|---|---|
committer | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
commit | 48c9fcb7281cc6aa076113db874c7ae0e105795d (patch) | |
tree | 7187940ff056462bfa41705a2ce04d0ed07d424e /tests/butGeom2.tcl | |
parent | 41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff) | |
download | tk-contrib_patrick_fradin_code_cleanup.zip tk-contrib_patrick_fradin_code_cleanup.tar.gz tk-contrib_patrick_fradin_code_cleanup.tar.bz2 |
Contribution by Patrick Fradin <patrick.fradin@planar.com>contrib_patrick_fradin_code_cleanup
Quoting his mail:
<pre>
==========================================================
Hi Jeff,
I spent some of my time to contribute to the TclTk community ! I'm in
late for Christmas gift but like we said in French : "Mieux vaut tard
que jamais". ;-)
I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and
Tk library directories (library, tools and tests) to correct a lot of
warnings and few errors. (encapsulate some expr, use 'chan xxx'
instead of fconfigure, fileevent...)
I've made some improvements too :
Examples :
- Use 'lassign' instead of many 'lindex' of 'foreach/break' loop.
- Use 'in' or 'ni' operators instead of 'lsearch -exact' or to
factorise some eq/ne && / || tests.
- Use 'eq' or 'ne' to tests strings instead of '==' or '!='.
- Use 'unset -nocomplain' to avoid 'catch {unset...}'.
- Remove some useless catch around 'destroy' calls.
- Use expand {*} instead of 'eval'. Don't touch a lot of code because
I don't know all structs and lists. I think it could be a greater
improvement to reduce 'eval' calls.
Due to previous experience, I dot not change any indentation ! ;-)
==========================================================
</pre>
Diffstat (limited to 'tests/butGeom2.tcl')
-rw-r--r-- | tests/butGeom2.tcl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/butGeom2.tcl b/tests/butGeom2.tcl index 96ff209..8cc11f3 100644 --- a/tests/butGeom2.tcl +++ b/tests/butGeom2.tcl @@ -1,7 +1,7 @@ # This file creates a visual test for button layout. It is part of # the Tk visual test suite, which is invoked via the "visual" script. -catch {destroy .t} +destroy .t toplevel .t wm title .t "Visual Tests for Button Geometry" wm iconname .t "Button Geometry" @@ -17,7 +17,7 @@ pack .t.quit -side bottom -pady 2m set sepId 1 proc sep {} { global sepId - frame .t.sep$sepId -height 2 -bd 1 -relief sunken + frame .t.sep$sepId -height 2 -borderwidth 1 -relief sunken pack .t.sep$sepId -side top -padx 2m -pady 2m -fill x incr sepId } @@ -33,15 +33,15 @@ label .t.anchorLabel -text "Color:" frame .t.control.left.f -width 6c -height 3c pack .t.anchorLabel .t.control.left.f -in .t.control.left -side top -anchor w foreach opt {activebackground activeforeground background disabledforeground foreground highlightbackground highlightcolor } { - #button .t.color-$opt -text $opt -command "config -$opt \[tk_chooseColor]" + #button .t.color-$opt -text $opt -command "config -$opt \[tk_chooseColor\]" menubutton .t.color-$opt -text $opt -menu .t.color-$opt.m -indicatoron 1 \ - -relief raised -bd 2 + -relief raised -borderwidth 2 menu .t.color-$opt.m -tearoff 0 .t.color-$opt.m add command -label Red -command "config -$opt red" .t.color-$opt.m add command -label Green -command "config -$opt green" .t.color-$opt.m add command -label Blue -command "config -$opt blue" .t.color-$opt.m add command -label Other... \ - -command "config -$opt \[tk_chooseColor]" + -command "config -$opt \[tk_chooseColor\]" pack .t.color-$opt -in .t.control.left.f -fill x } @@ -73,9 +73,9 @@ frame .t.f4 pack .t.f4 -side top -expand 1 -fill both sep -label .t.l1 -text Label -bd 2 -relief sunken -label .t.l2 -text "Explicit\nnewlines\n\nin the text" -bd 2 -relief sunken -label .t.l3 -text "This text is quite long, so it must be wrapped automatically by Tk" -wraplength 2i -bd 2 -relief sunken -underline 50 +label .t.l1 -text Label -borderwidth 2 -relief sunken +label .t.l2 -text "Explicit\nnewlines\n\nin the text" -borderwidth 2 -relief sunken +label .t.l3 -text "This text is quite long, so it must be wrapped automatically by Tk" -wraplength 2i -borderwidth 2 -relief sunken -underline 50 pack .t.l1 .t.l2 .t.l3 -in .t.f1 -side left -padx 5m -pady 3m \ -expand y -fill both |