Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
EDDIE_THE_HEAD
Posts: 15
Joined: Mon 03 Dec 2012, 02:24
Location: Córdoba, Argentina

#676 Post by EDDIE_THE_HEAD »

technosaurus wrote:in ubuntu /bin/sh is dash, so $() does not work, try changing it to backticks or the first line to #!/bin/bash

It looks like Thunor has fixed some bashisms in latest source
Yes, I get you, but that doesn't seem to be the problem. See this code:

Code: Select all

#!/bin/bash

DIALOG='
<menubar>
  <menu>
    <menuitem>
      <label>open</label>
    </menuitem>
    <menuitem>
      <label>save</label>
    </menuitem>
    <menuitem>
      <label>quit</label>
      <action>EXIT:quit</action>
    </menuitem>
    <label>File</label>
  </menu>
</menubar>'

export DIALOG

gtkdialog -p DIALOG
There's no bashisms, no code that could cause any trouble. I could change the first line to #!/bin/sh but it wouldn't matter. I still get an empty dialog. :?

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

#677 Post by zigbert »

Any terminal output?
The problem does not seem to be related to gtkdialog.... works here (Puppy 5.3.3)
Image

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

#678 Post by smokey01 »

Works fine in Fatdog too.

User avatar
EDDIE_THE_HEAD
Posts: 15
Joined: Mon 03 Dec 2012, 02:24
Location: Córdoba, Argentina

#679 Post by EDDIE_THE_HEAD »

zigbert wrote:Any terminal output?
Nope!

My guess would be that something's wrong with either my GTK+ library or Ubuntu.

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

#680 Post by technosaurus »

Maybe, what does ldd `which gtkdialog` output?

you could also try using a puppy built gtkdialog in ubuntu
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
EDDIE_THE_HEAD
Posts: 15
Joined: Mon 03 Dec 2012, 02:24
Location: Córdoba, Argentina

#681 Post by EDDIE_THE_HEAD »

technosaurus wrote:Maybe, what does ldd `which gtkdialog` output?

you could also try using a puppy built gtkdialog in ubuntu
Here's the output:

Code: Select all

ale@Linux:/$ ldd `which gtkdialog`
	linux-gate.so.1 =>  (0xb7791000)
	libgtk-x11-2.0.so.0 => /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0 (0xb7313000)
	libgdk-x11-2.0.so.0 => /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0 (0xb7264000)
	libgio-2.0.so.0 => /usr/lib/i386-linux-gnu/libgio-2.0.so.0 (0xb710c000)
	libgdk_pixbuf-2.0.so.0 => /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0 (0xb70eb000)
	libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb709c000)
	libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6fa3000)
	libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb6fa0000)
	libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6f84000)
	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6dda000)
	libpangocairo-1.0.so.0 => /usr/lib/i386-linux-gnu/libpangocairo-1.0.so.0 (0xb6dcd000)
	libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb6c99000)
	libXfixes.so.3 => /usr/lib/i386-linux-gnu/libXfixes.so.3 (0xb6c93000)
	libatk-1.0.so.0 => /usr/lib/i386-linux-gnu/libatk-1.0.so.0 (0xb6c72000)
	libcairo.so.2 => /usr/lib/i386-linux-gnu/libcairo.so.2 (0xb6ba7000)
	libpangoft2-1.0.so.0 => /usr/lib/i386-linux-gnu/libpangoft2-1.0.so.0 (0xb6b7b000)
	libpango-1.0.so.0 => /usr/lib/i386-linux-gnu/libpango-1.0.so.0 (0xb6b31000)
	libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb6afd000)
	libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6ad0000)
	libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb6abe000)
	libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb6ab4000)
	libXinerama.so.1 => /usr/lib/i386-linux-gnu/libXinerama.so.1 (0xb6ab0000)
	libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xb6aa0000)
	libXrandr.so.2 => /usr/lib/i386-linux-gnu/libXrandr.so.2 (0xb6a96000)
	libXcursor.so.1 => /usr/lib/i386-linux-gnu/libXcursor.so.1 (0xb6a8b000)
	libXcomposite.so.1 => /usr/lib/i386-linux-gnu/libXcomposite.so.1 (0xb6a87000)
	libXdamage.so.1 => /usr/lib/i386-linux-gnu/libXdamage.so.1 (0xb6a83000)
	libgmodule-2.0.so.0 => /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0 (0xb6a7e000)
	libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6a67000)
	libselinux.so.1 => /lib/i386-linux-gnu/libselinux.so.1 (0xb6a48000)
	libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xb6a30000)
	libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb6a29000)
	libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb69ed000)
	librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb69e3000)
	/lib/ld-linux.so.2 (0xb7792000)
	libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb6949000)
	libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb6928000)
	libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6923000)
	libpixman-1.so.0 => /usr/lib/i386-linux-gnu/libpixman-1.so.0 (0xb688b000)
	libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb6860000)
	libxcb-shm.so.0 => /usr/lib/i386-linux-gnu/libxcb-shm.so.0 (0xb685c000)
	libxcb-render.so.0 => /usr/lib/i386-linux-gnu/libxcb-render.so.0 (0xb6852000)
	libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb6828000)
	libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb6823000)
	libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb681c000)

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

