Author |
Message |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Fri 17 Aug 2012, 12:48 Post subject:
|
|
Added a fontbutton widget
Widget reference: fontbutton widget
Example: examples/fontbutton/fontbutton
Description |
|
Filesize |
10.06 KB |
Viewed |
923 Time(s) |

|
Last edited by thunor on Sat 18 Aug 2012, 10:32; edited 1 time in total
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Sat 18 Aug 2012, 09:16 Post subject:
|
|
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.
Description |
|
Filesize |
7.73 KB |
Viewed |
911 Time(s) |

|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6629 Location: Valåmoen, Norway
|
Posted: Sat 18 Aug 2012, 11:10 Post subject:
|
|
Quote: | Added "activate" action function |
Wonderful!!!
This will for sure be useful.
Sigmund
_________________ Stardust resources
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6629 Location: Valåmoen, Norway
|
Posted: Sun 19 Aug 2012, 15:45 Post subject:
|
|
Is it possible to add mouse-right-click to <table> widget?
Sigmund
_________________ Stardust resources
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Mon 20 Aug 2012, 20:13 Post subject:
|
|
zigbert wrote: | Is it possible to add mouse-right-click to <table> widget?
Sigmund |
I'm guessing that you want to modify the behaviour of the widget beyond that which the gtk developers have allowed, so maybe if you state what exactly you want to happen on right-click then I could research that.
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Mon 20 Aug 2012, 20:38 Post subject:
|
|
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.
Last edited by thunor on Mon 20 Aug 2012, 21:35; edited 1 time in total
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4878 Location: Blue Springs, MO
|
Posted: Mon 20 Aug 2012, 20:58 Post subject:
|
|
zigbert wrote: | Is it possible to add mouse-right-click to <table> widget?
Sigmund | 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.
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6629 Location: Valåmoen, Norway
|
Posted: Tue 21 Aug 2012, 03:17 Post subject:
|
|
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
_________________ Stardust resources
|
Back to top
|
|
 |
BarryK
Puppy Master

Joined: 09 May 2005 Posts: 9400 Location: Perth, Western Australia
|
Posted: Tue 21 Aug 2012, 06:31 Post subject:
|
|
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/index.cgi?board=code
...hmmm, I wonder if that could be adapted as a RAD tool for gtkdialog?
_________________ https://bkhome.org/news/
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6629 Location: Valåmoen, Norway
|
Posted: Tue 21 Aug 2012, 15:34 Post subject:
|
|
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: | #!/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 |
_________________ Stardust resources
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4878 Location: Blue Springs, MO
|
Posted: Tue 21 Aug 2012, 15:46 Post subject:
|
|
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 github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Tue 21 Aug 2012, 18:06 Post subject:
|
|
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: | #!/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 |
|
That's an interesting problem.
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 Tue 21 Aug 2012, 21:08; edited 1 time in total
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 350 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Tue 21 Aug 2012, 21:04 Post subject:
|
|
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.
Code: | #!/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
|
|
Back to top
|
|
 |
smokey01

Joined: 30 Dec 2006 Posts: 2820 Location: South Australia :-(
|
Posted: Wed 22 Aug 2012, 01:45 Post subject:
|
|
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.
_________________ Software <-> Distros <-> Tips <-> Newsletters
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6629 Location: Valåmoen, Norway
|
Posted: Wed 22 Aug 2012, 09:42 Post subject:
|
|
Thunor
The issue with <checkbox> is similar to the <entry> - You can't actually rely on that it refreshes EVERY time.
Code: | 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 |
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.
Code: | <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> |
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)
_________________ Stardust resources
|
Back to top
|
|
 |
|