Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#631 Post by peebee »

thunor wrote:Hi rerwin
Gtkdialog can exit in two ways and one of those used to be dodgy but there was a workaround which was commonly used and it is this:

Code: Select all

...
	<action signal="hide">exit:EXIT-WM</action>
</window>
Thunor
Hi Thunor

I am trying to test this for rerwin as I've got the right hardware setup (but not the developer skills)........

Grateful if you could confirm:

1. is the patch you've given a REPLACEMENT for the existing exit statement (<action type="exit">Exit-NOW</action>) or an ADDITIONAL statement immediately before </window>?

2. is the case of exit: significant - the later test in the script tests $EXIT

3. the patch given gives a syntax error - I'm guessing it should be:
<action signal="hide">exit:EXIT-WM</action> ??

I've tried both the replacement approach (this just makes the script exit early without functioning) and the additional line approach (doesn't seem to have any effect).....

I have determined that the exit button is not the one described above by rerwin but the earlier one in the same main-dialog script.

Cheers
peebee
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

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

#632 Post by thunor »

Hi peebee

1. Additional
2. No
3. Yes

Open Frisbee in Geany. At line 607 is this:

Code: Select all

echo "$$ $0 Executing gtldialog3 MAIN_DIALOG" >> /tmp/udevtrace-modem.log  #DEBUG
RETVALS=`gtkdialog3 --program=MAIN_DIALOG --center`
echo "$$ $0 Resumed after gtldialog3 MAIN_DIALOG" >> /tmp/udevtrace-modem.log  #DEBUG
Apparently `gtkdialog3 --program=MAIN_DIALOG --center` is not exiting i.e. you have to press CTRL+C to get the process to exit, so let's see if we can force it to exit.

There are </window> end tags at lines 260, 331 and 604 -- change them all to:

Code: Select all

   <action signal=\"hide\">exit:FORCED-EXIT</action>
</window>
Run it in the terminal like you have been doing. Does it now exit properly or do you still have to press CTRL+C to get it to return to the script?

Regards,
Thunor

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#633 Post by peebee »

thunor wrote:

Code: Select all

   <action signal="hide">exit:FORCED-EXIT</action>
</window>
Run it in the terminal like you have been doing. Does it now exit properly or do you still have to press CTRL+C to get it to return to the script?

Regards,
Thunor
Hi Thunor

3 extra lines added as suggested - run in terminal - still fails to return when exit button is pressed having entered the wpa key and achieved a wifi connection.....

Thanks for your help - should we take it to PM to avoid cluttering up your thread?

Cheers
peebee
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

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

#634 Post by thunor »

No PM, here is fine.

I took the plunge and ran the script on Slacko 5.3.3 even though it looks like I'm missing everything it's expecting to find :D I just wanted to test the buttons and anything else that might be going on in there.

Before we go any further can you add this line:

Code: Select all

echo GTKDIALOG EXITED
at line 609 so that the code in that part of the file looks like this:

Code: Select all

echo "$$ $0 Executing gtldialog3 MAIN_DIALOG" >> /tmp/udevtrace-modem.log  #DEBUG
RETVALS=`gtkdialog3 --program=MAIN_DIALOG --center`
echo GTKDIALOG EXITED
echo "$$ $0 Resumed after gtldialog3 MAIN_DIALOG" >> /tmp/udevtrace-modem.log  #DEBUG
Now, if you run Frisbee in the terminal, do you see " GTKDIALOG EXITED" after you've pressed Frisbee's exit button? What exactly are you seeing in the terminal? If you press Enter in there, what happens? Have you got a prompt? Can you run commands in there like ls?

Also, what is the full path of the Frisbee source that you are editing in Geany?

There is something wierd there, in the original unmodified Frisbee source at lines 280 and 418:

Code: Select all

<input>for i in \$(seq 0 1 10000); do if ((i\%2==1)) ; then echo 100 ; else echo 99; fi; sleep 15; done </input>
They are part of progressbars that are being used to auto-refresh widgets and run programs except that they remain running in the background and the more you use Frisbee the more of them remain running (you can see them accumulating in htop).

