git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitk: make use of themed widgets where available

From
Paul Mackerras <paulus@samba.org>
Date
Mar 23, 2009, 05:34 UTC
Message-ID
<18887.8064.114036.850741@drongo.ozlabs.ibm.com>
In-Reply-To
<87ljrre7nr.fsf@users.sourceforge.net>
Pat Thoyts writes:
Show 5 quoted lines
>     This patch improves the appearence of gitk on Windows XP and Vista
>     by making use of the themed widgets that are provided in Tk 8.5
>     and above. For good Vista support 8.6 will be needed.
> 
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Thanks for the patch. It does seem to do a bit more than the commit description says, though:

- It adds a toggle-fullscreen function.  I'd prefer that was done in a
  separate patch.
- It makes various changes to the layout in the non-ttk case - in
  particular various message widgets get turned into label widgets.
  Are label widgets entirely equivalent to message widgets?

Also, the patch has been corrupted by your mailer: on lines containing only a "+", the "+" has been deleted.

I have a few questions about specific things you've done in the patch:
Show 5 quoted lines
> +proc ttk_toplevel {w args} {
> +    variable use_ttk
> +    eval [linsert $args 0 ::toplevel $w]
> +    if {$use_ttk} {
> +        place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1

What is the effect of this line, or what would happen if it wasn't there?

>  proc show_error {w top msg} {
> +    variable use_ttk
> +    set ttk [expr {$use_ttk ? "ttk" : ""}]

Is there a strong reason for using variable here rather than global, or is it just habit?

It looks to me as though $ttk might as well be a global variable, rather than computing it from $use_ttk everywhere that we need it.

Show 5 quoted lines
> @@ -1945,8 +1975,10 @@ proc makewindow {} {
>      }
>      . configure -menu .bar
>  
> +    place [${ttk}::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1
Once again, what's the reason for using place and the extra frame?
Show 9 quoted lines
> +    if {$use_ttk} {
> +        #set p1 [expr {[winfo screenwidth .] - (40 * $charspc)}]
> +        #set p0 [expr {[winfo screenwidth .] - (100 * $charspc)}]
> +        #.tf.histframe.pwclist sashpos 0 585
> +        #.tf.histframe.pwclist sashpos 1 868
> +     } else {
> +        eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)
> +        eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)
> +    }
Looks like that could be cleaned up a bit.
Show 15 quoted lines
> -    set gm [tk_optionMenu .tf.lbar.gdttype gdttype \
> -		[mc "containing:"] \
> -		[mc "touching paths:"] \
> -		[mc "adding/removing string:"]]
> +    if {$use_ttk} {
> +        set values [list [mc "containing:"] [mc "touching paths:"] \
> +                        [mc "adding/removing string:"]]
> +        set gm [ttk::combobox .tf.lbar.gdttype -width 10\
> +                    -values $values -textvariable gdtype]
> +    } else {
> +        set gm [tk_optionMenu .tf.lbar.gdttype gdttype \
> +                    [mc "containing:"] \
> +                    [mc "touching paths:"] \
> +                    [mc "adding/removing string:"]]
> +    }

We could profitably use a helper function here that would take the list of alternatives and make the combobox/optionMenu.

> -    $top.tohead conf -state readonly
> +    $top.tohead configure -state readonly

Do all the other instances of conf need to be changed to configure, and if so, why?

> -    checkbutton $top.showlocal -text [mc "Show local changes"] \
> -	-font optionfont -variable showlocalchanges
> +    ${ttk}::checkbutton $top.showlocal -text [mc "Show local changes"] \
> +	-variable showlocalchanges
Why do we lose the -font optionfont?

Thanks, Paul.

Previous: Pat ThoytsNext: Pat Thoyts
Message 6 of 7 in “gitk: make use of themed widgets where available”
  1. gitk: make use of themed widgets where availablePat Thoyts, Feb 28, 2009
  2. Sverre RabbelierFeb 28, 2009
  3. Pat ThoytsFeb 28, 2009
  4. Paul MackerrasFeb 28, 2009
  5. Pat ThoytsFeb 28, 2009
  6. Paul MackerrasMar 23, 2009
  7. Pat ThoytsMar 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.