Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#586 Post by technosaurus »

thunor wrote:Thanks technosaurus, added to issue tracker for a future update.

http://code.google.com/p/gtkdialog/issues/detail?id=12
thanks, I got a little burnt out tracking everything down and feel like I should consider an alternative to just cut/pasting to the original considering all the improvements made to the rest of the toolchain since the last time glade was touched - it may be straight forward enough to use shared code, but I didn't delve that far, - just enough to get the toolbar button example to 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].

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

#587 Post by zigbert »

Thunor
I have been working with great new stuff in 0.8.2, and most of it is working great. However, I have met some limitations....

I am struggling with signals in the <tree> widget.

The dream is to move items in list, and that didn't look too advanced at first, but now...
The attribute reorderable="true" works as expected, and with the support of <output file> in gtkdialog-0.8.2 everything should be fine. - But no go.
I have tried several attempts, and this is the closest I get.

In pMusic it is required to update the <input file> after moved a track in playlist (<tree>). Else, the new sort order won't be kept the next time the user adds a track to the list (refresh <input file>) . The first issue I met was that <output file> only kept data from the exported column - not the whole tree which I find more logical. I see input/output as one data-flow. Second, I couldn't get the <action>save: happen before I grab the output file for further work. (ie. to update the <input file> depending on the new sort-order in the <output file>.) The code-example shows the problem.

The first issue has a possible workaround with an extra grep-loop, while I can't see an immediate solution to the second issue.

Code: Select all

#!/bin/sh

echo -e "1\n2\n3" > /tmp/input
echo > /tmp/output

echo '
<window>
 <vbox>
  <text><label>Move items in list and check output in terminal</label></text>
  <tree reorderable="true" column-header-active="0">
   <label>A</label>
   <variable>TREE</variable>
   <input file>/tmp/input</input>
   <output file>/tmp/output</output>
   <action signal="button-release-event">echo "button-release-event get the signal first. That is why I save:TREE"</action>
   <action signal="enter-notify-event">echo "enter-notify-event gets the signal later. But output file is not updated"</action>
   <action signal="button-release-event">save:TREE</action>
   <action signal="enter-notify-event">cat /tmp/output</action>
  </tree>
  <hbox><button ok></button></hbox>
 </vbox>
</window>
' | gtkdialog -s
When talking about the <tree> widget, I want to mention the other 'weakness' that makes me sometimes use the <table> instead. The <tree> auto-resize the column-width to show all content of input file. Maybe a nice feature sometimes, but with large input data, mostly not (my opinion). But worse, - it does only auto-expand column-width, never shrink again.


Thank you for all the goodies
Sigmund
Last edited by zigbert on Sun 30 Sep 2012, 10:05, edited 1 time in total.

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#588 Post by oldyeller »

I have a couple of questions;

1) what are the names of the gtk icons that I can use for buttons?

2) How can I use the menubar widget and the text widget together?

I am planning on making a reader and than a simple word processeor and any help would be great.

Thanks

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#589 Post by smokey01 »

Is this what you are looking for?