You could try simply deleting the lines, try Frisbee, then put the lines back.

Regards,
Thunor

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#635 Post by peebee »

thunor wrote:No PM, here is fine.

I took the plunge and ran the script on Slacko 5.3.3 even though it looks like I'm missing everything it's expecting to find :D I just wanted to test the buttons and anything else that might be going on in there.

Before we go any further can you add this line:

Code: Select all

echo GTKDIALOG EXITED
at line 609 so that the code in that part of the file looks like this:

Code: Select all

echo "$$ $0 Executing gtldialog3 MAIN_DIALOG" >> /tmp/udevtrace-modem.log  #DEBUG
RETVALS=`gtkdialog3 --program=MAIN_DIALOG --center`
echo GTKDIALOG EXITED
echo "$$ $0 Resumed after gtldialog3 MAIN_DIALOG" >> /tmp/udevtrace-modem.log  #DEBUG
Now, if you run Frisbee in the terminal, do you see " GTKDIALOG EXITED" after you've pressed Frisbee's exit button? What exactly are you seeing in the terminal? If you press Enter in there, what happens? Have you got a prompt? Can you run commands in there like ls?

Also, what is the full path of the Frisbee source that you are editing in Geany?

There is something wierd there, in the original unmodified Frisbee source at lines 280 and 418:

Code: Select all

<input>for i in \$(seq 0 1 10000); do if ((i\%2==1)) ; then echo 100 ; else echo 99; fi; sleep 15; done </input>
They are part of progressbars that are being used to auto-refresh widgets and run programs except that they remain running in the background and the more you use Frisbee the more of them remain running (you can see them accumulating in htop).

You could try simply deleting the lines, try Frisbee, then put the lines back.

Regards,
Thunor
Hi Thunor

Tried deleting the strange lines - that stopped wifi signals being detected - tried altering the parameters instead - it worked fine with the count set down to 100 and the delay set to 5.

Those lines are in the current working V2 Frisbee BTW.

the full path is /usr/local/bin/Frisbee - as given by which Frisbee

the echo you have suggested is the same as the debug echo put in by rerwin - the echo does not appear in the /tmp file - nothing appears from your terminal echo either.

In the terminal I see nothing except a red underline cursor until I press cntrl-c when the prompt reappears....anything I type is echoed but no commands are recognised until I get the # prompt back with cntrl-c.

Thanks again
peebee
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

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

#636 Post by thunor »

peebee wrote:Tried deleting the strange lines - that stopped wifi signals being detected - tried altering the parameters instead - it worked fine with the count set down to 100 and the delay set to 5.
Yeah, but I only wanted to know if deleting the lines stops gtkdialog3 from not exiting because these lines are processes being started by gtkdialog in another thread and they're being left running because there's no exit condition in the code.

1. Delete the lines in Geany
2. Open a terminal and type Frisbee
3. Click the "Configure Network Interfaces" tab
4. Click the Exit button
5. Type ls in the terminal and press Enter
6. Do you get a directory listing or does the cursor simply go to the next line?
peebee wrote:Those lines are in the current working V2 Frisbee BTW.
Then everyone who uses Frisbee will accumulate processes dumping " sh: line 0: echo: write error: Broken pipe" to stdout every 15s.
peebee wrote:the echo you have suggested is the same as the debug echo put in by rerwin - the echo does not appear in the /tmp file - nothing appears from your terminal echo either.
No it's not the same. rerwin's messages go to /tmp/udevtrace-modem.log, mine goes to stdout i.e. the same terminal window that you are running frisbee in.
peebee wrote:In the terminal I see nothing except a red underline cursor until I press cntrl-c when the prompt reappears....anything I type is echoed but no commands are recognised until I get the # prompt back with cntrl-c.
Ok, great, so can you try the first item in this post and let me know what happens please.

Regards,
Thunor

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#637 Post by peebee »

