Gtkdialog Development
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
Added a fontbutton widget
Widget reference: fontbutton widget
Example: examples/fontbutton/fontbutton
Widget reference: fontbutton widget
Example: examples/fontbutton/fontbutton
- Attachments
-
- fontbutton.png
- (10.06 KiB) Downloaded 909 times
Last edited by thunor on Sat 18 Aug 2012, 14:32, edited 1 time in total.
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
Added "activate" action function
Example: examples/miscellaneous/activate
Description: Allows activation of compatible widgets programatically in a similar way to the user pressing Enter on a focused widget. Can be used as a shortcut for changing the state of toggling widgets, executing the code attached to another widget to eliminate code duplication, activating invisible/insensitive widgets and likely lots of other things I haven't thought of yet.
Example: examples/miscellaneous/activate
Description: Allows activation of compatible widgets programatically in a similar way to the user pressing Enter on a focused widget. Can be used as a shortcut for changing the state of toggling widgets, executing the code attached to another widget to eliminate code duplication, activating invisible/insensitive widgets and likely lots of other things I haven't thought of yet.
- Attachments
-
- activate.png
- (7.73 KiB) Downloaded 897 times
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
Fixed button image with label alignment
Widget reference: button widget
Example: examples/button/button_image_horizontal_alignment
Description: Images with labels are now centred by default as you'd expect from a stock button, but I've offered an additional method of packing them uniformly with homogeneous="true" declared within the button tag.
Widget reference: button widget
Example: examples/button/button_image_horizontal_alignment
Description: Images with labels are now centred by default as you'd expect from a stock button, but I've offered an additional method of packing them uniformly with homogeneous="true" declared within the button tag.
Last edited by thunor on Tue 21 Aug 2012, 01:35, edited 1 time in total.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
would that just be (an event box?), button-press-event and a check to see which button? If so, may as well add middle and scrolls.zigbert wrote:Is it possible to add mouse-right-click to <table> widget?
Sigmund
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
I like the button label/image alignment - always been a struggle to get around this .... Thank you.
When is comes to mouse-right-click in <table>, I think of some similar to <tree><action signal="button-release-event">. My intention is to build a right-click menu in the Pmusic left-pane. Today, <table> is the only widget that renders fast enough for huge amount of data. But (compared to <tree>), it lack fetaures like signals, icons and sort when click on column-header.
In addition to a right-click menu, <action signal=...> is the way I move items in playlist.
Sigmund
When is comes to mouse-right-click in <table>, I think of some similar to <tree><action signal="button-release-event">. My intention is to build a right-click menu in the Pmusic left-pane. Today, <table> is the only widget that renders fast enough for huge amount of data. But (compared to <tree>), it lack fetaures like signals, icons and sort when click on column-header.
In addition to a right-click menu, <action signal=...> is the way I move items in playlist.
Sigmund
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
gtkdialog is getting so powerful!
What you guys need now is a GUI layout designer, that presents all the features/options in a GUI and generates XML.
Like the RAD Tool that alexfish, vovchik and others are developing for BaCon:
http://basic-converter.proboards.com/in ... board=code
...hmmm, I wonder if that could be adapted as a RAD tool for gtkdialog?
What you guys need now is a GUI layout designer, that presents all the features/options in a GUI and generates XML.
Like the RAD Tool that alexfish, vovchik and others are developing for BaCon:
http://basic-converter.proboards.com/in ... board=code
...hmmm, I wonder if that could be adapted as a RAD tool for gtkdialog?
[url]https://bkhome.org/news/[/url]
The <input> doesn't like files that are written to - see example. Doesn't matter if using <input>command or <input file>
The <entry> does not refresh each second.
My feeling says that this issue has become worse in the 0.8.1 branch. It is the same problem for <checkbox> (I haven't tested more).
The <entry> does not refresh each second.
My feeling says that this issue has become worse in the 0.8.1 branch. It is the same problem for <checkbox> (I haven't tested more).
Code: Select all
#!/bin/bash
echo false > /tmp/TestExit
functionA (){
while [ "$(</tmp/TestExit)" != "true" ]; do
date > /tmp/test
done
}
functionA &
echo '<vbox>
<timer><action>refresh:ENTRY</action></timer>
<entry><variable>ENTRY</variable><input file>/tmp/test</input></entry>
</vbox>' | gtkdialog -s
echo true > /tmp/TestExit
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
The image auto-refresh could just as easily be applied to any tag that reads a file. BTW,I used inotify directly because puppy has had issues with gio due to interconnection with gvfs and/or dbus, but I don't specifically know that it won't work.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
That's an interesting problem.zigbert wrote:The <input> doesn't like files that are written to - see example. Doesn't matter if using <input>command or <input file>
The <entry> does not refresh each second.
My feeling says that this issue has become worse in the 0.8.1 branch. It is the same problem for <checkbox> (I haven't tested more).
Code: Select all
#!/bin/bash echo false > /tmp/TestExit functionA (){ while [ "$(</tmp/TestExit)" != "true" ]; do date > /tmp/test done } functionA & echo '<vbox> <timer><action>refresh:ENTRY</action></timer> <entry><variable>ENTRY</variable><input file>/tmp/test</input></entry> </vbox>' | gtkdialog -s echo true > /tmp/TestExit
The gtkdialog function that reads the file and sets the text is fill_entry_by_file .
I placed some test messages into the function so I can see why it's not updating: the file /tmp/test always opens for reading but it hasn't always got something in it. Ocassionally there will be the date inside it but the majority of the time it's empty. So why would that be the case? I'm guessing that /tmp/test is being recreated very speedily by functionA and when the timer refreshes ENTRY once per second, it opens it for reading but it's just been recreated so it's empty. In fact you can see this behaviour by placing <action>echo tick; cat /tmp/test</action> immediately following the <timer> tag.
You can solve this by placing "sleep 1" or "sleep 0.5" inside functionA.
So I can confirm that the timer is ticking every second and that the file is being opened for reading every second but the file is mostly empty so the entry widget isn't being written to which causes it to appear stuck at the last date/time.
The checkbox: can you give me an an example please and I'll look into it. The example I wrote based on your method here, which you said remove <action>if true refresh:chkSwitch</action> from the checkbox because the timer will do it, well that can cause the checkbox to be stuck to true so if you're using that method somewhere then you're going to have problems with it.
Last edited by thunor on Wed 22 Aug 2012, 01:08, edited 1 time in total.
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
Sigmund
Here's a version of the conditional widget refreshing method that I've been using in my PlayMusic example application. It refreshes on the toggle and you write the inverse of the checkbox's current state to the input file so it doesn't require resetting.
Here's a version of the conditional widget refreshing method that I've been using in my PlayMusic example application. It refreshes on the toggle and you write the inverse of the checkbox's current state to the input file so it doesn't require resetting.
Code: Select all
#!/bin/sh
GTKDIALOG=gtkdialog
export TMPDIR=/tmp/gtkdialog/examples/"$(basename $0)"
mkdir -p "$TMPDIR"
echo false > "$TMPDIR"/chkCheck
export MAIN_DIALOG='
<window title="Conditional Widget Refreshing">
<vbox>
<hbox>
<timer>
<action>refresh:chkCheck</action>
</timer>
<checkbox sensitive="false">
<variable>chkCheck</variable>
<input file>'"$TMPDIR"'/chkCheck</input>
<action>refresh:entDate</action>
</checkbox>
</hbox>
<entry editable="false">
<variable>entDate</variable>
<input>date</input>
</entry>
<button>
<label>"Write the inverse of the checkbox'"'"'s current state to its input
file causing it to refresh the date and time via the timer."</label>
<action>"if [ $chkCheck = true ]; then
echo false > '"$TMPDIR"'/chkCheck
else
echo true > '"$TMPDIR"'/chkCheck
fi"</action>
</button>
<hseparator></hseparator>
<hbox homogeneous="true" space-expand="false" space-fill="false">
<button use-stock="true" label="gtk-quit"></button>
</hbox>
</vbox>
</window>
'
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --space-expand=true --space-fill=true --program=MAIN_DIALOG ;;
esac
Thunor
The issue with <checkbox> is similar to the <entry> - You can't actually rely on that it refreshes EVERY time.
This is no big issue, and I guess we talk about complexity when this troubles in 'real' code (and not a built example). It hit badly in pMuisc because the refreshing of Trackinfo uses the same <checkbox> for all trackinfo items. And pMusic won't wait until all items are found until it refreshes. When lyrics is found - refresh. When metainfo is found - refresh. and so on... It might happen that input file are written to at the same time as it tries to read from it. Here follows the refresh-code for trackinfo.
I have made some extras in pMusic to overcome this issue. It now very seldom occur.
- For some reason <input>cat works better than <input file>
- Ensure to kill already running trackinfo processes and set input file to false before EVERY trackinfo start. It happens more often if clicking rapidly on tracks and open/closing the trackinfo gui
- Use <togglebox> instead of <checkbox> (I assume it should be faster)
The issue with <checkbox> is similar to the <entry> - You can't actually rely on that it refreshes EVERY time.
Code: Select all
echo false > /tmp/TestExit
echo > /tmp/test
functionA (){
while [ "$(</tmp/TestExit)" != "true" ]; do
echo true > /tmp/test
done
}
functionA &
echo '<vbox>
<timer><action>refresh:CHK</action></timer>
<checkbox><variable>CHK</variable><input file>/tmp/test</input><action>if true echo false > /tmp/test</action><action>refresh:CHK</action></checkbox>
</vbox>' | gtkdialog -s
echo true > /tmp/TestExit
Code: Select all
<timer visible="false" milliseconds="true" interval="'$UPDATE_INTERVAL_TRACKINFO'">
<variable>TRACKINFO_TIMER</variable>'
<action>refresh:UPDATE_TRACKINFO</action>
</timer>
<togglebutton visible="false">
<variable>UPDATE_TRACKINFO</variable>
<input>cat '$WORKDIR'/UPDATE_TRACKINFO</input>
<action>if true refresh:ID3_ARTIST</action>
<action>if true refresh:ID3_TITLE</action>
<action>if true refresh:ID3_ALBUM</action>
<action>if true refresh:ID3_YEAR</action>
<action>if true refresh:ID3_TRACK</action>
<action>if true refresh:ID3_GENRE</action>
<action>if true refresh:ICON_ID3_ARTIST</action>
<action>if true refresh:ICON_ID3_TITLE</action>
<action>if true refresh:ICON_ID3_ALBUM</action>
<action>if true refresh:ICON_ID3_YEAR</action>
<action>if true refresh:ICON_ID3_TRACK</action>
<action>if true refresh:TXT_ID3_INFO</action>
<action>if true refresh:EDIT_LYRICS</action>
<action>if true refresh:LYRICS_SOURCE</action>
<action>if true refresh:ALBUMART</action>
<action>if true refresh:ALBUMART_SOURCE</action>
<action>if true refresh:EDIT_ALBUM</action>
<action>if true refresh:EDIT_DISCOGRAPHY</action>
<action>if true refresh:TREE_URLS</action>
<action>if true refresh:RATING</action>
<action>if true refresh:STREAMINFO</action>
<action>if true echo false > '$WORKDIR'/UPDATE_TRACKINFO</action>
<action>if true refresh:UPDATE_TRACKINFO</action>
</togglebutton>
- For some reason <input>cat works better than <input file>
- Ensure to kill already running trackinfo processes and set input file to false before EVERY trackinfo start. It happens more often if clicking rapidly on tracks and open/closing the trackinfo gui
- Use <togglebox> instead of <checkbox> (I assume it should be faster)
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
I tried other widgets such as edit and text and the same thing happened so if the input file is being updated regularly then developers will have to accept that there could be conflicts depending on the frequency.zigbert wrote:The issue with <checkbox> is similar to the <entry> - You can't actually rely on that it refreshes EVERY time.
...
I have made some extras in pMusic to overcome this issue. It now very seldom occur.
- For some reason <input>cat works better than <input file>
...
You can duplicate this behaviour by running these two lines in separate terminals:
Code: Select all
while [ true ]; do date > /tmp/test; sleep 0.1; done
while [ true ]; do echo /tmp/test="`cat /tmp/test`"; sleep 1; done
Everybody's going to have to design around minimising conflicts because otherwise I'm going to have to offer file locking.
Anyway, it's good that you have worked around it for pMusic
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
Gtkdialog-IDEsmokey01 wrote:Thunor is there an IDE tool/interface for developing gtkdialog code similar to glade?
I really struggle sometimes although there is a lot of good advice here?
I see Barry is asking for the same tools a couple of posts back.
It would be great.
Gtkdialog apps are quite oftenly constructed using shell script so you may as well use Geany and get stuck in writing by hand from the outset. If you want to see what it looks like just run it
I have already looked at Gtkdialog-IDE and its not as intuitive as I would like.thunor wrote:Gtkdialog-IDEsmokey01 wrote:Thunor is there an IDE tool/interface for developing gtkdialog code similar to glade?
I really struggle sometimes although there is a lot of good advice here?
I see Barry is asking for the same tools a couple of posts back.
It would be great.
Gtkdialog apps are quite oftenly constructed using shell script so you may as well use Geany and get stuck in writing by hand from the outset. If you want to see what it looks like just run it
I am currently using Geary to write bash and gtkdialog but I was hoping to find something that would help me develop scripts much faster.
Thanks
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
Added a terminal widget
Widget reference: terminal widget
Example: examples/terminal/terminal
Description: A VteTerminal widget that requires libvte support be built into gtkdialog at compile time although it's not mandatory.
You're going to need to know which version of gtk+ and glib you're running on your computer so that you can download the correct version of libvte. "pkg-config --modversion gtk+-2.0" will assist you with gtk+ and for glib use "pkg-config --modversion glib-2.0". I'm using lupu 520 and I discovered that I needed vte-0.27.2 by trial and error, but I have some information that might assist you:
The last version supporting GTK_REQUIRED=2.14.0 with GLIB_REQUIRED=2.22.0 is vte-0.24.3
The last version supporting GTK_REQUIRED=2.20.0 with GLIB_REQUIRED=2.22.0 is vte-0.27.2 (suitable for lupu 520)
The last version supporting GTK_REQUIRED=2.20.0 with GLIB_REQUIRED=2.26.0 is vte-0.28.2
vte-0.29.0 and above are for gtk+3.
You can locate GTK_REQUIRED and GLIB_REQUIRED in "configure.in" within the libvte package.
Within gtkdialog's configure.in I have set the minimum version of libvte to be 0.24.3, but if you need to go back further than that then change it to the version that you've downloaded and let me know and I'll update the code. You're going to want to run "make clean && make" after editing configure.in to be certain everything is up-to-date.
Compiling and Installing libvte
It's the usual "./configure --prefix=/usr && make && make install". It'll install lots of "vte-0.0.mo" files into /usr/share/locale so you might want to be selective about those, and docs into /usr/share/gtk-doc/html/vte-0.0 which is 556kB you can purge there, or make your own pet package or get someone else to do it The Beyond Linux From Scratch page for libvte has some interesting configure options.
Widget reference: terminal widget
Example: examples/terminal/terminal
Description: A VteTerminal widget that requires libvte support be built into gtkdialog at compile time although it's not mandatory.
You're going to need to know which version of gtk+ and glib you're running on your computer so that you can download the correct version of libvte. "pkg-config --modversion gtk+-2.0" will assist you with gtk+ and for glib use "pkg-config --modversion glib-2.0". I'm using lupu 520 and I discovered that I needed vte-0.27.2 by trial and error, but I have some information that might assist you:
The last version supporting GTK_REQUIRED=2.14.0 with GLIB_REQUIRED=2.22.0 is vte-0.24.3
The last version supporting GTK_REQUIRED=2.20.0 with GLIB_REQUIRED=2.22.0 is vte-0.27.2 (suitable for lupu 520)
The last version supporting GTK_REQUIRED=2.20.0 with GLIB_REQUIRED=2.26.0 is vte-0.28.2
vte-0.29.0 and above are for gtk+3.
You can locate GTK_REQUIRED and GLIB_REQUIRED in "configure.in" within the libvte package.
Within gtkdialog's configure.in I have set the minimum version of libvte to be 0.24.3, but if you need to go back further than that then change it to the version that you've downloaded and let me know and I'll update the code. You're going to want to run "make clean && make" after editing configure.in to be certain everything is up-to-date.
Compiling and Installing libvte
It's the usual "./configure --prefix=/usr && make && make install". It'll install lots of "vte-0.0.mo" files into /usr/share/locale so you might want to be selective about those, and docs into /usr/share/gtk-doc/html/vte-0.0 which is 556kB you can purge there, or make your own pet package or get someone else to do it The Beyond Linux From Scratch page for libvte has some interesting configure options.
- Attachments
-
- terminal.png
- (8.66 KiB) Downloaded 1398 times
Last edited by thunor on Sat 25 Aug 2012, 17:33, edited 5 times in total.