#682 Post by technosaurus »

libgtk-x11-2.0.so.0 => /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
yeah, ubuntu does some serious mysterious stuff, that should have a version number suffix, so it is possible that the libraries and the include headers don't match because the .so file is linked to a different (still installed) versioned library. fast way to tell would be to use a puppy compiled version, probably from lupu
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
rerwin
Posts: 2017
Joined: Wed 24 Aug 2005, 22:50
Location: Maine, USA

Unexpected output value from gtkdialog3/4

#683 Post by rerwin »

thunor,
I am working with code that expects gtkdialog to output only valid commands, particularly assignment statements. It uses 'eval' to set the variables locally. However, the first value in the list of assignment statements is "OK", which gets rejected as an invalid command.

I cannot find the explanation of what to expect as output, so do not know whether the "OK" is intended by the developers of gtkdialog. If it is legitimate, what is the recommended way to process the output from gtkdialog to retrieve the variables set by gtkdialog?

Code: Select all

+ eval OK 'AUTODHCP="true"' 'CURIP=""' 'CURSTAT="Not' Connected. '"' 'DNS1=""' 'DNS1LAB="DNS' Server '1"' 'DNS2=""' 'DNS2LAB="DNS' Server '2"' 'ENWIRE="true"' 'GATEWAY=""' 'GATEWAYLAB="Gateway"' 'IF=""' 'IGNORE="false"' 'IP=""' 'IPLAB="Static' IP 'Address"' 'SUBNET=""' 'SUBNETLAB="Subnet' 'Mask"' 'TABLE=""' 'EXIT="Exit-NOW"'
++ OK AUTODHCP=true CURIP= 'CURSTAT=Not Connected. ' DNS1= 'DNS1LAB=DNS Server 1' DNS2= 'DNS2LAB=DNS Server 2' ENWIRE=true GATEWAY= GATEWAYLAB=Gateway IF= IGNORE=false IP= 'IPLAB=Static IP Address' SUBNET= 'SUBNETLAB=Subnet Mask' TABLE= EXIT=Exit-NOW
/usr/local/bin/Frisbee: line 610: OK: command not found
+ [[ '' == \R\E\S\T\A\R\T ]]
The code for this trace is:

Code: Select all

RETVALS=`gtkdialog3 --program=MAIN_DIALOG --center`

eval $RETVALS
if [[ "$EXIT" == "RESTART" ]] ; then 
As a test, I coded:

Code: Select all

RETVALS=`gtkdialog3 --program=MAIN_DIALOG --center | grep =`
which solves the problem. But I have not noticed any other gtkdialog result processing that does that.

I assume the the "OK" is only a confirmation that the invocation did not fail, but a failure would probably output a message to stderr. Or would it?
Richard

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

#684 Post by thunor »

EDDIE_THE_HEAD wrote:Thunor, me again :roll:

So far the only widgets that have given me trouble are the menu, menubar and menuitems. My gtkdialog seems to be ignoring them completely. No matter how I define them, they won't appear in my dialogs.
...
Recently I had to stop using a gtk function that shows all of the widgets from the window down because it was causing strange artifacts, and I replaced it by micro-managing the showing and hiding individually and I've got a feeling that it's related to that.

It could be as simple as the widgets aren't being shown and I'm looking into it now -- I may have missed something.

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

#685 Post by thunor »

@EDDIE_THE_HEAD

I'm looking at the code and I haven't seen anything obvious yet but I'm going to dump messages as the widgets are shown so I can see if anything is missing.

You could try this, a modified version of your example:

Code: Select all

DIALOG='
<menubar>
  <menu>
    <menuitem>
      <label>open</label>
      <action signal="show">echo showing open</action>
      <action signal="realize">echo realizing open</action>
    </menuitem>
    <menuitem>
      <label>save</label>
      <action signal="show">echo showing save</action>
      <action signal="realize">echo realizing save</action>
    </menuitem>
    <menuitem>
      <label>quit</label>
      <action signal="show">echo showing quit</action>
      <action signal="realize">echo realizing quit</action>
      <action>EXIT:quit</action>
    </menuitem>
    <label>File</label>
    <action signal="show">echo showing File</action>
    <action signal="realize">echo realizing File</action>
  </menu>
  <action signal="show">echo showing menubar</action>
  <action signal="realize">echo realizing menubar</action>
