summaryrefslogtreecommitdiffstats
path: root/library/bgerror.tcl
diff options
context:
space:
mode:
authorandreask <andreask>2013-01-22 19:30:43 (GMT)
committerandreask <andreask>2013-01-22 19:30:43 (GMT)
commit48c9fcb7281cc6aa076113db874c7ae0e105795d (patch)
tree7187940ff056462bfa41705a2ce04d0ed07d424e /library/bgerror.tcl
parent41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff)
downloadtk-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 'library/bgerror.tcl')
-rw-r--r--library/bgerror.tcl22
1 files changed, 11 insertions, 11 deletions
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index d1ed60a..ae73fba 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -38,8 +38,8 @@ proc ::tk::dialog::error::Return {which code} {
proc ::tk::dialog::error::Details {} {
set w .bgerrorDialog
- set caption [option get $w.function text {}]
- set command [option get $w.function command {}]
+ set caption [option get $w.function text ""]
+ set command [option get $w.function command ""]
if { ($caption eq "") || ($command eq "") } {
grid forget $w.function
}
@@ -61,7 +61,7 @@ proc ::tk::dialog::error::SaveToLog {text} {
]
set filename [tk_getSaveFile -title [mc "Select Log File"] \
-filetypes $types -defaultextension .log -parent .bgerrorDialog]
- if {$filename ne {}} {
+ if {$filename ne ""} {
set f [open $filename w]
puts -nonewline $f $text
close $f
@@ -81,7 +81,7 @@ proc ::tk::dialog::error::DeleteByProtocol {} {
set button 1
}
-proc ::tk::dialog::error::ReturnInDetails w {
+proc ::tk::dialog::error::ReturnInDetails {w} {
bind $w <Return> {}; # Remove this binding
$w invoke
return -code break
@@ -97,7 +97,7 @@ proc ::tk::dialog::error::ReturnInDetails w {
# Arguments:
# err - The error message.
#
-proc ::tk::dialog::error::bgerror err {
+proc ::tk::dialog::error::bgerror {err} {
global errorInfo tcl_platform
variable button
@@ -121,9 +121,9 @@ proc ::tk::dialog::error::bgerror err {
set displayedErr ""
set lines 0
set maxLine 45
- foreach line [split $err \n] {
+ foreach line [split $err "\n"] {
if { [string length $line] > $maxLine } {
- append displayedErr "[string range $line 0 [expr {$maxLine-3}]]..."
+ append displayedErr "[string range $line 0 [expr {$maxLine - 3}]]..."
break
}
if { $lines > 4 } {
@@ -153,7 +153,7 @@ proc ::tk::dialog::error::bgerror err {
wm protocol $dlg WM_DELETE_WINDOW [namespace code DeleteByProtocol]
if {$windowingsystem eq "aqua"} {
- ::tk::unsupported::MacWindowStyle style $dlg moveableAlert {}
+ ::tk::unsupported::MacWindowStyle style $dlg moveableAlert ""
} elseif {$windowingsystem eq "x11"} {
wm attributes $dlg -type dialog
}
@@ -184,7 +184,7 @@ proc ::tk::dialog::error::bgerror err {
set wrapwidth [winfo screenwidth $dlg]
# ...minus the width of the icon, padding and a fudge factor for
# the window manager decorations and aesthetics.
- set wrapwidth [expr {$wrapwidth-60-[winfo pixels $dlg 9m]}]
+ set wrapwidth [expr {$wrapwidth - 60 - [winfo pixels $dlg 9m]}]
ttk::label $dlg.msg -justify left -text $text -wraplength $wrapwidth
ttk::label $dlg.bitmap -image ::tk::icons::error
@@ -259,7 +259,7 @@ proc ::tk::dialog::error::bgerror err {
namespace eval :: {
# Fool the indexer
- proc bgerror err {}
- rename bgerror {}
+ proc bgerror {err} {}
+ rename bgerror ""
namespace import ::tk::dialog::error::bgerror
}