thunor wrote:1. Delete the lines in Geany
2. Open a terminal and type Frisbee
3. Click the "Configure Network Interfaces" tab
4. Click the Exit button
5. Type ls in the terminal and press Enter
6. Do you get a directory listing or does the cursor simply go to the next line?

Ok, great, so can you try the first item in this post and let me know what happens please.
Regards,
Thunor
6 = directory listing - pressing exit after configure network interfaces exits Frisbee and takes you back to the # prompt in the terminal.

P.
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

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

#638 Post by thunor »

peebee wrote:6 = directory listing - pressing exit after configure network interfaces exits Frisbee and takes you back to the # prompt in the terminal.

P.
OK, now put the lines back and do the exact same test so that we can establish that it is definitely those input lines.

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#639 Post by peebee »

thunor wrote:
peebee wrote:6 = directory listing - pressing exit after configure network interfaces exits Frisbee and takes you back to the # prompt in the terminal.

P.
Great :D Ok, so then the developers of Frisbee need to look into those progressbar input lines and make sure that they have an exit condition and are not simply left to run for 10000/2 * 15 seconds.

The simplest thing would be to use gtkdialog4 with a timer widget with an interval of 15s, and the timer dies with the application.

I guess rerwin is monitoring this thread.

Cheers,
Thunor
Hi Thunor

Hope we've not got a comms problem....

The exit button that works is on the configure network interfaces screen - the exit button on the main-dialog screen still hangs.

I actually ran Frisbee a second time after doing the above test - a list of wifi signals was displayed and I configured my wpa as usual but when I clicked exit the terminal hung.

Sorry if I didn't explain this properly....

Cheers
peebee
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

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

#640 Post by thunor »

peebee wrote:...the exit button on the main-dialog screen still hangs.
I don't know what you mean by this.

I downloaded the Frisbee.gz package posted by rerwin and that is Frisbee, one file, with "Frisbee" in the window title bar and two tabs, "Configure Wireless Networks" and "Configure Network Interfaces".

Can you give me a screenshot of the "main-dialog" please.

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#641 Post by peebee »

main1.png = main window on 1st run of Frisbee with the 2 input lines removed - blank - no wifi signals displayed

subsid.png = window after clicking configure network interfaces - with exit button that exits correctly

main2.png = main window on 2nd run of Frisbee - its exit button hangs if the wifi connection is established
Attachments
main1.png
(99.25 KiB) Downloaded 559 times
subsid.png
(97.97 KiB) Downloaded 563 times
main2.png
(131.03 KiB) Downloaded 577 times
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

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

#642 Post by thunor »

I'm going out now.

Thanks for your efforts.

So we've established that Frisbee/gtkdialog3 is not exiting from the exit button on the first tabbed page and that the Frisbee developer needs to quit those progressbar inputs.

That's it. To be honest it's bizarre and I don't really want to spend another day communicating my debugging methodology through a forum. You need somebody with programming skills that can quickly narrow down and isolate the cause on your computer in your house.

What else can I say. Try replacing gtkdialog3 within the code with gtkdialog4 or just gtkdialog. The exit button on the first tabbed page is at line 414: try placing <action>echo EXITING</action> above it and look for it in the terminal. Try placing <action signal=\"hide\">echo HIDING</action> above the </window> tag at line 604. Those progressbar inputs should have an exit condition.

Cheers.

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

#643 Post by zigbert »

Thunor
A quest about r473 - export="false"
This is of course a very handy option. I see clearly how I can include it into pMusic which handles large amount of data in some widgets...
... But, does this has an effect only if <variable> is defined, or does gtkdialog export the content even if no variable is set?


Thank you
Sigmund

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

#644 Post by thunor »

zigbert wrote:Thunor
A quest about r473 - export="false"
This is of course a very handy option. I see clearly how I can include it into pMusic which handles large amount of data in some widgets...
... But, does this has an effect only if <variable> is defined, or does gtkdialog export the content even if no variable is set?


Thank you
Sigmund
It only has an effect if <variable> is defined. gtkdialog does not export the contents of a widget if you haven't given it a name.

