Skip to main content

Posts

Showing posts from February, 2013

Automating the widget creation process.

I spent a couple of hours this morning working out a Tcl script that will create the basic components for custom widgets. There are so many repetitive elements converting a few hundred lines of C code which, if one has to edit it all by hand, takes up too much time. I'm also quite notorious for being unable to spot spelling and grammar errors and so any extra help is always welcome. The way in which the module generator works is create create a sub-directory in the src folder, create the necessary *.h, *.c and readme (working on the autodocs pages next) and then patches the Makefile and the files gnocl.c and gnocl.h in readiness for the first compile. When I've got this to work properly, moving the whole lot into a separate, standalone Tcl/Gnocl app would be the best next move. In this case the main gnocl package can give bindings to the core Gtk+ widget set and any custom extras in a unique package that can be loaded as required.

gnocl::level

This morning I took a look at the task of adding more custom widgets to the gnocl tool-kit. What has always capture my imagination is the 'recording' and 'playback' level indicators typically found in sound recording apps. Now, I've no real idea of what should be looked for in such widget other than it should flash on and off, rise up and down and occasionally go into a red zone. So, I've added some experimental code to see how it should be pieced together and it looks like fun. There is still some way to go in order to make all the options configurable and the widget resizeable. If anyone's interested in the making serious use of it, please give me feedback and then I can enhance the code in a more meaningful way. Here's a screen shot and demo script. # test-level.tcl #!./bin/sh #\ exec tclsh "$0" "$@" package require Gnocl proc display {} {     global lev     set hb(1) [gnocl::hBox]         for {set i 0} {$i<20} {incr i}...

gnocl::labelEntry

The currently nightly build has code for some useful megawidgets which yet need fully documenting. One of these is the gnocl::labelEntry. Apart from having a label and entry the re is also the possibility of adding a child widget. This type of object can certainly be made in gnocl from simpler components, but this higher level of abstraction just makes life that much easier! Here's a screen shot and sample script. # test-le.tcl #!/bin/sh \ exec tclsh "$0" "$@" package require Gnocl set app(find,regexp) 1 set cb(1) [gnocl::checkButton \     -text "regexp" \     -variable app(find,regexp)] set le(1) [gnocl::labelEntry \     -text "Search For:" \     -variable app(find) \     -primaryIcon "%#Paste" \     -secondaryIcon "%#Clear" \     -onIconPress {puts "Yo!"}]         $le(1) configure \     -child $cb(1)        gnocl::window \     -child $le(1) \     -title "gnocl::labelEntry"

Switching the display of the Gnome desktop icons.

I am a minimalist. Some clutter makes be uncomfortable and lots of its makes me utterly confused. So, when it gets to the point where my desktop has a mountain of icons on it something has to go -its usually my temper but those icons can be hidden. The usual approach is to dig into the Gnome Configuration Editor to switch the Nautilus preferences. That's fine once or twice, but what if we want immediate de-clutter? The gnoclGconf package offers a solution. Here's a simple script to handle the job. # toggle desktop icons #!./bin/sh #\ exec tclsh "$0" "$@" package require Gnocl package require GnoclGconf gnocl::gconf set /apps/nautilus/preferences/show_desktop \     [gnocl::toggle [gnocl::gconf get /apps/nautilus/preferences/show_desktop] ] \     -type boolean exit Dropping this into my $HOME/bin directory means that I can use this as a command from any terminal. For more convenience I've added a panel launcher. So, now we see it, now we don't! Bye bot...