#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Stock>
<tree rules_hint="true" exported_column="1">
<height>400</height><width>250</width>
<label>Stock ID</label>
<item stock="gtk-dialog-authentication">gtk-dialog-authentication</item>
<item stock="gtk-dialog-info">gtk-dialog-info</item>
<item stock="gtk-dialog-warning">gtk-dialog-warning</item>
<item stock="gtk-dialog-error">gtk-dialog-error</item>
<item stock="gtk-dialog-question">gtk-dialog-question</item>
<item stock="gtk-dnd">gtk-dnd</item>
<item stock="gtk-dnd-multiple">gtk-dnd-multiple</item>
<item stock="gtk-about">gtk-about</item>
<item stock="gtk-add">gtk-add</item>
<item stock="gtk-apply">gtk-apply</item>
<item stock="gtk-bold">gtk-bold</item>
<item stock="gtk-cancel">gtk-cancel</item>
<item stock="gtk-cdrom">gtk-cdrom</item>
<item stock="gtk-clear">gtk-clear</item>
<item stock="gtk-close">gtk-close</item>
<item stock="gtk-color-picker">gtk-color-picker</item>
<item stock="gtk-convert">gtk-convert</item>
<item stock="gtk-connect">gtk-connect</item>
<item stock="gtk-copy">gtk-copy</item>
<item stock="gtk-cut">gtk-cut</item>
<item stock="gtk-delete">gtk-delete</item>
<item stock="gtk-directory">gtk-directory</item>
<item stock="gtk-disconnect">gtk-disconnect</item>
<item stock="gtk-edit">gtk-edit</item>
<item stock="gtk-execute">gtk-execute</item>
<item stock="gtk-file">gtk-file</item>
<item stock="gtk-find">gtk-find</item>
<item stock="gtk-find-and-replace">gtk-find-and-replace</item>
<item stock="gtk-floppy">gtk-floppy</item>
<item stock="gtk-fullscreen">gtk-fullscreen</item>
<item stock="gtk-goto-bottom">gtk-goto-bottom</item>
<item stock="gtk-goto-first">gtk-goto-first</item>
<item stock="gtk-goto-last">gtk-goto-last</item>
<item stock="gtk-goto-top">gtk-goto-top</item>
<item stock="gtk-go-back">gtk-go-back</item>
<item stock="gtk-go-down">gtk-go-down</item>
<item stock="gtk-go-forward">gtk-go-forward</item>
<item stock="gtk-go-up">gtk-go-up</item>
<item stock="gtk-harddisk">gtk-harddisk</item>
<item stock="gtk-help">gtk-help</item>
<item stock="gtk-home">gtk-home</item>
<item stock="gtk-index">gtk-index</item>
<item stock="gtk-indent">gtk-indent</item>
<item stock="gtk-info">gtk-info</item>
<item stock="gtk-unindent">gtk-unindent</item>
<item stock="gtk-italic">gtk-italic</item>
<item stock="gtk-jump-to">gtk-jump-to</item>
<item stock="gtk-justify-center">gtk-justify-center</item>
<item stock="gtk-justify-fill">gtk-justify-fill</item>
<item stock="gtk-justify-left">gtk-justify-left</item>
<item stock="gtk-justify-right">gtk-justify-right</item>
<item stock="gtk-leave-fullscreen">gtk-leave-fullscreen</item>
<item stock="gtk-missing-image">gtk-missing-image</item>
<item stock="gtk-media-forward">gtk-media-forward</item>
<item stock="gtk-media-next">gtk-media-next</item>
<item stock="gtk-media-pause">gtk-media-pause</item>
<item stock="gtk-media-play">gtk-media-play</item>
<item stock="gtk-media-previous">gtk-media-previous</item>
<item stock="gtk-media-record">gtk-media-record</item>
<item stock="gtk-media-rewind">gtk-media-rewind</item>
<item stock="gtk-media-stop">gtk-media-stop</item>
<item stock="gtk-network">gtk-network</item>
<item stock="gtk-new">gtk-new</item>
<item stock="gtk-no">gtk-no</item>
<item stock="gtk-ok">gtk-ok</item>
<item stock="gtk-open">gtk-open</item>
<item stock="gtk-paste">gtk-paste</item>
<item stock="gtk-preferences">gtk-preferences</item>
<item stock="gtk-print">gtk-print</item>
<item stock="gtk-print-preview">gtk-print-preview</item>
<item stock="gtk-properties">gtk-properties</item>
<item stock="gtk-quit">gtk-quit</item>
<item stock="gtk-redo">gtk-redo</item>
<item stock="gtk-refresh">gtk-refresh</item>
<item stock="gtk-remove">gtk-remove</item>
<item stock="gtk-revert-to-saved">gtk-revert-to-saved</item>
<item stock="gtk-save">gtk-save</item>
<item stock="gtk-save-as">gtk-save-as</item>
<item stock="gtk-select-color">gtk-select-color</item>
<item stock="gtk-select-font">gtk-select-font</item>
<item stock="gtk-sort-ascending">gtk-sort-ascending</item>
<item stock="gtk-sort-descending">gtk-sort-descending</item>
<item stock="gtk-spell-check">gtk-spell-check</item>
<item stock="gtk-stop">gtk-stop</item>
<item stock="gtk-strikethrough">gtk-strikethrough</item>
<item stock="gtk-undelete">gtk-undelete</item>
<item stock="gtk-underline">gtk-underline</item>
<item stock="gtk-undo">gtk-undo</item>
<item stock="gtk-yes">gtk-yes</item>
<item stock="gtk-zoom-100">gtk-zoom-100</item>
<item stock="gtk-zoom-fit">gtk-zoom-fit</item>
<item stock="gtk-zoom-in">gtk-zoom-in</item>
<item stock="gtk-zoom-out">gtk-zoom-out</item>
</tree>
</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'

gtkdialog --program=MAIN_DIALOG

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#590 Post by oldyeller »

Thanks for the list smokey01

1 questioned answered. thanks again

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

#591 Post by zigbert »

Minor updates in my test-script

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#592 Post by vovchik »

@ oldyeller

Make an hbox that contains both the menubar and the text widget. I just added a few lines to Thunor's example:

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

