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 Sun 21 Dec 2014, 08:27
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Gtkdialog Development
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 44 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 42, 43, 44, 45, 46, ..., 53, 54, 55 Next
Author Message
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 19 Nov 2012, 19:35    Post subject: Re: Gtkdialog3 problem: Sometimes aborts instead of returning
Subject description: No error messages or segfaults found for diagnosis
 

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.
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4424

PostPosted: Tue 20 Nov 2012, 00:20    Post subject:  

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?

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
peebee


Joined: 21 Sep 2008
Posts: 1548
Location: Worcestershire, UK

PostPosted: Tue 20 Nov 2012, 07:30    Post subject: Re: Gtkdialog3 problem: Sometimes aborts instead of returning
Subject description: No error messages or segfaults found for diagnosis
 

thunor wrote:


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

_________________
LxPup-14.10 = Puppy + LXDE
Back to top
View user's profile Send private message Visit poster's website 
rerwin


Joined: 24 Aug 2005
Posts: 1551
Location: Maine, USA

PostPosted: Tue 20 Nov 2012, 19:06    Post subject:  

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
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Wed 21 Nov 2012, 13:42    Post subject:  

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 Smile

Cheers,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sat 24 Nov 2012, 12:27    Post subject:  

zigbert wrote:
...
Code:
<action>[ $FORMAT = flac" ] && disable:BITRATE</action>
or
Code:
<action>[ $FORMAT = flac" ] && <action>disable:BITRATE</action></action>
...

Changes in r476:
  • Added support for:
  • <action>if file(filename) function:parameter</action>
  • <action>if ! file(filename) function:parameter</action>
  • <action>if command(shell command) function:parameter</action>
  • <action>if ! command(shell command) function:parameter</action>

To accommodate different coding styles I have allowed anything between "if !file(filename)" to "if ! file ( filename )" and similarly for command(). Technically speaking I am parsing the start of every action directive so you could do <action>if command(cat /some/file) echo "this is pointless"</action> but it would be two processes instead of one which is indeed pointless.

With command() -- just as with <action>shell command</action> -- the widget variables are placed into the shell therefore you could conditionally execute code based upon the value of other widgets.

Both the file() and command() functions are expecting true/yes/!0 or false/no/0 so a file will require this data to be within it and a command will require this data to be echoed to stdout.

Is it intuitive? Does it make sense? Otherwise let me know.

I'm going to update the wiki and widget reference now and maybe tweak a couple of things before putting together a source code package release.

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Sat 24 Nov 2012, 13:32    Post subject:  

thunor
After a bit testing, this is how I got it working.
Really handy - thanks a lot!!!

Code:
      <comboboxtext width-request="80">
       <variable>COPY_FORMAT</variable>
       <sensitive>'$VISIBLE_CONVERT'</sensitive>
       <item>'$COPY_FORMAT'</item>
        <item>aiff</item>
      <item>asf</item>
      <item>au</item>
      <item>flac</item>
      <item>mp3</item>
      <item>ogg</item>
      <item>rm</item>
      <item>voc</item>
      <item>wav</item>
       <action>if command([ $COPY_FORMAT = flac ] && echo true) disable:COPY_BITRATE</action>
       <action>if command([ $COPY_FORMAT = flac ] && echo true) disable:TXT_COPY_BITRATE</action>
       <action>if command([ $COPY_FORMAT = flac ] && echo true) disable:COPY_SAMPLE</action>
       <action>if command([ $COPY_FORMAT = flac ] && echo true) disable:TXT_COPY_SAMPLE</action>
       <action>if command([ $COPY_FORMAT = flac ] && echo true) disable:COPY_CHANNEL</action>
       <action>if command([ $COPY_FORMAT = flac ] && echo true) disable:TXT_COPY_CHANNEL</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:COPY_BITRATE</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:TXT_COPY_BITRATE</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:COPY_SAMPLE</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:TXT_COPY_SAMPLE</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:COPY_CHANNEL</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:TXT_COPY_CHANNEL</action>
      </comboboxtext>

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sat 24 Nov 2012, 14:18    Post subject:  

zigbert wrote:
thunor
After a bit testing, this is how I got it working.
Really handy - thanks a lot!!!

Code:
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:COPY_BITRATE</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:TXT_COPY_BITRATE</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:COPY_SAMPLE</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:TXT_COPY_SAMPLE</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:COPY_CHANNEL</action>
       <action>if command([ $COPY_FORMAT != flac ] && echo false) enable:TXT_COPY_CHANNEL</action>
      </comboboxtext>

I've just tweaked the code as the "!" not symbol scanning code was not-very-accommodating(tm) so I recommend checking it out (r477).

Which means that the last 6 lines above will correctly be <action>if command([ $COPY_FORMAT != flac ] && echo true) enable: ...

Yeah, this will be handy for lots of things I'm sure. I'm writing an application and I want to do a conditional exit which is now possible, well I guess it was before with the checkbox trick but I think that that laborious trick is now redundant.

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Sat 24 Nov 2012, 15:11    Post subject:  

thunor wrote:
I want to do a conditional exit which is now possible, well I guess it was before with the checkbox trick but I think that that laborious trick is now redundant.
As I see it, the checkbox trick is still the best solution where several widgets wants to refresh (parts) of the gui. Ie. in pMusic there are plenty of occasions to update the playlist/window-title/albumart/... (or the trackinfo window that contain heaps of widgets to refresh). Much easier with one checkbox than conditional <action> code in all related widgets.


All good stuff!!!
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sun 25 Nov 2012, 11:18    Post subject:  

Regarding the recent conditional execution code, I'm investigating moving it to something like <action condition="if ! command(shellcommand)">function:parameter</action> because it's more integrated into how gtkdialog deals with everything and I'm thinking about the possible expansion of this feature at a later date, so carry on using it but you might have to slightly modify it. Hey, that's what it's like living on the cutting edge Razz
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Sun 25 Nov 2012, 12:22    Post subject:  

Living on the edge keep me alive
_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 26 Nov 2012, 13:55    Post subject:  

Changes in r479:
  • Moved the action conditions into their own tag attribute belonging to the action directive e.g. <action condition="if file(filename)">...
  • Added support for:
  • condition="if active(varname)",
  • condition="if sensitive(varname)",
  • condition="if visible(varname)" and it's trivial to add more.

I've got some interesting things to say about gtkdialog's parser but I'm off out so I'll post it later tonight.

Cheers,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 26 Nov 2012, 19:27    Post subject:  

I guess everyone who's written a gtkdialog application will have experienced the following issue although I know that I've become accustomed to working around it -- I'm talking about the escaped double-quotes problem.

When constructing the contents of an action you know that if you wrap the lot in double-quotes then you can't use double-quotes inside unless you escape them, but the escapes (backslashes) remain within the string i.e. there's no processing of these to remove the backslashes from the front of double-quotes so you end up with this:
Code:
<action>"echo \"sometext\""</action>

echoing this:
Code:
"sometext"

The advantage of wrapping the action's contents in double-quotes is that you can split complex actions across multiple lines, but the moment you need to embed double-quotes it all falls apart. The solution to this which most people are aware of is not to wrap everything in double-quotes but to write everything on one long line. Ok, so at least there's a workaround to that problem but it can't be fixed because escaped double-quotes within existing applications should really be escaped escaped double-quotes.

The recently added condition tag attribute belonging to the action directive initially presented me with the problem that the contents of a tag attribute are wrapped in mandatory double-quotes so you can't work around them, but since this is a new feature and would be rather limited if you couldn't properly embed double-quotes, I scan the string and remove the backslash from the front of double-quotes.

So far so good, except that there's some weird stuff going on with backslashes within tag attributes:
Code:
<button>
   <action>echo some\ text</action>
   <action>"echo some\ text"</action>
</button>

The shell correctly removes the escape character from the space in the first action, and the second results in everything up to "text" being cut! I'm sure that the parser rules are responsible for this and fixing it should be achievable, but you should be aware that it exists although if it happens in a condition tag attribute then it'll cut the function name and you'll get a warning message about it being unknown.

Cheers,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Tue 27 Nov 2012, 04:28    Post subject:  

r479

I expected this code to work, but the enable-function is not activated.
Code:
       <action condition="if command([ $COPY_FORMAT = flac ] && echo true)">disable:COPY_BITRATE</action>
       <action condition="if command([ $COPY_FORMAT != flac ] && echo false)">enable:COPY_BITRATE</action>
I fixed it like this
Code:

       <action>enable:COPY_BITRATE</action>
       <action condition="if command([ $COPY_FORMAT = flac ] && echo true)">disable:COPY_BITRATE</action>



Great stuff Smile
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 27 Nov 2012, 08:29    Post subject:  

zigbert wrote:
...
Code:
<action condition="if command([ $COPY_FORMAT != flac ] && echo false)">enable:COPY_BITRATE</action>

I fixed it like this
Code:
<action condition="if command([ $COPY_FORMAT = flac ] && echo true)">disable:COPY_BITRATE</action>

...

I was a bit ambiguous about what exactly the functions are expecting:

if function(argument) will expect "true", "yes" or a value that isn't zero e.g. "-89" or "18" to evaluate as true else it'll evaluate as false.

if ! function(argument) will expect "false", "no" or "0" to evaluate as true else it'll evaluate as false.

Basically what I'm doing here is if function(argument) = "true" and if function(argument) = "false" but in a simpler way.

It's like the existing prefix "if true function:parameter" and "if false function:parameter" for toggling widgets but I've replaced the true and false with functions. I can see though that people will think that "!" is actually notting.

Ok, maybe I should use if function_is_true(argument) and if function_is_false(argument) which is clearer right? I'm going to think about it.

[EDIT] I'm changing it now...

[EDIT2] Checkout/update to r480 please. It's now "if function_is_true(argument)" and "if function_is_false(argument)" which is much clearer.

Cheers,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 44 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 42, 43, 44, 45, 46, ..., 53, 54, 55 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.1330s ][ Queries: 13 (0.0181s) ][ GZIP on ]