{"thread":{"id":"18057","subject":"[PATCH] gitk: put all startup code into a proc to enable re-sourcing","startedAt":"2009-02-28T00:17:13Z","lastAt":"2009-03-23T23:40:33Z","messageCount":3,"participants":["Pat Thoyts","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"106501","messageId":"87prh3e7p2.fsf@users.sourceforge.net","threadId":"18057","inReplyTo":null,"subject":"[PATCH] gitk: put all startup code into a proc to enable re-sourcing","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2009-02-28T00:17:13Z","receivedAt":"2009-02-28T00:17:13Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"\n    All the startup code is moved into a procedure. All the variables\n    get initialized using 'variable' to ensure they are in the global\n    namespace.  This makes it possible to re-source the script during\n    development from the Tk console or a tkcon interactive session.\n\nSigned-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n---\n gitk |  578 +++++++++++++++++++++++++++++++++++-------------------------------\n 1 files changed, 309 insertions(+), 269 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex dc2a439..f8c3c73 100755\n--- a/gitk\n+++ b/gitk\n@@ -7,6 +7,8 @@ exec wish \"$0\" -- \"$@\"\n # and distributed under the terms of the GNU General Public Licence,\n # either version 2, or (at your option) any later version.\n \n+package require Tk\n+\n proc gitdir {} {\n     global env\n     if {[info exists env(GIT_DIR)]} {\n@@ -1794,39 +1796,48 @@ proc show_error {w top msg} {\n }\n \n proc error_popup {msg {owner .}} {\n-    set w .error\n-    toplevel $w\n-    make_transient $w $owner\n-    show_error $w $w $msg\n+    if {[tk windowingsystem] eq \"win32\"} {\n+        tk_messageBox -icon error -type ok -title [wm title .] \\\n+            -parent $owner -message $msg\n+    } else {\n+        set w .error\n+        toplevel $w\n+        make_transient $w $owner\n+        show_error $w $w $msg\n+    }\n }\n \n proc confirm_popup {msg {owner .}} {\n-    global confirm_ok\n+    global confirm_ok use_ttk\n+    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n     set confirm_ok 0\n     set w .confirm\n     toplevel $w\n     make_transient $w $owner\n     message $w.m -text $msg -justify center -aspect 400\n     pack $w.m -side top -fill x -padx 20 -pady 20\n-    button $w.ok -text [mc OK] -command \"set confirm_ok 1; destroy $w\"\n+    ${ttk}::button $w.ok -text [mc OK] -command \"set confirm_ok 1; destroy $w\"\n     pack $w.ok -side left -fill x\n-    button $w.cancel -text [mc Cancel] -command \"destroy $w\"\n+    ${ttk}::button $w.cancel -text [mc Cancel] -command \"destroy $w\"\n     pack $w.cancel -side right -fill x\n     bind $w <Visibility> \"grab $w; focus $w\"\n-    bind $w <Key-Return> \"set confirm_ok 1; destroy $w\"\n+    bind $w <Key-Return> [list $w.ok invoke]\n     bind $w <Key-space>  \"set confirm_ok 1; destroy $w\"\n-    bind $w <Key-Escape> \"destroy $w\"\n+    bind $w <Key-Escape> [list $w.cancel invoke]\n+    tk::PlaceWindow $w widget $owner\n     tkwait window $w\n     return $confirm_ok\n }\n \n proc setoptions {} {\n-    option add *Panedwindow.showHandle 1 startupFile\n-    option add *Panedwindow.sashRelief raised startupFile\n+    if {[tk windowingsystem] ne \"win32\"} {\n+        option add *Panedwindow.showHandle 1 startupFile\n+        option add *Panedwindow.sashRelief raised startupFile\n+        option add *Menu.font uifont startupFile\n+    }\n     option add *Button.font uifont startupFile\n     option add *Checkbutton.font uifont startupFile\n     option add *Radiobutton.font uifont startupFile\n-    option add *Menu.font uifont startupFile\n     option add *Menubutton.font uifont startupFile\n     option add *Label.font uifont startupFile\n     option add *Message.font uifont startupFile\n@@ -10649,274 +10660,303 @@ proc get_path_encoding {path} {\n     return $tcl_enc\n }\n \n-# First check that Tcl/Tk is recent enough\n-if {[catch {package require Tk 8.4} err]} {\n-    show_error {} . [mc \"Sorry, gitk cannot run with this version of Tcl/Tk.\\n\\\n+proc init {args} {\n+    global env argv0\n+\n+    ## For msgcat loading, first locate the installation location.\n+    if { [info exists ::env(GITK_MSGSDIR)] } {\n+        ## Msgsdir was manually set in the environment.\n+        variable gitk_msgsdir $::env(GITK_MSGSDIR)\n+    } else {\n+        ## Let's guess the prefix from argv0.\n+        set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]\n+        variable gitk_libdir [file join $gitk_prefix share gitk lib]\n+        variable gitk_msgsdir [file join $gitk_libdir msgs]\n+        unset gitk_prefix\n+    }\n+\n+    ## Internationalization (i18n) through msgcat and gettext. See\n+    ## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html\n+    package require msgcat\n+    namespace import ::msgcat::mc\n+    ## And eventually load the actual message catalog\n+    ::msgcat::mcload $gitk_msgsdir\n+    \n+\n+    # First check that Tcl/Tk is recent enough\n+    if {[catch {package require Tk 8.4} err]} {\n+        tk_messageBox -icon error -type ok \\\n+            -title \"[file tail $argv0]: [file tail [pwd]]\"\\\n+            -message [mc \"Sorry, gitk cannot run with this version of Tcl/Tk.\\n\\\n \t\t     Gitk requires at least Tcl/Tk 8.4.\"]\n-    exit 1\n-}\n+        exit 1\n+    }\n \n-# defaults...\n-set wrcomcmd \"git diff-tree --stdin -p --pretty\"\n+    # Hide the main window until everything is ready.\n+    wm withdraw .\n \n-set gitencoding {}\n-catch {\n-    set gitencoding [exec git config --get i18n.commitencoding]\n-}\n-catch {\n-    set gitencoding [exec git config --get i18n.logoutputencoding]\n-}\n-if {$gitencoding == \"\"} {\n-    set gitencoding \"utf-8\"\n-}\n-set tclencoding [tcl_encoding $gitencoding]\n-if {$tclencoding == {}} {\n-    puts stderr \"Warning: encoding $gitencoding is not supported by Tcl/Tk\"\n-}\n+    # defaults...\n+    variable wrcomcmd \"git diff-tree --stdin -p --pretty\"\n \n-set gui_encoding [encoding system]\n-catch {\n-    set enc [exec git config --get gui.encoding]\n-    if {$enc ne {}} {\n-\tset tclenc [tcl_encoding $enc]\n-\tif {$tclenc ne {}} {\n-\t    set gui_encoding $tclenc\n-\t} else {\n-\t    puts stderr \"Warning: encoding $enc is not supported by Tcl/Tk\"\n-\t}\n-    }\n-}\n-\n-set mainfont {Helvetica 9}\n-set textfont {Courier 9}\n-set uifont {Helvetica 9 bold}\n-set tabstop 8\n-set findmergefiles 0\n-set maxgraphpct 50\n-set maxwidth 16\n-set revlistorder 0\n-set fastdate 0\n-set uparrowlen 5\n-set downarrowlen 5\n-set mingaplen 100\n-set cmitmode \"patch\"\n-set wrapcomment \"none\"\n-set showneartags 1\n-set maxrefs 20\n-set maxlinelen 200\n-set showlocalchanges 1\n-set limitdiffs 1\n-set datetimeformat \"%Y-%m-%d %H:%M:%S\"\n-set autoselect 1\n-set perfile_attrs 0\n-\n-set extdifftool \"meld\"\n-\n-set colors {green red blue magenta darkgrey brown orange}\n-set bgcolor white\n-set fgcolor black\n-set diffcolors {red \"#00a000\" blue}\n-set diffcontext 3\n-set ignorespace 0\n-set selectbgcolor gray85\n-set markbgcolor \"#e0e0ff\"\n-\n-set circlecolors {white blue gray blue blue}\n-\n-# button for popping up context menus\n-if {[tk windowingsystem] eq \"aqua\"} {\n-    set ctxbut <Button-2>\n-} else {\n-    set ctxbut <Button-3>\n-}\n-\n-## For msgcat loading, first locate the installation location.\n-if { [info exists ::env(GITK_MSGSDIR)] } {\n-    ## Msgsdir was manually set in the environment.\n-    set gitk_msgsdir $::env(GITK_MSGSDIR)\n-} else {\n-    ## Let's guess the prefix from argv0.\n-    set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]\n-    set gitk_libdir [file join $gitk_prefix share gitk lib]\n-    set gitk_msgsdir [file join $gitk_libdir msgs]\n-    unset gitk_prefix\n-}\n-\n-## Internationalization (i18n) through msgcat and gettext. See\n-## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html\n-package require msgcat\n-namespace import ::msgcat::mc\n-## And eventually load the actual message catalog\n-::msgcat::mcload $gitk_msgsdir\n-\n-catch {source ~/.gitk}\n-\n-font create optionfont -family sans-serif -size -12\n-\n-parsefont mainfont $mainfont\n-eval font create mainfont [fontflags mainfont]\n-eval font create mainfontbold [fontflags mainfont 1]\n-\n-parsefont textfont $textfont\n-eval font create textfont [fontflags textfont]\n-eval font create textfontbold [fontflags textfont 1]\n-\n-parsefont uifont $uifont\n-eval font create uifont [fontflags uifont]\n-\n-setoptions\n-\n-# check that we can find a .git directory somewhere...\n-if {[catch {set gitdir [gitdir]}]} {\n-    show_error {} . [mc \"Cannot find a git repository here.\"]\n-    exit 1\n-}\n-if {![file isdirectory $gitdir]} {\n-    show_error {} . [mc \"Cannot find the git directory \\\"%s\\\".\" $gitdir]\n-    exit 1\n-}\n-\n-set selecthead {}\n-set selectheadid {}\n-\n-set revtreeargs {}\n-set cmdline_files {}\n-set i 0\n-set revtreeargscmd {}\n-foreach arg $argv {\n-    switch -glob -- $arg {\n-\t\"\" { }\n-\t\"--\" {\n-\t    set cmdline_files [lrange $argv [expr {$i + 1}] end]\n-\t    break\n-\t}\n-\t\"--select-commit=*\" {\n-\t    set selecthead [string range $arg 16 end]\n-\t}\n-\t\"--argscmd=*\" {\n-\t    set revtreeargscmd [string range $arg 10 end]\n-\t}\n-\tdefault {\n-\t    lappend revtreeargs $arg\n-\t}\n+    set gitencoding {}\n+    catch {\n+        set gitencoding [exec git config --get i18n.commitencoding]\n+    }\n+    catch {\n+        set gitencoding [exec git config --get i18n.logoutputencoding]\n+    }\n+    if {$gitencoding == \"\"} {\n+        set gitencoding \"utf-8\"\n+    }\n+    variable tclencoding [tcl_encoding $gitencoding]\n+    if {$tclencoding == {}} {\n+        puts stderr \"Warning: encoding $gitencoding is not supported by Tcl/Tk\"\n     }\n-    incr i\n-}\n \n-if {$selecthead eq \"HEAD\"} {\n-    set selecthead {}\n-}\n+    variable gui_encoding [encoding system]\n+    catch {\n+        set enc [exec git config --get gui.encoding]\n+        if {$enc ne {}} {\n+            set tclenc [tcl_encoding $enc]\n+            if {$tclenc ne {}} {\n+                set gui_encoding $tclenc\n+            } else {\n+                puts stderr \"Warning: encoding $enc is not supported by Tcl/Tk\"\n+            }\n+        }\n+    }\n+    \n+    variable have_tk85 [package vsatisfies [package provide Tk] 8.5]\n+    variable use_ttk [llength [info commands ::ttk::style]]\n+    variable mainfont {Helvetica 9}\n+    variable textfont {Courier 9}\n+    variable uifont {Helvetica 9 bold}\n+    variable tabstop 8\n+    variable findmergefiles 0\n+    variable maxgraphpct 50\n+    variable maxwidth 16\n+    variable revlistorder 0\n+    variable fastdate 0\n+    variable uparrowlen 5\n+    variable downarrowlen 5\n+    variable mingaplen 100\n+    variable cmitmode \"patch\"\n+    variable wrapcomment \"none\"\n+    variable showneartags 1\n+    variable maxrefs 20\n+    variable maxlinelen 200\n+    variable showlocalchanges 1\n+    variable limitdiffs 1\n+    variable datetimeformat \"%Y-%m-%d %H:%M:%S\"\n+    variable autoselect 1\n+    variable perfile_attrs 0\n+\n+    variable extdifftool \"meld\"\n+\n+    variable colors {green red blue magenta darkgrey brown orange}\n+    variable bgcolor white\n+    variable fgcolor black\n+    variable diffcolors {red \"#00a000\" blue}\n+    variable diffcontext 3\n+    variable ignorespace 0\n+    variable selectbgcolor gray85\n+    variable markbgcolor \"#e0e0ff\"\n+\n+    variable circlecolors {white blue gray blue blue}\n+\n+    # button for popping up context menus\n+    if {[tk windowingsystem] eq \"aqua\"} {\n+        variable ctxbut <Button-2>\n+    } else {\n+        variable ctxbut <Button-3>\n+    }\n \n-if {$i >= [llength $argv] && $revtreeargs ne {}} {\n-    # no -- on command line, but some arguments (other than --argscmd)\n-    if {[catch {\n-\tset f [eval exec git rev-parse --no-revs --no-flags $revtreeargs]\n-\tset cmdline_files [split $f \"\\n\"]\n-\tset n [llength $cmdline_files]\n-\tset revtreeargs [lrange $revtreeargs 0 end-$n]\n-\t# Unfortunately git rev-parse doesn't produce an error when\n-\t# something is both a revision and a filename.  To be consistent\n-\t# with git log and git rev-list, check revtreeargs for filenames.\n-\tforeach arg $revtreeargs {\n-\t    if {[file exists $arg]} {\n-\t\tshow_error {} . [mc \"Ambiguous argument '%s': both revision\\\n+\n+    catch {source ~/.gitk}\n+\n+    font create optionfont -family sans-serif -size -12\n+\n+    parsefont mainfont $mainfont\n+    eval font create mainfont [fontflags mainfont]\n+    eval font create mainfontbold [fontflags mainfont 1]\n+\n+    parsefont textfont $textfont\n+    eval font create textfont [fontflags textfont]\n+    eval font create textfontbold [fontflags textfont 1]\n+    \n+    parsefont uifont $uifont\n+    eval font create uifont [fontflags uifont]\n+\n+    setoptions\n+\n+    # check that we can find a .git directory somewhere...\n+    if {[catch {set gitdir [gitdir]}]} {\n+        show_error {} . [mc \"Cannot find a git repository here.\"]\n+        exit 1\n+    }\n+    if {![file isdirectory $gitdir]} {\n+        show_error {} . [mc \"Cannot find the git directory \\\"%s\\\".\" $gitdir]\n+        exit 1\n+    }\n+\n+    variable selecthead {}\n+    variable selectheadid {}\n+    \n+    variable revtreeargs {}\n+    set cmdline_files {}\n+    set i 0\n+    set revtreeargscmd {}\n+    foreach arg $args {\n+        switch -glob -- $arg {\n+            \"\" { }\n+            \"--\" {\n+                set cmdline_files [lrange $args [expr {$i + 1}] end]\n+                break\n+            }\n+            \"--select-commit=*\" {\n+                set selecthead [string range $arg 16 end]\n+            }\n+            \"--argscmd=*\" {\n+                set revtreeargscmd [string range $arg 10 end]\n+            }\n+            default {\n+                lappend revtreeargs $arg\n+            }\n+        }\n+        incr i\n+    }\n+    \n+    if {$selecthead eq \"HEAD\"} {\n+        set selecthead {}\n+    }\n+    \n+    if {$i >= [llength $args] && $revtreeargs ne {}} {\n+        # no -- on command line, but some arguments (other than --argscmd)\n+        if {[catch {\n+            set f [eval exec git rev-parse --no-revs --no-flags $revtreeargs]\n+            set cmdline_files [split $f \"\\n\"]\n+            set n [llength $cmdline_files]\n+            set revtreeargs [lrange $revtreeargs 0 end-$n]\n+            # Unfortunately git rev-parse doesn't produce an error when\n+            # something is both a revision and a filename.  To be consistent\n+            # with git log and git rev-list, check revtreeargs for filenames.\n+            foreach arg $revtreeargs {\n+                if {[file exists $arg]} {\n+                    show_error {} . [mc \"Ambiguous argument '%s': both revision\\\n \t\t\t\t and filename\" $arg]\n-\t\texit 1\n-\t    }\n-\t}\n-    } err]} {\n-\t# unfortunately we get both stdout and stderr in $err,\n-\t# so look for \"fatal:\".\n-\tset i [string first \"fatal:\" $err]\n-\tif {$i > 0} {\n-\t    set err [string range $err [expr {$i + 6}] end]\n-\t}\n-\tshow_error {} . \"[mc \"Bad arguments to gitk:\"]\\n$err\"\n-\texit 1\n+                    exit 1\n+                }\n+            }\n+        } err]} {\n+            # unfortunately we get both stdout and stderr in $err,\n+            # so look for \"fatal:\".\n+            set i [string first \"fatal:\" $err]\n+            if {$i > 0} {\n+                set err [string range $err [expr {$i + 6}] end]\n+            }\n+            show_error {} . \"[mc \"Bad arguments to gitk:\"]\\n$err\"\n+            exit 1\n+        }\n     }\n-}\n \n-set nullid \"0000000000000000000000000000000000000000\"\n-set nullid2 \"0000000000000000000000000000000000000001\"\n-set nullfile \"/dev/null\"\n-\n-set have_tk85 [expr {[package vcompare $tk_version \"8.5\"] >= 0}]\n-\n-set runq {}\n-set history {}\n-set historyindex 0\n-set fh_serial 0\n-set nhl_names {}\n-set highlight_paths {}\n-set findpattern {}\n-set searchdirn -forwards\n-set boldids {}\n-set boldnameids {}\n-set diffelide {0 0}\n-set markingmatches 0\n-set linkentercount 0\n-set need_redisplay 0\n-set nrows_drawn 0\n-set firsttabstop 0\n-\n-set nextviewnum 1\n-set curview 0\n-set selectedview 0\n-set selectedhlview [mc \"None\"]\n-set highlight_related [mc \"None\"]\n-set highlight_files {}\n-set viewfiles(0) {}\n-set viewperm(0) 0\n-set viewargs(0) {}\n-set viewargscmd(0) {}\n-\n-set selectedline {}\n-set numcommits 0\n-set loginstance 0\n-set cmdlineok 0\n-set stopped 0\n-set stuffsaved 0\n-set patchnum 0\n-set lserial 0\n-set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == \"true\"}]\n-setcoords\n-makewindow\n-# wait for the window to become visible\n-tkwait visibility .\n-wm title . \"[file tail $argv0]: [file tail [pwd]]\"\n-readrefs\n-\n-if {$cmdline_files ne {} || $revtreeargs ne {} || $revtreeargscmd ne {}} {\n-    # create a view for the files/dirs specified on the command line\n-    set curview 1\n-    set selectedview 1\n-    set nextviewnum 2\n-    set viewname(1) [mc \"Command line\"]\n-    set viewfiles(1) $cmdline_files\n-    set viewargs(1) $revtreeargs\n-    set viewargscmd(1) $revtreeargscmd\n-    set viewperm(1) 0\n-    set vdatemode(1) 0\n-    addviewmenu 1\n-    .bar.view entryconf [mca \"Edit view...\"] -state normal\n-    .bar.view entryconf [mca \"Delete view\"] -state normal\n-}\n-\n-if {[info exists permviews]} {\n-    foreach v $permviews {\n-\tset n $nextviewnum\n-\tincr nextviewnum\n-\tset viewname($n) [lindex $v 0]\n-\tset viewfiles($n) [lindex $v 1]\n-\tset viewargs($n) [lindex $v 2]\n-\tset viewargscmd($n) [lindex $v 3]\n-\tset viewperm($n) 1\n-\taddviewmenu $n\n+    variable nullid \"0000000000000000000000000000000000000000\"\n+    variable nullid2 \"0000000000000000000000000000000000000001\"\n+    variable nullfile \"/dev/null\"\n+    \n+    variable runq {}\n+    variable history {}\n+    variable historyindex 0\n+    variable fh_serial 0\n+    variable nhl_names {}\n+    variable highlight_paths {}\n+    variable findpattern {}\n+    variable searchdirn -forwards\n+    variable boldids {}\n+    variable boldnameids {}\n+    variable diffelide {0 0}\n+    variable markingmatches 0\n+    variable linkentercount 0\n+    variable need_redisplay 0\n+    variable nrows_drawn 0\n+    variable firsttabstop 0\n+\n+    global nextviewnum curview selectedview selectedhlview\n+    global highlight_related highlight_files\n+    global viewcomplete viewactive viewname viewinstances\n+    global viewfiles viewargs viewargscmd viewperm nextviewnum\n+\n+    set nextviewnum 1\n+    set curview 0\n+    set selectedview 0\n+    set selectedhlview [mc \"None\"]\n+    set highlight_related [mc \"None\"]\n+    set highlight_files {}\n+    set viewfiles(0) {}\n+    set viewperm(0) 0\n+    set viewargs(0) {}\n+    set viewargscmd(0) {}\n+\n+    variable selectedline {}\n+    variable numcommits 0\n+    variable loginstance 0\n+    variable cmdlineok 0\n+    variable stopped 0\n+    variable stuffsaved 0\n+    variable patchnum 0\n+    variable lserial 0\n+    variable isworktree [expr {[exec git rev-parse --is-inside-work-tree] == \"true\"}]\n+    setcoords\n+    makewindow\n+    # wait for the window to become visible\n+    wm deiconify .\n+    tkwait visibility .\n+    wm title . \"[file tail $argv0]: [file tail [pwd]]\"\n+    readrefs\n+\n+    if {$cmdline_files ne {} || $revtreeargs ne {} || $revtreeargscmd ne {}} {\n+        # create a view for the files/dirs specified on the command line\n+        set curview 1\n+        set selectedview 1\n+        set nextviewnum 2\n+        set viewname(1) [mc \"Command line\"]\n+        set viewfiles(1) $cmdline_files\n+        set viewargs(1) $revtreeargs\n+        set viewargscmd(1) $revtreeargscmd\n+        set viewperm(1) 0\n+        set vdatemode(1) 0\n+        addviewmenu 1\n+        .bar.view entryconf [mca \"Edit view...\"] -state normal\n+        .bar.view entryconf [mca \"Delete view\"] -state normal\n+    }\n+\n+    if {[info exists permviews]} {\n+        foreach v $permviews {\n+            set n $nextviewnum\n+            incr nextviewnum\n+            set viewname($n) [lindex $v 0]\n+            set viewfiles($n) [lindex $v 1]\n+            set viewargs($n) [lindex $v 2]\n+            set viewargscmd($n) [lindex $v 3]\n+            set viewperm($n) 1\n+            addviewmenu $n\n+        }\n     }\n-}\n \n-if {[tk windowingsystem] eq \"win32\"} {\n-    focus -force .\n+    if {[tk windowingsystem] eq \"win32\"} {\n+        focus -force .\n+        bind . <Control-F2> {console show}\n+    }\n+\n+    getcommits {}\n }\n \n-getcommits {}\n+if {!$tcl_interactive} {\n+    if {![info exists initialized]} {\n+        set initialized 1\n+        set r [catch [linsert $argv 0 init] err]\n+        if {$r} {\n+            tk_messageBox -icon error -title \"Gitk error\" \\\n+                -message $errorInfo\n+        }\n+    }\n+}\n-- \n1.6.0.2.1172.ga5ed0\n"},{"id":"109035","messageId":"18887.24242.451428.980685@cargo.ozlabs.ibm.com","threadId":"18057","inReplyTo":"87prh3e7p2.fsf@users.sourceforge.net","subject":"Re: [PATCH] gitk: put all startup code into a proc to enable re-sourcing","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2009-03-23T10:04:34Z","receivedAt":"2009-03-23T10:04:34Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Pat Thoyts writes:\n\n>     All the startup code is moved into a procedure. All the variables\n>     get initialized using 'variable' to ensure they are in the global\n>     namespace.  This makes it possible to re-source the script during\n>     development from the Tk console or a tkcon interactive session.\n> \n> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n\nThe patch does other stuff as well, that should be mentioned in the\npatch description or split out into a separate patch - namely it\nchanges error_popup on win32 (why?) and it introduces some ttk widget\nuse into confirm_popup.\n\nPaul.\n"},{"id":"109119","messageId":"49C81DF1.6010208@users.sourceforge.net","threadId":"18057","inReplyTo":"18887.24242.451428.980685@cargo.ozlabs.ibm.com","subject":"Re: [PATCH] gitk: put all startup code into a proc to enable re-sourcing","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2009-03-23T23:40:33Z","receivedAt":"2009-03-23T23:40:33Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Paul Mackerras wrote:\n> Pat Thoyts writes:\n> \n>>     All the startup code is moved into a procedure. All the variables\n>>     get initialized using 'variable' to ensure they are in the global\n>>     namespace.  This makes it possible to re-source the script during\n>>     development from the Tk console or a tkcon interactive session.\n>>\n>> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n> \n> The patch does other stuff as well, that should be mentioned in the\n> patch description or split out into a separate patch - namely it\n> changes error_popup on win32 (why?) and it introduces some ttk widget\n> use into confirm_popup.\n> \n> Paul.\n\nThe changes to error_popup -- its fugly on windows. We have\ntk_messageBox for showing message boxes and where available this\nfunction will use a native messagebox which will look normal for the\nplatform.\n\nHowever, these should be in the theme patch and not in a code\nrefactoring patch. So I apologize and will redo more carefully.\n\nPat Thoyts\n"}]}