</menubar>'

export DIALOG

gtkdialog -p DIALOG
If you run it, click File and then select quit you should get this in the terminal:

Code: Select all

# ./_dev/EDDIE_THE_HEAD-menu-issue 
showing open
showing save
showing quit
showing File
showing menubar
realizing menubar
realizing File
realizing open
realizing save
realizing quit
EXIT="quit"
#
Also, what happens when you wrap everything with a window widget, or a vbox and a window widget? Is the behaviour the same?

Cheers.
Last edited by thunor on Thu 06 Dec 2012, 22:32, edited 3 times in total.

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

#686 Post by thunor »

While I'm here, I committed something interesting today (r488), a new break action function that you can use to break out of a list of actions in combination with the recently added condition attribute. There's an example in examples/miscellaneous/break.

I got the idea from the fact that launching another dialog never returns to the list of actions that it was launched from.

You could have an action with a condition that tests something and if true would execute the break and terminate the processing of further actions, otherwise the actions underneath would be executed.

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

#687 Post by thunor »

Hi again EDDIE_THE_HEAD

I believe that I've found the problem and I've likely fixed it in r489. Are you compiling this yourself from SVN or from a source package?

I'll just explain the SVN route so you can try it for me/us/everyone :)

Open a terminal somewhere and type:

Code: Select all

svn checkout http://gtkdialog.googlecode.com/svn/trunk/ gtkdialog
cd gtkdialog
./autogen.sh
make
If you want to install to /usr/bin instead of /usr/local/bin you can pass --prefix=/usr to autogen.sh like you normally would to configure.

The compiled gtkdialog binary will be in the src subdirectory or you can sudo make install.

Let me know if the issue is resolved please.

Like I said earlier, I micro-manage showing widgets individually so I add them to a list. Most of this is automated but there are places where additional widgets are required and I found that the GtkMenuShell (the pop-up rectangle that contains the menuitems) wasn't being added to the show list so I have assumed that that is the cause. Obviously it was fine on Puppy and it doesn't make sense why the menubar isn't visible for you on Ubuntu, but we'll see how it goes. The menubar is definitely in the show list and so is the "File" part of the menu so it's all a bit strange.

Many thanks,
Thunor

User avatar
EDDIE_THE_HEAD
Posts: 15
Joined: Mon 03 Dec 2012, 02:24
Location: Córdoba, Argentina

#688 Post by EDDIE_THE_HEAD »

thunor wrote:@EDDIE_THE_HEAD
Thanks a lot for working on this.

I've run the code you provided:

Code: Select all

DIALOG='
<menubar>
  <menu>
    <menuitem>
      <label>open</label>
      <action signal="show">echo showing open</action>
      <action signal="realize">echo realizing open</action>
    </menuitem>
    <menuitem>
      <label>save</label>
      <action signal="show">echo showing save</action>
      <action signal="realize">echo realizing save</action>
    </menuitem>
    <menuitem>
      <label>quit</label>
      <action signal="show">echo showing quit</action>
      <action signal="realize">echo realizing quit</action>
      <action>EXIT:quit</action>
    </menuitem>
    <label>File</label>
    <action signal="show">echo showing File</action>
    <action signal="realize">echo realizing File</action>
  </menu>
  <action signal="show">echo showing menubar</action>
  <action signal="realize">echo realizing menubar</action>
</menubar>'

export DIALOG

gtkdialog -p DIALOG

But the output is the following:

Code: Select all

# ./_dev/EDDIE_THE_HEAD-menu-issue 
ale@Linux:~/scripts$ ./menu
showing open
showing save
showing quit
showing File
showing menubar
realizing menubar
realizing File
showing menubar
EXIT="abort"    
#
And I get an empty dialog :? (obviously aborting is the only way I have to exit the window).

After this I compiled r489 and tried again...but still nothing.
thunor wrote:Let me know if the issue is resolved please.
Unfortunately no. But as you said, it is pretty weird as it happens (apparently) only in Ubuntu.

Is there any other Ubuntu user around here who can verify this?

User avatar
EDDIE_THE_HEAD
Posts: 15
Joined: Mon 03 Dec 2012, 02:24
Location: Córdoba, Argentina

#689 Post by EDDIE_THE_HEAD »

thunor wrote: Also, what happens when you wrap everything with a window widget, or a vbox and a window widget? Is the behaviour the same?

Cheers.
I had forgotten about this. Yes, I've tried wrapping the menubar with every container widget. Same results :(

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

#690 Post by thunor »

EDDIE_THE_HEAD wrote:...

Code: Select all

...
showing open
showing save
showing quit
showing File
showing menubar
realizing menubar
realizing File
showing menubar
EXIT="abort"
#
And I get an empty dialog :? (obviously aborting is the only way I have to exit the window).

