Page 10 of 42

Posted: Fri 12 Aug 2011, 12:15
by Geoffrey
thunor wrote:
Geoffrey wrote:

Code: Select all

...
/root/gtkdialog/src/widget_timer.c:379: undefined reference to `gtk_widget_get_sensitive'
...
Hi Geoffrey

Sorry about that. gtk_widget_get_sensitive requires GTK+ 2.18.0 and I missed it, but thanks for letting me know as there is an older alternative which I've included and committed :)

Interestingly its sister function gtk_widget_set_sensitive already exists within the project and has no version requirements.

Regards,
Thunor
Thanks it now works

Geoffrey

Posted: Fri 12 Aug 2011, 15:42
by jpeps
Hi thunor,

Is there no way to add a filter to gtk-open "fileselect" for specific filetypes?
This would really be a huge plus gtkdialog3. Thanks

Posted: Fri 12 Aug 2011, 22:29
by thunor
jpeps wrote:Is there no way to add a filter to gtk-open "fileselect" for specific filetypes?
Hi jpeps

I'll look into it (issue 23)

Regards,
Thunor

Posted: Fri 12 Aug 2011, 23:44
by jpeps
thunor wrote: I'll look into it (issue 23)
Great...thanks!

Posted: Tue 16 Aug 2011, 15:46
by thunor
Overhauled the notebook widget

The widget reference is available here.
  • The page number is now stored within the variable and can be refreshed from a command or a file.
  • Tab labels can be specified with the "tab-labels" custom tag attribute.
  • Tab labels can be generated automatically by using either or both of the "tab-prefix" and "tab-suffix" custom tag attributes.
  • Tab labels will be generated automatically using "Page n" in the absence of any of the above custom tag attributes.
  • The "tab-base-index" custom tag attribute can be used to control the start page number used within the auto-generated labels.
This widget does not accept setting a default page before being shown (there's a note about it here) which will result in <input> and <input file> data being discarded at start-up. This issue can be overcome by using the "page" tag attribute which will be applied after the widget is shown.

<notebook> widget example:

Code: Select all

#!/bin/sh

# NOTE: This example requires at least gtkdialog-0.7.21 (please visit
# http://code.google.com/p/gtkdialog/). Additionally if you are using
# Puppy Linux then you may find that an historical version of gtkdialog
# already exists in /usr/sbin, and if that is the case then you should
# modify the shell variable below to point to the new gtkdialog binary.

GTKDIALOG=gtkdialog

funcnbkCreate() {
	for f in 0 1 2 3 4; do
		echo '<vbox border-width="20">
				<hbox border-width="70">
					<text label="This is page '$f'"></text>
				</hbox>'
		if [ $1 -lt 2 ]; then echo '<hbox homogeneous="true">'; fi
		if [ $1 -eq 0 ]; then
			echo '<button use-stock="true" label="gtk-go-back">'
			if [ $f -eq 0 ]; then
				echo '<sensitive>false</sensitive>'
			else
				echo '<action>echo '$(($f - 1))' > inputfile</action>
					<action>refresh:nbk'$1'</action>'
			fi
			echo '</button>
				<button use-stock="true" label="gtk-go-forward">'
			if [ $f -eq 4 ]; then
				echo '<sensitive>false</sensitive>'
			else
				echo '<action>echo '$(($f + 1))' > inputfile</action>
					<action>refresh:nbk'$1'</action>'
			fi
		elif [ $1 -eq 1 ]; then
			echo '<button use-stock="true" label="gtk-refresh">
					<action>refresh:nbk'$1'</action>'
		fi
		if [ $1 -lt 2 ]; then
			echo '</button>
				</hbox>'
		fi
		echo '</vbox>'
	done
	echo '<variable>nbk'$1'</variable>'
	if [ $1 -eq 0 -o $1 -eq 2 ]; then
		echo '<input file>inputfile</input>'
	elif [ $1 -eq 1 ]; then
		echo '<input>echo $(($RANDOM % 4))</input>'
	elif [ $1 -eq 3 ]; then
		echo '<input>"if [ $(<inputfile) -eq 4 ]; then echo 0 > inputfile
			else echo $(($(<inputfile) + 1)) > inputfile; fi
			echo $(<inputfile)"</input>'
	fi
}

funcnbkMainCreate() {
	for f in 0 1 2 3; do
		echo '<vbox>
				<vbox homogeneous="true" height-request="300">
					<hbox homogeneous="true" width-request="500">'
		if [ $f -eq 0 ]; then
			echo '<notebook>
					'"$(funcnbkCreate $f)"'
				</notebook>'
		elif [ $f -eq 1 ]; then
			echo '<notebook tab-labels="One|Two|Three|Four|Five"
					page="04" tab-vborder="12" tab-pos="0">
					'"$(funcnbkCreate $f)"'
				</notebook>'
		elif [ $f -eq 2 ]; then
			echo '<vbox>
					<hscale range-min="0" range-max="4" value-pos="0">
						<variable>hsc0</variable>
						<action>save:hsc0</action>
						<action>refresh:nbk'$f'</action>
						<output file>inputfile</output>
					</hscale>
					<notebook show-tabs="false">
						'"$(funcnbkCreate $f)"'
					</notebook>
				</vbox>'
		elif [ $f -eq 3 ]; then
			echo '<vbox>
					<timer visible="false">
						<action>refresh:nbk'$f'</action>
					</timer>
					<notebook show-tabs="false" show-border="false">
						'"$(funcnbkCreate $f)"'
					</notebook>
				</vbox>'
		fi
		echo '</hbox>
			</vbox>
			<hseparator></hseparator>
			<hbox>
				<button use-stock="true" label="gtk-go-back">'
		if [ $f -eq 0 ]; then
			echo '<sensitive>false</sensitive>
					<action>""</action>'
		else
			echo '<action>echo '$(($f - 1))' > inputfile</action>
					<action>refresh:nbkMain</action>'
		fi
		echo '</button>
				<button use-stock="true" label="gtk-go-forward">'
		if [ $f -eq 3 ]; then
			echo '<sensitive>false</sensitive>
					<action>""</action>'
		else
			echo '<action>echo '$(($f + 1))' > inputfile</action>
					<action>refresh:nbkMain</action>'
		fi
		echo '</button>
				<button ok></button>
			</hbox>
		</vbox>'
	done
}

echo 0 > inputfile

export MAIN_DIALOG='
<window title="nbkNotebook" resizable="false">
	<vbox>
		<notebook show-tabs="false" show-border="false">
			'"$(funcnbkMainCreate)"'
			<variable>nbkMain</variable>
			<input file>inputfile</input>
		</notebook>
    </vbox>
	<action signal="hide">exit:Exit</action>
</window>
'
# Uncomment the following line to dump MAIN_DIALOG to a file:
# ifs=$IFS; IFS=; echo $MAIN_DIALOG > nbkNotebook.txt; IFS=$ifs

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor

Posted: Tue 16 Aug 2011, 22:26
by 8-bit
I am now confused. Where in the notebook_widget_example is the compressed data stored?
And what procedure is used to compress and store it?

I ask because I know I copied the example and made it executable and did not see where and how that extra MAIN_DIALOG data was stored or how it was created.

If the methodology is known, it could help in making gtkdialog applications for puppy smaller.

Posted: Tue 16 Aug 2011, 23:44
by technosaurus
thunor wrote:
jpeps wrote:Is there no way to add a filter to gtk-open "fileselect" for specific filetypes?
Hi jpeps

I'll look into it (issue 23)

Regards,
Thunor
http://developer.gnome.org/gtk/2.24/Gtk ... set-filter

Edited for clarity:
The filters have been in gtk since 2.4 ... gtkdialog development all but stopped right around then

Should that be an extra tag or just a value such as filter="*.mp3" within the fselect tag?

Posted: Wed 17 Aug 2011, 00:45
by seaside
I remember trying

Code: Select all

<action type="fileselect" filter="*.sfs">FILE_FILENAME</action>
and it didn't work

Maybe another way?

Cheers,
s

Posted: Wed 17 Aug 2011, 02:12
by jpeps
technosaurus wrote:
thunor wrote:
jpeps wrote:Is there no way to add a filter to gtk-open "fileselect" for specific filetypes?

Would that be an extra tag or just a value such as filter="*.mp3" within the fselect tag?
I'd be content with anything that works. I tried workarounds like comboboxes that load files from a script....but the list has to be set before gtkdialog runs.

@thunor as the guru

Posted: Thu 18 Aug 2011, 05:27
by scsijon
Greetings, have you come across a decently explained Tutorial/Learning Manual for an old-fella to get his head around this gtkdialog stuff anywhere?

Apologies to others if i'm considered offtopic, but when you have a guru, you should use them!

regards with thanks

scsijon

manual for gtkdialog

Posted: Thu 18 Aug 2011, 20:57
by don570
The best written manual is ironically in French
http://www.murga-linux.com/puppy/viewto ... 12062179c4

I discovered by trying some of it's examples that
it had some dumb errors though.

If I have the time I should try to translate it in English.
I'm currently writing a replacement for the
gmeasures application

For people speaking English the best way is to download
the page by technosaurus
http://www.murga-linux.com/puppy/viewtopic.php?t=45474

and practice the examples.

_________________________________________________

Re: @thunor as the guru

Posted: Thu 18 Aug 2011, 21:32
by thunor
scsijon wrote:Greetings, have you come across a decently explained Tutorial/Learning Manual for an old-fella to get his head around this gtkdialog stuff anywhere?
Hi scsijon

You can try this tutorial -> http://pclosmag.com/html/Issues/200910/page21.html

Also take a look at the first page of the Gtkdialog Tips thread -> http://www.murga-linux.com/puppy/viewtopic.php?t=38608

Gtkdialog also comes with plenty of example programs if you download the source code, or browse them here -> http://code.google.com/p/gtkdialog/sour ... 2Fexamples

That's plenty for you to play with :)

Regards,
Thunor

Posted: Fri 19 Aug 2011, 00:37
by scsijon
thank you

Posted: Fri 19 Aug 2011, 13:00
by thunor
I've refactored (code reorganisation) the button widget and fixed an issue that's annoyed me for some time: "use-underline" not working with buttons created from a <label> plus <input file stock/icon="image">.

This will now work as expected:

Code: Select all

<button use-underline="true">
	<label>"_Close"</label>
	<input file stock="gtk-close"></input>
</button>
Everything else was fine; I just wanted to fix that.

Regards,
Thunor

Posted: Fri 19 Aug 2011, 16:15
by zigbert
Thunor
An error has slipped into the gtkdialog code. The launch signal crashes the gui if there exist a menu. Remove the menu, and everything works as expected.
This makes apps like pTiming in Puppy Slacko useless.
I have made a test script:

Code: Select all

#!/bin/sh

export DIALOG='
<variable>DIALOG</variable>
<vbox>
 <text><label>Another dialog.</label></text>
</vbox>'

export MAIN_DIALOG='
<vbox>
 <menubar>
  <menu>
   <menuitem><label>item1</label></menuitem>
   <menuitem><label>item2</label></menuitem>
   <label>menu</label>
  </menu>
 </menubar>
 <hbox>
  <button>
   <label>"
	Launch another dialog.
	This does not work if menu widget is used.
	"</label>
   <action type="launch">DIALOG</action>
  </button>
 </hbox>
</vbox>'

gtkdialog -p MAIN_DIALOG

thunor wrote:issue 22 (Togglebutton Widget) Status changed by thunor...@hotmail.com - Status: Started
:D :D :D


Sigmund

Posted: Fri 19 Aug 2011, 20:40
by 01micko
...yes, we are running r220 in Slacko Beta 1,

Thanks for everything Thunor. :)

Posted: Fri 19 Aug 2011, 21:41
by thunor
Hi guys

Sorry about that: I needed to set the accel_group pointer to NULL after freeing it.

Fixed in r224.

Thanks Sigmund for the helpful example and yes, <togglebutton> is almost finished (actually you can create one in r224 but that's it so far) :)

Regards,
Thunor

Posted: Sat 20 Aug 2011, 19:46
by Dougal
taca0 wrote:Maybe this its not the best place to ask , But I want to know how I make that all the windows that I open fits on my 640x480 resolution??
What you could try is to go to /usr/bin (/usr/sbin?) and find the gtkdialog binary, rename it gtkdialog.bin, then right-click in the Rox window and select New->Script and create a script named gtkdialog.
Open the script and add to it:

Code: Select all

exec gtkdialog.bin "$*" --geometry=640x480
and see if it helps... I think Thunor fixed it to show scrollbars.

Posted: Sun 21 Aug 2011, 07:51
by zigbert
By replacing <progressbar> by <timer> in Pprocess, the pid handling become much better.


Thank you Thunor
Sigmund

Posted: Sun 21 Aug 2011, 08:14
by zigbert
Thunor
There is a misbehavior in the menu widget. I think (really sure) that this has arrived with 0.7.21.

The example should explain it all:

Code: Select all

#!/bin/sh

export MAIN_DIALOG='
<vbox>
  <menubar>
    <menu>
      <menuitem stock="gtk-new"></menuitem>
      <menuitem icon="gtk-new">
        <label>New - No icon if label is set manually, not from gtk-stock</label>
      </menuitem>
      <menuitem stock="gtk-open"></menuitem>
      <menuitem icon="gtk-open">
        <label>Open - YES, Icon if label is set manually, not from gtk-stock</label>
      </menuitem>
      <label>File</label>
    </menu>
  </menubar>
  <hbox>
    <button cancel></button>
    <button ok></button>
  </hbox>
</vbox>
'

gtkdialog -p MAIN_DIALOG
This happens for icon="gtk-save" and gtk-info as well. I have not checked all, but many works as expected.

A sidenote: The menubar example still uses <seperator> instead of <menuitemseperator>


Sigmund