Did you know about the gtkdialog lib?

Puppies built from Woof-CE uses /usr/lib/gtkdialog/ to unify the look of builtin GUIs. Together with the new vector icon set (in /usr/share/pixmaps/puppy), the gtkdialog lib made it possible to give Puppy a facelift without adding any bloat to the core.

The lib is simple and small. It is meant to reduce the code for repeating requests (as message-boxes), and unify the look for graphical widgets (as scalegrips and svgs). A complete guide how to use the different snippets are found inside each file (open in text-editor). It contains 3 different categories:


1. BOX
These return running gtkdialog boxes with requested info. Gtkdialog is not complex at all, but dead simple boxes often used by Puppy, can be set up with a oneliner. This is not meant as a replacement for Xdialog.

There are atm 4 different types of boxes:
box_help
box_ok
box_splash
box_yesno

Example:

/usr/lib/gtkdialog/box_ok Title error "This is an error"


2. XML
While the box-code produces a running gui, the xml-code is gtkdialog code meant to be embedded inside the parent gui. These are used to unify the look, and is cooperating with pTheme to follow the global theming.

There are 4 xml-snippets available:
xml_button_icon
xml_info
xml_pixmap
xml_scalegrip

Example: - Note the 'xml_info gtk' that activates the gtkdialog-theme set by pTheme.

export GUI=' 

<vbox space-expand="true" space-fill="true">
'"`/usr/lib/gtkdialog/xml_info fixed puppy_config.svg 60 "This is the header used in Puppy these days. It handles <b>markups</b>."`"'
<button ok></button>
</vbox>'
. /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
gtkdialog -p GUI


3. SVG
The svg category returns svg-code to embed in the gtkdialog code. Today, there are 3, but the knob shown in previous post should probably be added here. As expected, the svg bars and text follows the global theming set by pTheme.
svg_analogclock
svg_bar
svg_text

Example:

echo ' 

<vbox>
<timer visible="false">
<action>/usr/lib/gtkdialog/svg_analogclock 300 > /tmp/clock.svg</action>
<action>refresh:CLOCK</action>
</timer>
<pixmap space-expand="false" space-fill="false">
<variable>CLOCK</variable>
<input file>/tmp/clock.svg</input>
</pixmap>
</vbox>' | gtkdialog -s

Posted on 19 May 2016, 20:19 by zigbert - Categories: Development
Edit - Delete

No comments posted yet.

Fonte dell'articolo