IMAGEFILE=( $(find /usr/share/icons -maxdepth 1 -type f | head -3) )

export MAIN_DIALOG='
<window title="MenuBar" resizable="false" width-request="360" height-request="240"  border-width="0">
	<vbox spacing="0">
	<hbox>
		<menubar>
			<menu label="_Stock Images" use-underline="true">
				<menuitem stock-id="gtk-about"></menuitem>
				<menuitem stock-id="gtk-add"></menuitem>
				<menuitemseparator></menuitemseparator>
				<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
					<action>exit:Quit</action>
				</menuitem>
			</menu>
			<menu use-underline="true">
				<menuitem icon-name="abiword" label="AbiWord"></menuitem>
				<menuitem icon-name="gnumeric" label="Gnumeric 32px">
					<height>32</height>
				</menuitem>
				<menuitem icon-name="gimp" label="_Gimp 48px" use-underline="true">
					<height>48</height>
				</menuitem>
				<label>"_Theme Images"</label>
			</menu>
			<menu use-underline="true">
				<menuitem image-name="'"${IMAGEFILE[0]}"'" label="Original Size"></menuitem>
				<menuitem image-name="'"${IMAGEFILE[1]}"'">
					<label>32px</label>
					<height>32</height>
					<width>32</width>
				</menuitem>
				<menuitem image-name="'"${IMAGEFILE[2]}"'" label="48px">
					<height>48</height>
					<width>48</width>
				</menuitem>
				<label>"_File Images"</label>
			</menu>
		</menubar>
			<text>
				<label>This is static text.</label>
			</text>
	</hbox>
	</vbox>
</window>
'

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#593 Post by oldyeller »

@ vovchik,


Thanks I will check out what you did and go from there and see what I can do.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#594 Post by vovchik »

@ oldyeller

You can also put the text tag into another vbox together with the menubar:

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

IMAGEFILE=( $(find /usr/share/icons -maxdepth 1 -type f | head -3) )

export MAIN_DIALOG='
<window title="MenuBar" resizable="false" width-request="360" height-request="240"  border-width="0">
	<vbox spacing="0">
	<vbox>
		<menubar>
			<menu label="_Stock Images" use-underline="true">
				<menuitem stock-id="gtk-about"></menuitem>
				<menuitem stock-id="gtk-add"></menuitem>
				<menuitemseparator></menuitemseparator>
				<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
					<action>exit:Quit</action>
				</menuitem>
			</menu>
			<menu use-underline="true">
				<menuitem icon-name="abiword" label="AbiWord"></menuitem>
				<menuitem icon-name="gnumeric" label="Gnumeric 32px">
					<height>32</height>
				</menuitem>
				<menuitem icon-name="gimp" label="_Gimp 48px" use-underline="true">
					<height>48</height>
				</menuitem>
				<label>"_Theme Images"</label>
			</menu>
			<menu use-underline="true">
				<menuitem image-name="'"${IMAGEFILE[0]}"'" label="Original Size"></menuitem>
				<menuitem image-name="'"${IMAGEFILE[1]}"'">
					<label>32px</label>
					<height>32</height>
					<width>32</width>
				</menuitem>
				<menuitem image-name="'"${IMAGEFILE[2]}"'" label="48px">
					<height>48</height>
					<width>48</width>
				</menuitem>
				<label>"_File Images"</label>
			</menu>
		</menubar>
			<text>
				<label>This is static text.</label>
			</text>
	</vbox>
	</vbox>
</window>
'

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#595 Post by oldyeller »

@ vovchik

Thanks again for this one too, Will take a look also at this one and see what I can come up with.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#596 Post by vovchik »

@ oldyeller

This is the same stuff again, but with an edit box.

With kind regards,
vovchik

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

IMAGEFILE=( $(find /usr/share/icons -maxdepth 1 -type f | head -3) )

export MAIN_DIALOG='
<window title="MenuBar" resizable="false" width-request="360" height-request="240"  border-width="0">
	<vbox spacing="0">
	<vbox>
		<menubar>
			<menu label="_Stock Images" use-underline="true">
				<menuitem stock-id="gtk-about"></menuitem>
				<menuitem stock-id="gtk-add"></menuitem>
				<menuitemseparator></menuitemseparator>
				<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
					<action>exit:Quit</action>
				</menuitem>
			</menu>
			<menu use-underline="true">
				<menuitem icon-name="abiword" label="AbiWord"></menuitem>
				<menuitem icon-name="gnumeric" label="Gnumeric 32px">
					<height>32</height>
				</menuitem>
				<menuitem icon-name="gimp" label="_Gimp 48px" use-underline="true">
					<height>48</height>
				</menuitem>
				<label>"_Theme Images"</label>
			</menu>
			<menu use-underline="true">
				<menuitem image-name="'"${IMAGEFILE[0]}"'" label="Original Size"></menuitem>
				<menuitem image-name="'"${IMAGEFILE[1]}"'">
					<label>32px</label>
					<height>32</height>
					<width>32</width>
				</menuitem>
				<menuitem image-name="'"${IMAGEFILE[2]}"'" label="48px">
					<height>48</height>
					<width>48</width>
				</menuitem>
				<label>"_File Images"</label>
			</menu>
		</menubar>
		<edit>
			<variable>EDITOR</variable>
			<height>150</height>
			<width>350</width>
			<default>
				"This is the default text of the editor."
			</default>
		</edit>
		<hbox>
			<button cancel></button>
			<button ok></button>
		</hbox>
	</vbox>
	</vbox>
