Re: [msysGit] [PATCH] git-gui: use themed tk widgets with Tk 8.5

Previous thread: Delete a commit by Bertram Scharpf on Saturday, December 19, 2009 - 4:39 pm. (8 messages)

Next thread: [PATCH] rebase -i: print the editor name if it fails to launch by =?UTF-8?B?QmrDtnJuIEd1c3RhdnNzb24=?= on Sunday, December 20, 2009 - 1:32 am. (4 messages)
From: Pat Thoyts
Date: Saturday, December 19, 2009 - 5:46 pm

This patch enables the use of themed Tk widgets with Tk 8.5 and above.
 These make a significant difference on Windows in making the application
 appear native. The gui.usettk git config variable may be set to disable
 this if the user prefers the classic Tk look.
 On Windows and MacOSX ttk defaults to the native look as much as possible.
 On X11 the user may select a theme using the TkTheme XRDB resource class.
 Some support is included for Tk 8.6 features (themed spinbox and native
 font chooser for MacOSX and Windows).

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

There is a screenshot of this running on Windows 7 at
http://www.patthoyts.tk/screenshots/git-gui-win32.png
It has been tested on Linux but not on MacOSX yet.

---
 git-gui.sh                   |  158 +++++++++++++++++++++++++++---------------
 lib/about.tcl                |   53 +++++++-------
 lib/blame.tcl                |   22 +++---
 lib/branch_checkout.tcl      |   20 +++--
 lib/branch_create.tcl        |   45 ++++++------
 lib/branch_delete.tcl        |   24 +++---
 lib/branch_rename.tcl        |   32 +++++----
 lib/browser.tcl              |   41 ++++++-----
 lib/choose_font.tcl          |   31 +++++----
 lib/choose_repository.tcl    |   94 ++++++++++++-------------
 lib/choose_rev.tcl           |   51 ++++++++------
 lib/class.tcl                |    7 ++
 lib/console.tcl              |   17 +++--
 lib/database.tcl             |   20 +++---
 lib/error.tcl                |   15 +++--
 lib/index.tcl                |   13 ++--
 lib/merge.tcl                |   14 ++--
 lib/option.tcl               |   67 ++++++++++--------
 lib/remote_add.tcl           |   37 +++++-----
 lib/remote_branch_delete.tcl |   51 +++++++-------
 lib/search.tcl               |   11 ++--
 lib/sshkey.tcl               |   20 +++---
 lib/status_bar.tcl           |   14 ++--
 lib/themed.tcl               |  156 +++++++++++++++++++++++++++++++++++++++++
 lib/tools_dlg.tcl            |   87 ...
From: Johannes Schindelin
Date: Sunday, December 20, 2009 - 6:16 am

Hi,



Please put this paragraph after the "---". Oh, and could you also include 
a screenshot without ttk?

As to the patch: it is huge.  I suspect that it would be easier to read 
and verify if it was done in two patches: the first one introducing helper 
procs that replace the existing repeated code, and a second patch that 
modifies only the helper procs to handle ttk if desired.  You did that 
with pad_label, but that proc is not defined in a central place, but 
limited to about.tcl.

Hmm?

Thanks,
Dscho
--

From: Pat Thoyts
Date: Sunday, December 20, 2009 - 8:23 am

echo '*TkTheme: clam' | xrdb -merge -

Or edit ~/.Xdefaults or maybe ~/.Xresources to add a line containing
 *TkTheme: clam
Used to be the X resource database was the way to customize X11. The
builtin themes are:
default: thin borders, kind of windows98ish
classic: motif style
alt: more windowsy still.
clam: based on some version of the XFCE look a few years ago.

On Windows you also get winnative, xpnative or vista but the intention
is that Tk just makes everything look native by selecting the correct
theme when it starts up. MacOSX gets an aqua theme. There is some work
in progress to get the Qt or Gtk styling engines to draw the ttk
elements so that it can pick up the current GNOME/KDE desktop -
effectively making it look native on such systems there too. However,
on Windows is where this stuff makes the most difference and works
best.

You can of course just run git-gui in any git repository to see how it
looks at the moment. However I put up another screenshot at
http://www.patthoyts.tk/screenshots/git-gui-old.png which is the
unmodified git-gui code with tcl8.5. The fonts look worse with 8.4

I could split it up but it is quite hard to validate without switching
themes to ensure you got everything. I toggle through some themes
looking for unchanged widgets or rogue borders.
I did find a bug in the choose_rev conversion when I rechecked with
tcl 8.4 so I will reissue this.

Pat Thoyts
--

From: Junio C Hamano
Date: Sunday, December 20, 2009 - 12:04 pm

On X, does the "default: thin borders, kind of windows98ish" look very
different from the non-themed classic Tk style?

What I am trying to get at is to gain enough information so that I can
suggest a rewrite of these two lines (quoted at the beginning by Dscho)
like this:

   Ttk defaults to the native look as much as possible on Windows and
   MacOSX; the default on X is the _________ look.

   The user may choose a theme by:

   - on Windows, doing ________;
   - on MacOSX, doing _________;
   - on X, selecting a theme using the TkTheme XRDB resource class;

which I think would be much easier to read.

--

From: Pat Thoyts
Date: Sunday, December 20, 2009 - 1:25 pm

Here is a big set of screenshots then:

Unmodified or with Tk 8.4:
original windows: http://www.patthoyts.tk/screenshots/git-gui-old.png
original unix:        http://www.patthoyts.tk/screenshots/git-gui-x11.png

With Tk 8.5 and using themed widgets:
unix default: http://www.patthoyts.tk/screenshots/git-gui-default.png
unix alt:        http://www.patthoyts.tk/screenshots/git-gui-alt.png
unix classic: http://www.patthoyts.tk/screenshots/git-gui-classic.png
unix clam:     http://www.patthoyts.tk/screenshots/git-gui-clam.png
unix tileqt:    http://www.patthoyts.tk/screenshots/git-gui-tileqt.png
 (experimental)


You write better than I do. The theme used globally by themed Tk can
be selected on at least Ubuntu's GNOME desktop by adding the following
line into ~/.Xresources:
  *TkTheme: clam
It is also possible to add a Theme menu or selection combobox onto the
options dialog and record a theme selection along with the other
git-gui saved options. Then a user could use 'git config gui.theme
clam'. The set of available themes can be extended with packages and
is somewhat platform dependent (ie: xpnative can only be present on
Windows XP and above).

Pat Thoyts.
--

From: Junio C Hamano
Date: Sunday, December 20, 2009 - 2:05 pm

Which is probably very helpful to others.  Thanks.

On the other hand, if you wanted to give me just a quick answer, you
simply could have said "The default X11 theme looks like the good old
classic Tk that draws diamond shaped radio-buttons". (which is the
impression I got after running the current git-gui installation on my box
and comparing it with your "Tk 8.5 themed with unix default").
--

Previous thread: Delete a commit by Bertram Scharpf on Saturday, December 19, 2009 - 4:39 pm. (8 messages)

Next thread: [PATCH] rebase -i: print the editor name if it fails to launch by =?UTF-8?B?QmrDtnJuIEd1c3RhdnNzb24=?= on Sunday, December 20, 2009 - 1:32 am. (4 messages)