After this I compiled r489 and tried again...but still nothing.
...
Yeah sorry, you can't click "File" :P Doh! Here's what I get closing via the window manager:

Code: Select all

showing open
showing save
showing quit
showing File
showing menubar
realizing menubar
realizing File
EXIT="abort"
#
So, you've got an extra "showing menubar" which is very strange. Also if a widget is shown and realized then you should be looking at it.

What you could do next is download the gtkdialog-0.8.2 source package and try that. It uses the old gtk_widget_show_all() method to show the widgets.
EDDIE_THE_HEAD wrote:Is there any other Ubuntu user around here who can verify this?
I know somebody who's using it -- frafa/François - http://liveusb.info/dotclear/ -- I'll email him.

[EDIT] I'll email frafa/François after you've tested gtkdialog-0.8.2 if you don't mind. I need to know if gtk_widget_show_all() works.

Regards,
Thunor
Last edited by thunor on Fri 07 Dec 2012, 16:06, edited 1 time in total.

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

Re: Unexpected output value from gtkdialog3/4

#691 Post by thunor »

rerwin wrote:...
The code for this trace is:

Code: Select all

RETVALS=`gtkdialog3 --program=MAIN_DIALOG --center`

eval $RETVALS
if [[ "$EXIT" == "RESTART" ]] ; then 
As a test, I coded:

Code: Select all

RETVALS=`gtkdialog3 --program=MAIN_DIALOG --center | grep =`
which solves the problem. But I have not noticed any other gtkdialog result processing that does that.

I assume the the "OK" is only a confirmation that the invocation did not fail, but a failure would probably output a message to stderr. Or would it?
Richard
The problem is with using RETVALS=`gtkdialog` is that you're going to catch everything sent to stdout including whatever programs you are running from within your gtkdialog application. Where does that "OK" come from? Something that your application is executing is responsible for that.

I'll tell you how it works: every widget that has a <variable> directive will be printed to stdout on application exit unless you use <variable export="false">. So do you actually want to evaluate everything or is there something in particular?

" | grep =" is going to remove lines such as "OK" which is good.

Do people actually use this method of capturing all of stdout? I don't think it's very common.

See this Frisbee post because I mentioned this before and I saw that peebee had changed the code.

If all you want to evaluate is EXIT then what's wrong with:

Code: Select all

eval `gtkdialog3 --program=MAIN_DIALOG --center | grep ^EXIT=`
Regards.

User avatar
EDDIE_THE_HEAD
Posts: 15
Joined: Mon 03 Dec 2012, 02:24
Location: Córdoba, Argentina

#692 Post by EDDIE_THE_HEAD »

thunor wrote: What you could do next is download the gtkdialog-0.8.2 source package and try that.
Well, I'm afraid I was originally running the tests on gtkdialog 0.8.2. Anyway, I'll keep you posted, see if anything comes to mind.


Cheers!! :wink:

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

#693 Post by thunor »

EDDIE_THE_HEAD wrote:...
Well, I'm afraid I was originally running the tests on gtkdialog 0.8.2. Anyway, I'll keep you posted, see if anything comes to mind.
...
Ah, so that's 0.8.2 and 0.8.3 which both use different methods to show the widgets and you still can't see the menubar; that's not good :?

I'll email this other chap and see what he's using.

Can you please supply me with your version of Ubuntu and the output from these:

Code: Select all

pkg-config --modversion gtk+-2.0
pkg-config --modversion glib-2.0
Many thanks,
Thunor

User avatar
EDDIE_THE_HEAD
Posts: 15
Joined: Mon 03 Dec 2012, 02:24
Location: Córdoba, Argentina

#694 Post by EDDIE_THE_HEAD »

thunor wrote: Can you please supply me with your version of Ubuntu and the output from these:

Code: Select all

pkg-config --modversion gtk+-2.0
pkg-config --modversion glib-2.0

Code: Select all

ale@Linux:~$ pkg-config --modversion gtk+-2.0
2.24.10
ale@Linux:~$ pkg-config --modversion glib-2.0
2.32.3
I am using Ubuntu 12.04 LTS

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

#695 Post by thunor »

@EDDIE_THE_HEAD

Thanks for that.

Today I worked on the files within examples/miscellaneous and tested them with my /bin/sh linking to /bin/dash. I found a problem with the operation of the progressbar in the show_and_hide example with nonsensical gdk error messages, a non-showing window and I even had an empty window. All of these problems disappear when my /bin/sh links to /bin/bash, so I'm going to recommend that you try symlinking your /bin/sh to /bin/bash and then try your menu example again. Don't forget to symlink /bin/sh back to dash once you've finished. Im just throwing in suggestions -- maybe it'll help isolate the problem.

Regards,
Thunor

Post Reply