</window>
'

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#597 Post by oldyeller »

@ vovchik

Thanks again. I will no longer be posting any more on this thread but instead will be posting any quwstions on the Gtkdialog-Tips by zigbert.

This is the thread I should be using correct?

Cheers

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#598 Post by smokey01 »

Is gtkdialog 0.8.2 suppose to be backward compatible with 0.8.1?

I have a small script that works fine in 0.8.1 but not 0.8.2.

BTW I compiled it in FD64-600.

Thanks

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

#599 Post by thunor »

I'm in the process of setting-up slacko 533 to use as my main distro so Sigmund I will look into your issues once I'm settled.

oldyeller: Just create a new topic in the Programming section asking for help with whatever it is you want help with.

smokey01: Can we see the small script please?

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#600 Post by smokey01 »

#!/bin/sh

# A simple GUI to give someone a "Nudge"
# (maybe add an icon on wbar to run this)

#set work dir
APPDIR=$(pwd)
export APPDIR

someone1 () {
echo "boo" | ncat -i 1 someone1.no-ip.info 1234
}
export -f someone1

someone2 () {
echo "boo" | ncat -i 1 someone2.no-ip.info 1234
}
export -f someone2

toggle () {
# If big-ears is already running, then kill it
if pidof ncat | grep [0-9] > /dev/null
then
exec killall ncat; exec killall big-ears
else
# Start big-ears running again
$APPDIR/big-ears
# change above path to point to your psip binary file.
exit
fi
}
export -f toggle

IMAGEFILE="$APPDIR/bill.jpg"
IMAGEFILE2="$APPDIR/bob.jpg"

export script='
<window title="Nudger" icon-name="gtk-preferences" 0 0>
<vbox>
<frame Contacts:>
<hbox>
<button>
<width>48</width>
<input file>'"$IMAGEFILE"'</input>
<action>someone1</action>
</button>
<button>
<width>48</width>
<input file>'"$IMAGEFILE2"'</input>
<action>someone2</action>
</button>
</hbox>
</frame>

<frame Listening Mode:>
<vbox>
<button>
<width>48</width>
<label>On / Off</label>
<action>toggle</action>
</button>
</vbox>
</frame>

<hbox>
<button use-stock="true" label="gtk-quit"></button>
</hbox>
</vbox>
</window>'

gtkdialog -p script

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

#601 Post by thunor »

smokey01 wrote:export script='
<window title="Nudger" icon-name="gtk-preferences" 0 0>
The above produces this error in 0.8.2:

Code: Select all

** ERROR **: gtkdialog: Error in line 2, near token 'tag attribute name': syntax error
It doesn't error in 0.8.0.

The cause is the " 0 0" at the end but what's interesting is that previous versions allowed it. The error will be coming from the parser and I guess it wasn't being too thorough before, but I've recently modified the parser to allow tag attribute names to include numbers (arg0="" arg1="" etc. for the terminal widget) so that's likely the reason why it's not tolerated anymore.

Regards,
Thunor

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#602 Post by smokey01 »

It works ok in 0.8.1 too.

Thanks

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

#603 Post by zigbert »

thunor wrote:I'm in the process of setting-up slacko 533 to use as my main distro so Sigmund I will look into your issues once I'm settled.
Good news :)

User avatar
ariel
Posts: 140
Joined: Fri 03 Jul 2009, 19:47
Contact:

#604 Post by ariel »

if my memory serves me well I remember reading in the gtkdialog website that it could be possible to insert gtkdialog guis into C code. it seems that now I cannot find that reference anymore.

can anybody give me a very simple example of it?

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#605 Post by vovchik »

Dear ariel,

Here is example from thunor's sources.

WIth kind regards,
vovchik
Attachments
c_embedded.tar.gz
(2.29 KiB) Downloaded 689 times

Post Reply