Gtkwialog project

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#16 Post by rcrsn51 »

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

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#17 Post by wiak »

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/viewto ... 108#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. ... 995#924995
wiak

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#18 Post by rcrsn51 »

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.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#19 Post by wiak »

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):



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

Code: Select all

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: Select all

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 ;)

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: Select all

<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

darry19662018
Posts: 721
Joined: Sat 31 Mar 2018, 08:01
Location: Rakaia
Contact:

#20 Post by darry19662018 »

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.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#21 Post by wiak »

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.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#22 Post by wiak »

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:
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.

darry19662018
Posts: 721
Joined: Sat 31 Mar 2018, 08:01
Location: Rakaia
Contact:

#23 Post by darry19662018 »

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. :)

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#24 Post by wiak »

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. :)
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:
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

darry19662018
Posts: 721
Joined: Sat 31 Mar 2018, 08:01
Location: Rakaia
Contact:

#25 Post by darry19662018 »

Sweet done:)

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#26 Post by wiak »

Code: Select all

#!/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

mistfire
Posts: 1411
Joined: Wed 05 Nov 2008, 00:35
Location: PH

#27 Post by mistfire »

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

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#28 Post by wiak »

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: Select all

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

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#29 Post by wiak »

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/viewto ... 434#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/viewto ... 443#993443

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

wiak

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#30 Post by disciple »

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

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#31 Post by disciple »

Hi Wiak,
Having read your latest comment in the other thread, I wonder - why don't you make the recommended behaviour default, and the legacy behaviour a switch, rather than the other way around? If people want to use gtkwialog as a drop in replacement for gtkdialog they could create a suitable alias that will provide the switch, couldn't they?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#32 Post by wiak »

disciple wrote:Hi Wiak,
Having read your latest comment in the other thread, I wonder - why don't you make the recommended behaviour default, and the legacy behaviour a switch, rather than the other way around? If people want to use gtkwialog as a drop in replacement for gtkdialog they could create a suitable alias that will provide the switch, couldn't they?
Yes, I prefer that to dissuade others from using old mode that causes problems on dash systems as well documented. However, that would mean that legacy gtkdialog apps would need modification to work with gtkwialog (a switch addition to indicate 'legacy mode'). I decided that proper full backward compatibility could only be achieved if, by default, gtkwialog used legacy gtkdialog mode, to help the current gtkdialog user community. The only thing I am asking for is the name change to gtkwialog to allow proper differentiation of the change; that being agreed I am happy to finally consider gtkwialog being hosted officially on Puppy sites; an alternative could be Dog sites; that doesn't really matter to me - documentation will have to stress that legacy mode is not desired for new apps.

A branch of gtkdialog is really not very acceptable for the reasons I have given - a branch has nothing really to do with the actual name change I feel is appropriate since any branch just gets reabsorbed anyway.
EDIT: Creating a branch in that fashion is therefore very much against my own will as the developer of these additions. However, the overall program is GPLv2 license copyright László Pere so on publishing I cannot force my own will in practice, only in unsatisfied comment.

In the circumstances of that, I think I may aim to host gtkwialog on Dog github if fredx181 agrees to that. Indeed, in the circumstances, that it was Dog developers only who helped with the development testing, that is more appropriate I guess. Puppy Team will of course be free to adopt or not adopt this new alternative.

wiak
Last edited by wiak on Wed 30 May 2018, 07:35, edited 1 time in total.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#33 Post by wiak »

I am determined, by the way, that gtkwialog be my last project (though I will maintain the majority of my work). I decided to retire a couple of years ago, but had weX design at the back of my mind; that remains one of my own favourites but was shown no interest other than by the Dogs. Then, for some unknown reason, I decided to have a go at woof-CE, the result of which being makepup, but aside from one pretty much off-the-cuff remark by one Puppy Steward that project received no interest from Puppy Stewared's Team at all so not sure it was of any use in the end, which is fine, by the way, I am not complaining - may be of no use indeed. Anyway, I had always been annoyed by gtkdialog's behaviour with bash export -f and almost by chance otherwise decided to try and do something about it. A good time to retire I feel. I am happy with gtkwialog.

wiak

EDIT: Because I have allowed gtkdialog mode to be the default in gtkwialog, by the way, in system implementation/install there is no practical problem anyway. If Puppy want to create a dotpet of gtkwialog and call that gtkdialog and rename it as you will internally, it will work out-of-the-box as if it is legacy gtkdialog. So it is not even necessary to have gtkdialog as symlink to gtkwialog on Puppy systems. And since the Dogs are officially considered as being under the Puppy umbrella, hosting gtkwialog on the Debian Dog Organisation github site will keep it in-house anyway.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#34 Post by wiak »

Temporary download links to the, hopefully and expected, final for-testing-only versions of gtkwialog can now be found in first post of this thread:

http://www.murga-linux.com/puppy/viewto ... 434#993434

I will begin work of tidying up and publishing the source code repository of this gtkwialog, gtkdialog fork, within the next day, or two.

The foot of post four of this thread contains some very basic programs you can use should you wish to begin tests of this program:

http://www.murga-linux.com/puppy/viewto ... 443#993443

wiak

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#35 Post by 01micko »

disciple wrote:Hi Wiak,
Having read your latest comment in the other thread, I wonder - why don't you make the recommended behaviour default, and the legacy behaviour a switch, rather than the other way around? If people want to use gtkwialog as a drop in replacement for gtkdialog they could create a suitable alias that will provide the switch, couldn't they?
Possibly a better solution is to create symlink. I don't care whether the symlink is gtkdialog>>gtkwialog or vise-versa but this would eliminate any new and perhaps unnecessary CLI switches and would make gtkwialog a drop in replacement for gtkdialog. Any script requiring the gtkwialog mods can and should be called with the 'gtkwialog' exec; legacy scripts called with 'gtkdialog'.

I am not much of a C programmer but I did manage to do something similar with netmon_wce (to enable wireless polling by default), which @wiak you are quite familiar.

IMHO this could be the best solution and it would be up to a distro builder to adopt gtkwialog or not.

Cheers.
Puppy Linux Blog - contact me for access

Post Reply