Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 16 Sep 2014, 15:50
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
gtkdialog problem: child window not opening consistently
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [27 Posts]   Goto page: 1, 2 Next
Author Message
lstandish


Joined: 06 Jun 2008
Posts: 126

PostPosted: Sat 19 Dec 2009, 17:48    Post subject:  gtkdialog problem: child window not opening consistently
Subject description: problem launching a child gtkdialog window using an "About" button
 

Hi, I am working on an gtkdialog interface to my bash (rsync-based) hardlinking backup program 'snap2'. (http://www.linuxbackups.org/snap2). I am very close to finishing a major new release, which features GUI setup of SSL public key authentication for backing up to a remote server. The next release will include a Puppy pet package. I am developing this on Debian Lenny.

I have having a mysterious problem with launching a child gtkdialog window using an "About" button. Here's the simple button code:

Code:
<button><label>About snap2</label><action type="launch">ABOUT_DIALOG</action></button>


It works fine when the 'About' button is on any of my gtkdialog windows EXCEPT the main window. When I put the button on the main window, when it is clicked the button stays depressed and hangs the program.

My overall code structure, simplified, looks like this:

(initialize variables, including ABOUT_DIALOG)

while true
do

(build up main window gtkdialog XML in MAIN_DIALOG)

I=$IFS; IFS=""
for STATEMENTS in $(gtkdialog --program=MAIN_DIALOG); do
eval $STATEMENTS
done
IFS=$I

(do different things according to buttons pressed and options checked. In some cases new gtkdialogs are built to give messages or get user input. The 'About' dialog works fine in these windows!)

done

The endless loop which puts up MAIN_DIALOG is exited with a break command.

Note that I am not using a menu.

I can't see any reason why the 'About' button should fail to open a new window, while exactly the same button code opens the About window fine in any gtkdialog window except the main one.

Any help would be greatly appreciated. I can email the full program code (which is contained in a single file), but at 31.8K it is probably too much to post here.
Back to top
View user's profile Send private message 
mcewanw

Joined: 16 Aug 2007
Posts: 2345
Location: New Zealand

PostPosted: Sat 19 Dec 2009, 22:18    Post subject:  

Are you exporting the ABOUT_DIALOG variable to the environment in such a way that your main dialog can see it?
_________________
Non enim propter gloriam, diuicias aut honores pugnamus set propter libertatem solummodo quam Nemo bonus nisi simul cum vita amittit.
Back to top
View user's profile Send private message Visit poster's website 
lstandish


Joined: 06 Jun 2008
Posts: 126

PostPosted: Sun 20 Dec 2009, 10:52    Post subject:  

Yes, it is exported and visible when gtkdialog is invoked. I will soon post the code as an attachment here, but I am currently reworking the code to solve another bug.
Back to top
View user's profile Send private message 
lstandish


Joined: 06 Jun 2008
Posts: 126

PostPosted: Mon 21 Dec 2009, 02:18    Post subject: gtkdialog child windows trouble - pet package posted
Subject description: also, rxvt will not open child terminal, although xterm works
 

Here is the release 3.2-4 of snap2 rotating snapshot backup program, posted here to request help on a problem with opening a child gtkdialog. See my previous post in this thread. I have started a Puppy project page with details on this brand new program. It is intended for Puppy 4.3.1.

The 'About snap2' button code (see lines 502-503) will not open a child gtkdialog from the main window, while the exact same button/dialog code works in other windows!

Also, xterm is a dependency to snap2. Of course, I'd like to allow rxvt. I'm using xterm to open a child terminal window to run a shell script, like this:
$XTERM -e "snap2shell snapshot $settingsdir" &
(where $XTERM is the detected terminal emulator - so far it appears that only xterm works, also on Debian.)

I suspect the problem is related to environmental variables - ?

PS I just checked installation of the package and it ignores the xterm dependency, perhaps because /usr/bin/xterm exists as a symbolic link on Puppy 4.3.1. To run snap2, pet package 'xterm' must be installed manually.
snap2-3.2-4.pet
Description 
pet

 Download 
Filename  snap2-3.2-4.pet 
Filesize  32.14 KB 
Downloaded  552 Time(s) 

Last edited by lstandish on Sat 26 Dec 2009, 13:28; edited 1 time in total
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Sat 26 Dec 2009, 13:00    Post subject:  

I installed xterm and your pet, uncommented and moved the ABOUT line, and ran it from a terminal to see if it kicked back any error messages. When I clicked on the about button, part of the main window would disappear, but no about screen was displayed.
Top from another terminal would show my processor using 50 percent and the program was unresponsive.
If I then opened yet another terminal and killed that process, the program would recover so I could shut it down.
I did a Snapshot backup of root to a 4 gig usb stick and it was extra slow.
Addition of a progress bar would let the user know that the backup was still in progress.
I also had a few false starts since the destination directory brouse button would pop up a help dialog to press an Add button, but the selection would be gone when one closed the help dialog window.
I tried various ways to try to get the ABOUT button to work correctly from the main program window, but with no good results.
To do this, I used modified, for your program, examples from the tutorial here in HOWTO - GTKdialog-tips by Zigbert.

I will check into it more later.
Back to top
View user's profile Send private message 
lstandish


Joined: 06 Jun 2008
Posts: 126

PostPosted: Sat 26 Dec 2009, 13:45    Post subject: snap2 version update  

Thanks, 8-bit, for looking at this.

I extensively rewrote the GUI code since the release of snap2 that you tried. The current release is 3.2-4. After pretty extensive testing I have not been able to find any problems. I changed the attachment in this thread to the newer version. Please try the new version. I also opened a project page for it here.

If you did a snapshot backup to a USB flash memory and it was slow, it could be the flash memory is relatively slow. I find that Lexar brand is much faster than most other brands. However, after the first snapshot-type backup, you should find subsequent backups are fast even to a slow USB drive, since only modified and new files are transmitted. Note that you can also back up to a remote server.

On the issue with the child help dialog not opening, I now suspect a bug in gtkdialog. As a workaround, until there is a better solution, I made the help button on the main screen close the parent dialog before putting up the help dialog. In fact, it now loads the content of a text file. If anyone discovers the problem with the child help dialog, I'd be glad to know about it. The commented-out button code, which should be moved to the dialog XML above for testing, is at line 478.

Last edited by lstandish on Sat 26 Dec 2009, 23:07; edited 1 time in total
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Sat 26 Dec 2009, 15:17    Post subject:  

The closewindow option does not seem to work.
When the About button is clicked in a child process, the about snap window opens and a close and website button are displayed.
The close button does not work.
I closed that window by clicking on the "X" that one would use to close any window.
The new layout is better and for a user with lower display settings, ex. 800x600, it will have a better chance of displaying properly.

Keep up the good work and visit the HOW-TO Gtkdialog-tips for possible tips also.

I get this initial message in Xterm on starting a backup.
"Warning: Cannot convert string "nil2" to type FontStruct"

Also, the Xterm window comes up behind the main program window and so the user may never see the message of: Press return to close this window.

Later

Last edited by 8-bit on Sat 26 Dec 2009, 15:45; edited 1 time in total
Back to top
View user's profile Send private message 
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Sat 26 Dec 2009, 15:25    Post subject: Re: snap2 version update  

Hmmm .....

lstandish,

I didn't get to see the earlier codes ... so, by looking at the recent code above, the about_dialog assignments needs to be declared earlier ... see if this very minor re-arrangements below helps overcome your qualms about the about box ..... Wink


Rgds
snap2.tar.gz
Description 
gz

 Download 
Filename  snap2.tar.gz 
Filesize  10.33 KB 
Downloaded  481 Time(s) 
Back to top
View user's profile Send private message 
lstandish


Joined: 06 Jun 2008
Posts: 126

PostPosted: Sun 27 Dec 2009, 00:11    Post subject:  

Patriot, thanks for lending a hand. I tried the version you sent, and find that the 'About' button still does the same. That is, it 'hangs' gtkdialog. CPU use skyrockets, like an endless loop somewhere. The strange thing is that the exact same 'about' dialog box code works fine when invoked from gtkdialog instances OTHER than the main one.

8-bit, I am unable to duplicate your trouble with the 'Close' button in the "About" dialog. It closes just fine for me. I am however using the Debian gtkdialog for development, not Puppy's gtkdialog3. I'll try this again on Puppy and report back.

Could the problem with the xterm window appearing *behind* the main window be due to low screen resolution? Or, it could be that Puppy's window manager is not as efficient at placing the windows as KDE's is. I am developing on Debian running KDE with a 1280x1024 pixel monitor, and all new gtkdialog windows are always very visible, usually to one side of the main dialog.

Do you see the xterm error "Warning: Cannot convert string "nil2" to type FontStruct" when you invoke xterm directly (not running snap2)? I have never seen this error, either on Debian Lenny or on Puppy 4.3.1.

On your suggestion to add a progress bar, I think that would not be possible since rsync does not provide any useful feedback on file transmission progress - at least, not without messing up the generation of logfiles. If the child xterm that appears when a backup in invoked is not behind the main window, I think the progress bar should not be necessary, since it will be obvious that rsync is doing its thing. (Note that once backups are configured, snap2 can be invoked non-interactively via cron or via a menu entry.)
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Sun 27 Dec 2009, 01:25    Post subject:  

In the ABOUT_DIALOG code, the line:
<button><label>Close</label><action type=\"closewindow\">ABOUT_DIALOG</action></button>

does not work for me. The window stays open when clicking on close.
Could this be due to trying to close it from inside of the ABOUT_DIALOG call?
Also, the line "Warning: Cannot convert string "nil2" to type FontStruct" is shown when the Xterm window is first opened in doing a backup.
The backup continues though and ends with "Press Return to close window.
The Xterm window is displayed behind the main program window and stays until it is given priority and return is pressed.
And I did install Xterm and the window says Xterm in the header.

Also, that Warning message only shows in an rxvt window that I used to start snap2.
A lot of times, an error message that seems invisible will show when one starts a program from a terminal.
Back to top
View user's profile Send private message 
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Sun 27 Dec 2009, 05:16    Post subject:  

Hmmm .....

lstandish,

Kindly state your gtkdialog version ... I ran this snap2 pet on puppy412 and gtkdialog3-0.7.20 ... done several test runs with the about box enabled in the main dialog (as per my posted codes above) but I cannot duplicate the peak cpu usage/hang situation ... I clicked on the about box everywhere it appears and they worked just fine ..... Apart from the msgbox fix (for aboutbox) earlier, others seems ok ... Also did a quick test with gtkdialog2-0.5.98 which does not work with snap2 .....

Can't get to the p431 yet ... maybe give it a test run on it later .... If possible, could you give some brief steps on how to make it peaked/hang? Did I miss anything to make it bork properly?


Rgds
Back to top
View user's profile Send private message 
lstandish


Joined: 06 Jun 2008
Posts: 126

PostPosted: Sun 27 Dec 2009, 12:05    Post subject:  

Patriot,

I've confirmed that the hang upon clicking the 'About' button happens in Puppy 4.3.1, both in my original code with 'About' button enabled on the main menu, and in your version with the ABOUT_DIALOG definition moved.

Puppy 4.3.1 uses gtkdialog 0.7.20. This is the same version number given by my gtkdialog on Debian, the only difference being that it is called gtkdialog3 on Puppy.

So, it looks like a problem that happens only in p 4.3.1, or in a Puppy version later than 4.1.2. However, it also happens in Debian Lenny. I think it must be something in the recent GTK+ libraries upon which gtkdialog is based.

8-bit, are you also using Puppy 4.3.1? I can't duplicate the 'Cannot convert string "nil2" to type FontStruct"' error you see in xterm.

Do you think it would be better to have the main snap2 window close while a backup is being run, rather than run the backup as a separate process in its own xterm window? Also, 8-bit, did you try a *second* snapshot backup of /root, to see how fast the hard-linked rsync backups are? (This sort of discussion should probably be done on this forum's snap2 project page)
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Sun 27 Dec 2009, 15:06    Post subject:  

I am trying to run snap2 from Puppy Linux 4.3.1 scsi kernel 2.6.30.5.
And the problems are as stated.
I posted an example program in HOWTO GTKdialog-tips that uses gtkdialog2. The closewindow option seems to work with it consistently from a child process.
But it does not recognize launch as an option.
As to the Warning message, that is shown only in rxvt that I was using to start the program and appears upon doing a backup.
And the second backup was a lot faster.
Back to top
View user's profile Send private message 
lstandish


Joined: 06 Jun 2008
Posts: 126

PostPosted: Sun 27 Dec 2009, 15:55    Post subject:  

8-bit,
My Puppy 4.3.1 uses kernel 2.6.30.5 #1 SMP. Maybe the slight kernel difference explains the non-working 'Close' button in the 'About snap2' child dialog. I have tried opening the 'About snap2' dialog from everywhere I can ('Exclusions for Selected...', 'Delete Selected...', and '...Source Path Editor', all on the 'DIRECTORIES TO BACK UP' tab), and the 'Close' button works every time.

However, based on your report, and until a consistent solution is found for gtkdialog3, I'll remove the 'About snap2' child dialog for snap2 version 3.2-5. Or maybe I'll just remove the 'Close' button (the window could still be closed with the 'X' in the corner.)

On the 'Cannot convert string "nil2" to type FontStruct"' error, I was able to duplicate it by first starting a rxvt terminal and running snap2 from there, as you said. I think it is basically a clash between rxvt and xterm. Since one would not normally start snap2 from rxvt, I think the warning message can be safely ignored.

By the way, when you installed snap2, you got a snap2 menu entry. Look in 'Utility.' For version 3.2-5 I will add a second menu entry (which the Debian/Ubuntu version already has): one to execute a snapshot backup non-interactively (without the GUI).

I'd welcome any suggestions for improving the program, but please post them at http://www.murga-linux.com/puppy/viewtopic.php?t=50402
Back to top
View user's profile Send private message 
lstandish


Joined: 06 Jun 2008
Posts: 126

PostPosted: Tue 29 Dec 2009, 14:45    Post subject:  

2 gtkdialog issue were brought up in this thread. One appears to be resolved, the other isn't.

RESOLVED: 'closewindow' now working in child window, reported by 8-bit. It turns out 8-bit was using a patched version of gtkdialog which appears to have broken closewindow.

UNRESOLVED: As illustrated in the snap2 code (see download available above), a child window cannot be opened from the main snap2 gtkdialog, whereas it can from other gtkdialogs. The simple button code is :

<button><label>About snap2</label><action type="launch">ABOUT_DIALOG</action></button>
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [27 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1006s ][ Queries: 12 (0.0074s) ][ GZIP on ]