Version 9 of GSOC2010:Themed Tk on Unix

Updated 2010-07-15 22:37:26 by Ewa

This is one of the GSoC 2010 Projects.

General

Title:

Themed Tk on Unix

Student

Ewa LeszczyƄska

Mentor

Jeff Hobbs

Abstract

Tk Widget Styling Support is a really old topic. First mention I found is http://www.tcl.tk/cgi-bin/tct/tip/48 with date of 23 July 2001, and I want to finish it now. I often have that urge to change the look of applications. But I know that theming is not just to make eye candies. This topic is generally about rewriting the code from Motif-looking widgets to use Qt or GTK instead. That way system layouts can have an effect on Tk programs.

Summary

I want to rewrite the code from Motif-looking widgets to use Qt or GTK instead. That way system layouts can have an effect on Tk programs. I am aware of previous attempts to achieve this goal. In the course of the project I will evaluate them and either use them or reimplement the code.

The concept of the solution was evolving through the years. Now Tile-qt is working but incomplete and segfaults on exit. Tile-gtk doesn't work at the moment. I want to spend some time reviewing it and talk to community of users, get mentor advice to get sure that they would be satisfied of that I will do and how.

I always spend some time to give my applications a distinct look and take care of good HCI. I like it how Tk looks under Mac, but I work mostly on Linux last days, so I more often have that feeling to do it another way and use the rich graphic possibilities.

Progress

After a lecture of Tcl/Tk Engineering Manual by John K. Ousterhout, and reading a lot of Tcl wiki pages and also scouring many of posts on comp.lang.tcl group and tons of other Internet information sources, I have compiled latest of Tcl and Tk sources and also tile-gtk and tile-qt. There were some problems, mostly in fault of my system deficiencies. While I was compiling tile-gtk, it ended with an error that it couldn't find some headers. It shows up that I didn't had the gtk-dev packages installed, but configure script didn't end with an error.

The basic difference those extensions bring is already visible in the simplest example: http://asterix.maxnet.org.pl/~aweelka/comparison.png http://asterix.maxnet.org.pl/~aweelka/Tile-qt.png The background color changes only on used widgets not on all window, so the border of widget is visible and can look ugly.

There is also a problem with changing themes on the fly. It doesn't happened until restart of an application. Despite that Qt and GTK support changing themes on the fly and all others applications on the system changes, tile-qt and tile-gtk applications don't work that way.

As you can see, both Qt and GTK based themes look more or less the same as all other applications on my Ubuntu version. They work up to some point, but consist mostly of rough edges. But the real problem seems to be the quality of the code. Configure scripts don't complain on missing libraries. There are no tests at all. Code is not following the engineering manual guidelines, lacks in comments and parts of it are in #if 0 blocks... On the other hand, it seems that the extensions seem to be good enough to run real applications (Coccinella uses tile-qt as the default theme on my system, even when running GNOME).

Dominant language in Tile-gtk is cpp - 4734 lines, which is 80.18% of its code. There is just 1017 (17.23%) of tcl. The rest 2.59% (153 l.) is written in bash, Makefiles and configure files. The situation with Tile-qt is almost the same - cpp make cpp 83.03% (3553 LoC), tcl 14.09% (603 LoC) and sh is 2.87% (123 l.) of code.

And some people have reported crashes, which I couldn't reproduce on my system. I still have much testing to do, which is bogged down by not having enough RAM (I have to install systems on a physical partition to test on them). I am using Ubuntu 9.10 - the Karmic Koala. I have 2.18.3-1ubuntu2.2 version of development files for the GTK+ library. Qt 4 development tools I have in 4.5.3really4.5.2-0ubuntu1 version. To work I currently use Tk CVS HEAD revision 1.2430 and Tcl revision 1.5154. The version of tile-gtk is commit 8be012927ccdbb66b4db271bfd35dabc634622bf, tile-qt fa7c3afbc426d16e82c59d01d93e8eaa913532d2 (both are the newest, but not really new, revisions).

So I have started writing my own extension. I have spent many hours on preparing all files to produce a Tcl extension (I started using an outdated TEA example and had to start from scratch at some point). For now all that it does is detecting whether the system is GNOME or KDE based. The fossil repository of this project is located at: http://hefka.pl:1027/

My current plan is to find all the lackings of both tile-qt and tile-gtk (like the one with label border described above) and try to cope with them. Then I'll try to work on overall code quality of the whole code base (this is not a small task, as both extensions are in the 5k range of LoC). Finally my extension will only be a wrapper that will choose which one will fit best the system (tile-qt or tile-gtk).

Contact Info

e-mail address: aweelka[at]gmail.com or jabber/xmpp: aweelka[at]maxnet.org.pl