Thursday, July 25, 2013

Running the Gnome 'yelp' Help System from Tcl/Gnocl applications.

I implemented some yelp help pages a while ago for my major app. After installing, however, the pages would load but not the graphics. When calling yelp all that needs to be passed is the directory containing all the pages, graphics, media etc. that are part of the help. To resolve this I resorted to launching a separate shell script to handle the help system. So, good-bye to:

set app(baseDir) $ENV(home)/help
exec yelp $app(baseDir)/help &


and hello to

exec my_yelp.sh &

Where my_yelp.sh is nothing more complex than

cd $HOME/help
yelp ./



Saturday, July 13, 2013

Its a lot of work!

Decided add to the ability to get more feedback from the gnocl package. The implementation of the cget command across the various widgets is still a little patchy and I've just added a new command, 'options' to all the widgets which will return a list of valid switches. With well over 50  modules to update this is a lot of work! Its taken me about 5hrs so far!
Following that I will add a similar command to obtain the valid widget and contents (e.g. text tags) sub-commands. For some widgets with just a handful of options and commands it something of an overkill but, then comes the task of updating the documentation.
I've completed most of the support in place for using pango markup strings in the text widget. The set of available tags is pre-defined, but quite extensive. Just a little more work in this area before the handling of <span.. </span> will work properly. Added this is a new toolbar with all the necessary buttons for the pango markup in place.


Monday, July 01, 2013

Dockable side toolbars

Gtk offers a dockable toolbar but this cannot be re-docked elsewhere on screen. The screenshot below shows a possible workaround using notebook groups. As the toolbar must be configured as either horizontal or vertical whenever a new page is dropped onto a notebook, then the toolbar will be automatically re-oriented. The accompanying script is basically for proof of principle rather than a realistic package.





proc addToolBarItems {tb} {
    foreach item {Open Close New Cut Paste Copy} {
        $tb add item -icon %#$item
    }
}


set container [gnocl::box]
set table [gnocl::table]
$container add $table -fill {1 1} -expand 1

set nb(1) [gnocl::notebook -groupId 1 -onPageAdded { %c configure -orientation %d } -data horizontal]
set nb(2) [gnocl::notebook -groupId 1 -tabPosition left -onPageAdded { %c configure -orientation %d } -data vertical]
set nb(3) [gnocl::notebook -groupId 1 -tabPosition right -onPageAdded { %c configure -orientation %d } -data vertical]
set nb(4) [gnocl::notebook -groupId 1 -onPageAdded { %c configure -orientation %d } -data horizontal]
set box(1) [gnocl::box -orientation vertical]

$table add $nb(1) 0 0 -columnSpan 3 -expand 0 -fill {1 0}
$table add $nb(2) 0 1 -expand 0 -fill {0 1}
$table add $box(1) 1 1  -expand 1 -fill {1 1}
$table add $nb(3)] 2 1 -expand 0 -fill {0 1}
$table add $nb(4) 0 2 -columnSpan 3 -expand 0 -fill {1 0}

$box(1) add [gnocl::text] -fill {1 1} -expand 1

set tb(1) [gnocl::toolBar -style icons]
set tb(2) [gnocl::toolBar -style icons -orientation vertical]
set tb(3) [gnocl::toolBar -style icons -orientation vertical]
set tb(4) [gnocl::toolBar -style icons]

addToolBarItems $tb(1)
addToolBarItems $tb(2)
addToolBarItems $tb(3)
addToolBarItems $tb(4)

$nb(1) addPage $tb(1) "TB1"
$nb(2) addPage $tb(2) "TB2"
$nb(3) addPage $tb(3) "TB3"
$nb(4) addPage $tb(4) "TB4"

gnocl::window \
    -child $container \
    -setSize 0.3 \
    -title test-side-toolbars
   

Recent Enhancements

Added the following enhancements to the nightly build code.

2013-07:
   gnocl::notebook
        o new options
            -data
        o added extra percentage subtitution strings to -onPageAdded, -onPageRemoved
            %c child
            %n page number
            %d data

2013-06:
    gnocl::toolBar
        o configure/cget -orientation now works