There's a gtkdialog function called variables_export_all() which puts the contents of all widgets into the environment if you have given them a name. This function is called when you run a shell command i.e. in an <action> directive, when you refresh a widget and when you launch a new dialog so I think you can imagine how desirable it would be to stop putting unneccessary data into the environment.

Cheers,
Thunor

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

#645 Post by thunor »

peebee: I had a think when I was out and I can recommend this to you:

From a terminal, run Frisbee and then press the exit button on the first tabbed page. Does gtkdialog exit or hang? I can't see why it would not exit at this stage because it's a similar exit button to the other one on the second tabbed page.

Let's say it exits cleanly. You know the route that you take through Frisbee to duplicate this problem, so do the next thing whatever that is (ckick a button, select something?) and then click the same exit button. Did it exit cleanly? It did, so do two things and then click the exit button. At some point you are going to find the exact place where the exit button becomes problematic and then we have something to work with. It's important that you only do one more additional thing each time.

Let me know what you find. I can't do anything at the moment except give you advice on how to effectively problem solve.

Regards,
Thunor

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

Re: Gtkdialog3 problem: Sometimes aborts instead of returning

#646 Post by thunor »

rerwin and peebee:
rerwin wrote:1. Is there a way to add some debug/troubleshooting logging to gtkdialog to help identify where things go awry? Or is there already someplace to find diagnostic info from gtkdialog?

2. Because this seems, to me, to be a case where a data item is tested but is not the expected data, thus producing random results, could you examine the gtkdialog code that handles the "exit" process to look for a possible bug of that sort?
I recommend that you compile gtkdialog yourselves and place some debugging code into it.

Exiting using <action type="exit">Exit-NOW</action> or similar is handled by action_exitprogram()

action_exitprogram() is called by execute_action()

execute_action() for the button clicked signal is called by button_clicked_attr()

I've just tried it myself and you have to echo $RETVALS in the frisbee script and don't forget to rename gtkdialog3 (which I did forget to do) because it's going to be "gtkdialog" wherever you put it.

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

#647 Post by technosaurus »

Helping other people debug is always difficult because everyone has their own method. I try strace and then pepper the hell out of the code near where strace stops with printfs/echoes of sequential numbers, others use a methodical approach, write test code, step through a debugger/tracer. It all depends on whether you are a programmer, "software engineer" or code hacker... or whatever.

Speaking of compiling gtkdialog, I was contemplating trying to build it for win32, but before I even start I know of at least 1 stumbling block. I don't think windows has popen(), (someone correct me if I am mistaken) but glib has a wrapper that should work on both: g_spawn_command_line_async(s,NULL) or one of its relatives.

Can anyone think of others that may be missing?

@thunor - which version would you recommend git, latest stable or is there a new stable just beyond the horizon?
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
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

Re: Gtkdialog3 problem: Sometimes aborts instead of returning

#648 Post by peebee »

[quote="thunor"][/quote]

Hi Thunor

Many, many thanks for your helpful suggestions and patient hand-holding - much appreciated.

With the help of your suggested diagnostic trace outputs and many, many reboots I think I've proved that the problem actually lies in the called Frisbee function "add-profile".

I've generated some diagnostic info from add-profile and sent it off to rerwin - hopefully it will allow him to pinpoint why add-profile in his new version of Frisbee does not return.....

Cheers
peebee
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

User avatar
rerwin
Posts: 2017
Joined: Wed 24 Aug 2005, 22:50
Location: Maine, USA

#649 Post by rerwin »

thunor, peebee,
I have been away from puppy for almost a full day, so have just now reviewed all that you have accomplished together. Thank you, both, for working the problem. Now it is my turn, to digest the recommendations and evidence, then fix the code.
Richard

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

#650 Post by thunor »

peebee and rerwin: A good job done.

technosaurus: I'm just putting the 0.8.3 release together so I can recommend that -- good luck with win32 :)

Cheers,
Thunor

Post Reply