Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#181 Post 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

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#182 Post 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

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#183 Post 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

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#184 Post by jpeps »

thunor wrote: I'll look into it (issue 23)
Great...thanks!

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#185 Post 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
Last edited by thunor on Sat 20 Aug 2011, 10:16, edited 3 times in total.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#186 Post 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.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#187 Post 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?
Last edited by technosaurus on Wed 17 Aug 2011, 03:00, edited 1 time in total.
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].

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#188 Post 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

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#189 Post 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.

scsijon
Posts: 1596
Joined: Thu 24 May 2007, 03:59
Location: the australian mallee
Contact:

@thunor as the guru

#190 Post 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

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

manual for gtkdialog

#191 Post 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.

_________________________________________________

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

Re: @thunor as the guru

#192 Post 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

scsijon
Posts: 1596
Joined: Thu 24 May 2007, 03:59
Location: the australian mallee
Contact:

#193 Post by scsijon »

thank you

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#194 Post 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

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#195 Post 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

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#196 Post by 01micko »

...yes, we are running r220 in Slacko Beta 1,

Thanks for everything Thunor. :)
Puppy Linux Blog - contact me for access

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#197 Post 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

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#198 Post 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.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#199 Post by zigbert »

By replacing <progressbar> by <timer> in Pprocess, the pid handling become much better.


Thank you Thunor
Sigmund

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#200 Post 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

Post Reply