summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2012-09-05 19:34:04 +0100
committerNick White <git@njw.me.uk>2012-09-05 19:34:04 +0100
commit14ec58b563dec017fa4e7c7b901d674aea41a454 (patch)
treec03cf964277f86720e20b044e2cc4d39b5da32a7
parentc36bc927de948003f8fd3aea8a3cfa68f7e4ead2 (diff)
Improve style of tcl, and ensure file operations are platform independent
-rwxr-xr-xgetxbookgui.tcl15
1 files changed, 10 insertions, 5 deletions
diff --git a/getxbookgui.tcl b/getxbookgui.tcl
index 0c5c116..eb3c863 100755
--- a/getxbookgui.tcl
+++ b/getxbookgui.tcl
@@ -13,7 +13,7 @@ set dling 0
set manual 0
set env(PATH) "[file dirname $::argv0]:$env(PATH)"
-set iconpath "[file dirname $::argv0]/icons"
+set iconpath [file join [file dirname $::argv0] icons]
proc updateStatus {chan} {
global dling
@@ -26,7 +26,9 @@ proc updateStatus {chan} {
if { [regexp {^([0-9]*)} $a m num] && "$num" != "" } {
.prog coords bar 0 0 [expr $num * 2] 20
}
- } else { .st configure -text $a }
+ } else {
+ .st configure -text $a
+ }
}
} else {
if { ! [catch {close $chan}] } {
@@ -41,7 +43,9 @@ proc updateStatus {chan} {
proc go {} {
global dling cmdselected cmds
- if { [.input.id get] == "" } { return }
+ if { [.input.id get] == "" } {
+ return
+ }
set cmd "[lindex [lindex $cmds $cmdselected] 0] [.input.id get]"
set dling 1
.dl configure -state disabled -text "Downloading"
@@ -107,7 +111,7 @@ frame .cmdfr
set i 0
foreach b $cmds {
set cmdname [lindex $b 0]
- if { [catch {image create photo im$i -file "$iconpath/$cmdname.gif"}] } {
+ if { [catch {image create photo im$i -file [file join $iconpath $cmdname.gif]}] } {
image create photo im$i
}
button .cmdfr.$i -text [lindex $b 2] -image im$i \
@@ -133,5 +137,6 @@ bind . <Return> go
bind .input.id <Key> {set manual 1; checkinput}
bind .input.id <Button> {set manual 1; checkinput}
-bind .input.id <Motion> {checkinput} ;# needed as middle-click pasting isn't passed with <Button>
+# needed as middle-click pasting isn't passed with <Button>
+bind .input.id <Motion> {checkinput}
watchsel