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 Wed 19 Dec 2018, 01:54
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Gtkwialog project
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 7 [96 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7 Next
Author Message
rcrsn51


Joined: 05 Sep 2006
Posts: 12401
Location: Stratford, Ontario

PostPosted: Mon 28 May 2018, 06:31    Post subject:  

Hi wiak: This may already have been discovered way back when the "exported functions" issue was first discussed in the Dog threads. But some random googling found this.

Note how "/bin/sh" is baked into the system() function. That suggests that in order for a legacy gtkdialog app (with exported functions) to run in a non-bash environment, /bin/sh would need to be re-linked to /bin/bash.

Meaning that you would effectively have to force the whole environment back into bash.

Bill
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1013
Location: not Bulgaria

PostPosted: Mon 28 May 2018, 06:38    Post subject:  

Hi Bill,

I'm not sure what you are getting at. As you know I've stated already how C system() call uses /bin/sh -c (I've read the source code already).

http://www.murga-linux.com/puppy/viewtopic.php?p=993108#993108

That indeed is why exported bash functions (using export -f) can only be used with legacy gtkdialog when /bin/sh is forcibly symlinked to bash. Fred did try some techniques to automate that for only when legacy gtkdialog app was actually running, and whilst his attempt seemed promising at the time, it ended with some show-stopper or other. You'd have to ask Fred more about that one since I've forgotten the link and details.

Oh here it is, Fred mentioned his attempt more recently in same thread as above link:

Fred wrote:
But don't get me wrong, I'd love to have it like standard Debian with sh > dash, maybe you remember I've tried in the past by using "switchsh", but didn't work out.

http://murga-linux.com/puppy/viewtopic.php?p=924995#924995


wiak
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 12401
Location: Stratford, Ontario

PostPosted: Mon 28 May 2018, 07:30    Post subject:  

wiak wrote:
I'm not sure what you are getting at.

I guess that I am just confirming what has now become evident.

1. Trying to port legacy gtkdialog apps into non-bash environments is a dead-end.

2. Gtkwialog will provide a solution for those who want that ability.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1013
Location: not Bulgaria

PostPosted: Mon 28 May 2018, 23:29    Post subject:  

New prealpha for testing only version of gtkwialog released which gets rid of the need to have two versions of gtk...ialog on your system since it includes optional gtkdialog command execing mode. Preferred mode, however, is to use with -b switch, which results in same glib command spawning mode as used in previous gtkwialog release: that is the mode that allows export -f to work with underlying dash shell etc.

Download link at first post of this thread.

wiak wrote:

New versions, which will use legacy gtkdialog mode (which uses system() call) if no commandline switch -b or -a provided:

NOTE WELL: The usual preferred mode is however to generally to use with -b switch as described below.

Compiled on XenialDog64 and XenialDog32

gtkwialog_prealpha64n (64bit version):

gtkwialog_prealpha32n (32bit version):

[I will also upload link to prealpha32n version for testing once I have compiled that]

To get gtkwialog mode of previous release, you need to run the command with

Code:
gtkwialog -b
followed by any other gtkwialog options you need (such as -p)

The -b stands for use 'blocking', which uses glib sync mode command spawning.

Alternatively, if you run it with:

Code:
gtkwialog -a etc...


The -a stands for use (non-blocking) glib async mode command spawning (which can start up a program in the background without needing shell & symbol. However, that mode returns immediately, which will likely not be desired response with most legacy bash/gtkdialog apps).


Only if you really know what you are doing, and at your own risk: You should be able to replace your existing legacy gtkdialog binary and use this one instead (perhaps via gtkdialog as symlink to gtkwialog) and existing shell/gtkdialog apps should work out of the box. However, new apps or modded apps are recommended to use the -b switch to put gtkwialog into glib sync command spawning blocking mode (which is mode used in previous gtkwialog release). DISCLAIMER: I am not suggesting you do replace your existing gtkdialog - this release of gtkwialog is indicated as being prealpha on purpose - it is not any kind of official release; only for testers who know what they are doing. Per the usual disclaimers and caveats, the program is not guaranteed to be fit for purpose. However, working fine in all my own tests so far.

At least the different name, "Gtkwialog", also removes the confusion some people have between legacy "Gtkdialog", the GUI building utility, and GtkDialog the name of the Gtk library code that provides the underlying functionality... i.e. comments I've read, such as: oh, I though gtkdialog was provided as part of Gtk Wink

As far as further development is currently concerned: All going well, the only thing left to be done is to update the help text for gtkwialog --help. Obviously I don't want to muck with that yet until program testing shows all good.

rcrsn51 wrote:
I am running the 64bit version. The "bash -c FUNC" structure is working correctly, but here is a problem:

Code:
<action>viewnior &</action>

This should pop up a window running viewnior as a backgrounded process.

Instead, viewnior interprets the "&" as a non-existent file, and opens in a non-backgrounded window with a "file not found" message.


@rcrsn51: As I explained, when in standard -b (blocking mode) with gtkwialog, for the above, you need to use <action>sh -c "viewnior &"</action> since it is a shell that provided job control. However:

With the new gtkwialog -a (asynchronous non-blocking mode) you can simply use <action>viewnior</action>. Note however, that legacy gtkdialog always uses blocking-mode, albeit via system() mechanism, so using this gtkwialog -a non-blocking mechanism will not always give expected results with other xml constructs (refreshing widget variables, for example, may not work as expected since non-blocked means instant return. That's not any kind of bug; it is up to the script writer to use -a option only when it is useful (and extra user code can address timing differences anyway), but -b will provide more familiar behaviour. You cannot mix -a and -b on the same dialog of course - but you can have different dialogs in your script, some with -a mode and some with -b mode. Lots to try out and test...

Note that I've slightly modified post three ("Some tips") of this thread to account for the new -a and -b command spawn modes of gtkwialog.

wiak
Back to top
View user's profile Send private message 
darry19662018

Joined: 31 Mar 2018
Posts: 229

PostPosted: Tue 29 May 2018, 05:08    Post subject:  

Hi Wiak,

I have made a Wiki entry for Gtkwialog.
http://www.puppylinux.org/wikka/Gtkwialog

Any changes you wish made to the entry please let me know.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1013
Location: not Bulgaria

PostPosted: Tue 29 May 2018, 05:53    Post subject:  

darry19662018 wrote:
Hi Wiak,

I have made a Wiki entry for Gtkwialog.
http://www.puppylinux.org/wikka/Gtkwialog

Any changes you wish made to the entry please let me know.


Thanks darryl, but the new version of gtkwialog makes the text you put in wrong cos gtkwialog now allows choice of legacy gtkdialog mode anyway, so don't need both gtkdialog and gtkwialog any longer for that.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1013
Location: not Bulgaria

PostPosted: Tue 29 May 2018, 05:53    Post subject:  

darry19662018 wrote:
Hi Wiak,

I have made a Wiki entry for Gtkwialog.
http://www.puppylinux.org/wikka/Gtkwialog

Any changes you wish made to the entry please let me know.


Thanks darry, but the new version of gtkwialog makes the text you put in wrong cos gtkwialog now allows choice of legacy gtkdialog mode anyway, so don't need both gtkdialog and gtkwialog any longer for that. So it's the last sentence that particularly needs changed. Maybe something like:

Quote:
People who want to run legacy shell/gtkdialog apps that export bash functions, and who do not want to modify them, will want to either continue using legacy gtkdialog or use gtkwialog in legacy mode (which is provided in gtkwialog for backwards compatability).


But it is up to you; I'm just providing the program and making comment.
Back to top
View user's profile Send private message 
darry19662018

Joined: 31 Mar 2018
Posts: 229

PostPosted: Tue 29 May 2018, 06:19    Post subject:  

Thanks Wiak,
Being a fork with diverged functionality gtkwialog has been given a different code name hence users can choose to use either legacy gtkdialog or this new gtkwialog as they see fit. People who have legacy shell/gtkdialog apps , who do not wish to modify them, will want to continue using legacy gtkdialog."
I have ammended the page with that quote - important to have the correct information. Smile
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1013
Location: not Bulgaria

PostPosted: Tue 29 May 2018, 07:07    Post subject:  

darry19662018 wrote:
Thanks Wiak,
Being a fork with diverged functionality gtkwialog has been given a different code name hence users can choose to use either legacy gtkdialog or this new gtkwialog as they see fit. People who have legacy shell/gtkdialog apps , who do not wish to modify them, will want to continue using legacy gtkdialog."
I have ammended the page with that quote - important to have the correct information. Smile


Sorry, darry, I meant you to keep the first sentence in too because it is important to me that gtkwialog is not pushed over using legacy gtkdialog. So the text would better read:

Quote:
Being a fork with diverged functionality gtkwialog has been given a different code name hence users can choose to use either legacy gtkdialog or this new gtkwialog as they see fit. People who want to run legacy shell/gtkdialog apps that export bash functions, and who do not want to modify them, will want to either continue using legacy gtkdialog or use gtkwialog in legacy mode (which is provided in gtkwialog for backwards compatability).


It's quite a mouthful, but it's accurate.

wiak
Back to top
View user's profile Send private message 
darry19662018

Joined: 31 Mar 2018
Posts: 229

PostPosted: Tue 29 May 2018, 07:13    Post subject:  

Sweet done:)
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1013
Location: not Bulgaria

PostPosted: Tue 29 May 2018, 08:29    Post subject:  

Code:
#!/bin/sh

# Simple Example to show the subtle difference in
# <action>command_strings for the three modes
# available in gtkwialog.
# You can substitute viewnior for gpicview, for example, if you want.
# After you close the first window, the next of the three will open:

#POPUP WINDOW 1
mode_gtkdialog_legacy='
<vbox>
  <hbox>
    <text><label>Open image viewer:</label></text>
    <button>
      <input file stock="gtk-home"></input>
      <action>gpicview &</action>
    </button>
    <button ok></button>
  </hbox>
</vbox>'
export mode_gtkdialog_legacy

#POPUP WINDOW 2
mode_synchronous_blocking='
<vbox>
  <hbox>
    <text><label>Open image viewer:</label></text>
    <button>
      <input file stock="gtk-home"></input>
      <action>sh -c "gpicview &"</action>
    </button>
    <button ok></button>
  </hbox>
</vbox>'
export mode_synchronous_blocking

#POPUP WINDOW 3
mode_asynchronous_nonblocking='
<vbox>
  <hbox>
    <text><label>Open image viewer:</label></text>
    <button>
      <input file stock="gtk-home"></input>
      <action>gpicview</action>
    </button>
    <button ok></button>
  </hbox>
</vbox>'
export mode_asynchronous_nonblocking

# popup mode_gtkdialog_legacy example window
./gtkwialog_prealpha64n -p mode_gtkdialog_legacy

# popup mode_synchronous_blocking example window
./gtkwialog_prealpha64n -b -p mode_synchronous_blocking

# popup mode_asynchronous_nonblocking example window
./gtkwialog_prealpha64n -a -p mode_asynchronous_nonblocking

exit 0
Back to top
View user's profile Send private message 
mistfire

Joined: 04 Nov 2008
Posts: 1005
Location: PH

PostPosted: Tue 29 May 2018, 09:47    Post subject:  

@wiak witch of the mode on gtkwialog supports bash exported function if the interpreter in the script is bash?
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1013
Location: not Bulgaria

PostPosted: Tue 29 May 2018, 11:33    Post subject:  

mistfire wrote:
@wiak witch of the mode on gtkwialog supports bash exported function if the interpreter in the script is bash?


You need synchronous blocking mode, which is -b command arg:

Code:
gtkwialog -b


So inside the dialog you then call the bash functions with:

<action>bash -c function_name</action>

and gtkwialog will find the function even if the underlying /bin/sh is a symlink to busybox ash.

wiak
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1013
Location: not Bulgaria

PostPosted: Tue 29 May 2018, 21:46    Post subject:  

Probably final test binary for gtkwialog is now released (download link as usual in first post of this thread):

http://www.murga-linux.com/puppy/viewtopic.php?p=993434#993434

#CHANGES: Just minor documentation changes.

Hasn't been any test reports from previous release but thanks to those who tested first version (particularly fredx181 and rcsrn51). A couple of simple test scripts can be found at the botton of the following linked post 4 of this thread (along with a somewhat technical explanation of the <action>command_string modes gtkwialog brings):

http://www.murga-linux.com/puppy/viewtopic.php?p=993443#993443

I've only uploaded 64bit binary at the moment, but I intend uploading 32bit one in a few hours time.

wiak
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6870
Location: Auckland, New Zealand

PostPosted: Wed 30 May 2018, 00:04    Post subject:  

Hi Wiak,
Regarding your thoughts about the Puppy Linux "stewards" (I'm not sure when that description was invented), I think that is another matter entirely, as gtkdialog is a separate project.

Looking at the list I note that it is mostly just a list of who keeps the various web infrastructure up and running. John obviously created and runs the forum (note that even Flash the ever present forum moderator isn't included). IIRC Raffy either created the wiki or resurrected it many moons ago.
The only roles really related to Puppy itself are:
- deciding on an "official" current version of Puppy (it seems that Dog is considered a different distro or distros, so presumably isn't actually relevant here)
- maintaining woof-ce (does Dog use woof-ce?)

I guess Dog must have at least one person that is essentially its own "steward", even if that term isn't used.

BTW thanks for piquing my interest in Dog - it looks good. I've seen people mentioning it all the time on the forum, but I didn't know what they were talking about, because they never include a link. I remember when it was being called DebianDog, but I didn't know it was the same thing. Having found its website the only trouble was making sense of all the different versions - maybe a Debian/Ubuntu enthusiast would know which one they want right away, but I certainly didn't!

_________________
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 7 [96 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7 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.1234s ][ Queries: 14 (0.0058s) ][ GZIP on ]