Skip to main content

Posts

Showing posts from June, 2011

gnocl::imageViewer

After a speedy beginning some drudgery set in today - must have re-wrote the module at least four times before getting the basics right. The viewer has its own special scroll window with a navigator window that popups up. The scrolled window isn't absolutely necessary but rightly deserves support but it's not possible to create a scrolled window and then add an image. So, the choice has to be made from the outset as to which which layout is required (pretty much like a box or paned widget). It is possible to draw to the pixbuf contained in the viewer which is the next milestone. # test-imageViewer.tcl #!/bin/sh #\ exec tclsh "$0" "$@" package require Gnocl package require GnoclImageView set iv(1) [gnocl::imageView -scrolled 1 -image %/[pwd]/desklet_or_gadget.png] set iv(2) [gnocl::imageView -image %/[pwd]/desklet_or_gadget.png] set box [gnocl::box] $box add $iv(1) -fill {1 1} -expand 1 $box add $iv(2) -fill {1 1} -expand 1 gnocl::win...

gnocl::imageViewer -new widget

Just downloaded and wrapped a first binding around Dov Grobgeld's gtk_image_viewer widget. Nice, fast  zooming and rotation of images with mouse/keyboard bindings. A couple of hours later... Also took a look at the GtkImageView library which ships with OpenSuse. On reflection I think that I'll fo with this option. The zoom action on the gtk_image_viewer widget has some edge bleed artefacts and doesn't appear have received some TLC in a while. Also. the docs aren't so good. The upside of this package was that I built the widget directly into the Gnocl core. With the GtkImageView route there are development libraries to be installed which means more dependencies which might not be too good a point for other users who want a slim-line version of Gnocl. What I've opted for as compromise is another installable package. Fortunately I have a simple package template which I can modify and so the transition was quite easy. I wonder why this widget is not in the Gtk+ core?

gnocl::text tags

Did some more work on text tags today. In doing so I learnt a lot about the cget subcommand and current use. Also implemented -data option for tags. What I need to do next is: 1) return a list of tags at the specified position as row,col and x,y. e.g. $txt tag get -position {r c},  and $txt tag get -cursor {x y}  2) clear tags within a specfied range e.g $txt tag clear from to -tags {tag1 tag2...}

Parsing a Slideshow XML file for the active wallpaper image.

Querying the sytem for information on the background will return the name of the *.xml file controlling the slideshow, if there is one running. tDom didn't like the code sample given below, but its easy enough to parse and strip out what we want on the Tcl side. The slideshow controller will correctly(?) determine which slide to show given the commencement date. So, next step, a bit of arithmatic! set xml {<background>   <starttime>     <year>2009</year>     <month>08</month>     <day>04</day>     <hour>00</hour>     <minute>00</minute>     <second>00</second>   </starttime> <!-- This animation will start at midnight. -->   <static>     <duration>1795.0</duration>     <file>/usr/share/backgrounds/cosmos/cloud.jpg</file>   </static>   <transition>     <duration>5.0</duration>     <from>/usr/share/backgrounds/cosmos/cloud.jpg</...

Slideshow Craziness

Well, this command is completed now and running quite well. In the end I dropped the -path option as its much easier to glob on the Tcl side than produce a whole pile of code. Here's the business... set fp [open test.xml w] puts $fp [gnocl::desktop slideShow \     -files [glob [pwd]/album/*.jpg] \     -duration 1.0 \     -transition 0.0 \     -start [list 00 00 00] ] close $fp As can be seen, the background in being changed every second. My desktop clock is ticking away and switches wallpaper changes do occur on the second and take about a half second to load. This should be sufficient to make the clock work. The script can check for a new bg graphic and then merge the images into the bg. So, might get that desktop clock to work after all!

new command: gnocl::desktop slideShow

I've enjoyed some progress today working with the desktop. I'm still a little disappointed that a new background cannot be activated without having to undergo a dissolve and that there is some delay in updating the desktop wallpaper. The idea I had in mind was to 'embed' a Tcl powered clock in the background. It might still be possible with an update every minute, but I would have like to have displayed the second hand. But, then this is the trade off in relying upon a daemon to manage the overall Gnome configuration settings. Anyway, this is how the test script is shaping up. puts 1--------------- gnocl::desktop slideShow \     -files {a.png b.png c.png} \     -duration 110 \     -transition 4 \     -start [clock format [clock seconds] -format "%H %M %S"] puts 2--------------- gnocl::desktop slideShow \     -path [pwd] \     -duration 120 \     -transition ...

Gnome desktop image

Returned to the task of altering the Gnome desktop background. Sorted the issue out at last! As the Developer docs are pretty minimal in this area (consisting of nothing other than a list of function prototypes) I downloaded the Gnome desktop code itself and took a rummage through its dirty linen! What I found was that the calls to set the background etc, in fact modify the gconf settings. Ok, I can now get the background to change but, I don't want the delay of waiting for some Daemon to pick it up! At the moment it takes about 3-5 seconds for a background to change. Looking through the nodes for background slide shows, there appears to be some way of setting the transition duration. So, I'll follow this one up soon.

markup docs and gnocl::list

Just updated the string markup documentation page based upon the Gtk 2.24 developer docs. There's a lot more information here now. Other tasks worked on over the past couple of days is adding functionality to the gnocl::list object so that it will output its full content as a single Tcl list. This will simplify script development where the current method is to parse through each row and column to obtain specific values. The new code will also attach header and datatypes to the list. I envisage some complications where a list may have an embedded object such as an image. In such instances, the path to the image will have to be returned.

pixbufs and lists

The past couple of day has seen me working on the pixbufs and treelist modules. I've added code for applying a 3x3 convolution matrix to the pixbuf to do some of the more routine image processing operations. The code isn't bulky and is much faster than working with imagemagic. There are still some glitches yet that need ironing out largely focussed on number conversion. I've also added some new search functionality to the treelist. The standard 'type-ahead find' is implemented and the basics are there for a proper search command. Rather than working on a single column, this will search the entire table of data for matches. I'll take a look too at rendering the contents of the cells that have a positive match.