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 21 Aug 2018, 02:25
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 5 of 7 [96 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7 Next
Author Message
wiak

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

PostPosted: Sun 03 Jun 2018, 20:43    Post subject:  

I did an ultra-quick /usr/local/pfind/pfind conversion attempt, which is attached. It partially works in dash (for example try searching from the Advanced button gui); this or some other component of pfind needs a bit extra debugging for perfection, but can't be far away...

If you don't have time or manage to debug it, I'll try some other time.

By the way, I found it useful to search and replace for this term also:

Code:
&</action>

which needed a sh -c at the beginning too (for job control).

that end part of that action line being replaced with:

Code:
&"</action>'"


and its front part replaced with:

Code:
"'<action>sh -c "


Note that with these multi-function modularised shell/gtkdialog Puppy apps, I usually change to the relevant folder where they all are and do the likes of:

Code:
grep '&</action>' *


and


Code:
grep '<input>' *


and

Code:
grep 'export -f' *


and finally, a more generic action tag search:

grep '<action[[:space:]]>' *

and similar...

to find in which files likely problems are. Then I open these up in geany for the actual search/replace style conversion. That part of the process is surprisingly quick once I've practiced it.

NOTE: pfind also needs usleep (though works without it), which isn't in XenialDog64 at least.

EDIT: /usr/local/pfind/pfilesearch/pfilesearch also needs a few fixes for conversion. I've also attached my converted version and that seems to fix things. Still some minor pfind bugs I see, but I think they are in the non-converted one anyway on XenialDog64, which is where the attached files are from. Need tested though and I'd advise a diff on the original and these converted ones to see exactly how I did it.

pfind was certainly not the easiest program to convert since quite a lot of sh -c commands are required in it, and the need to search multiple files to find the need - but easy once the method to do so is worked out.

EDIT: Still some debugging required - it is not forgetting the previous search result. Also, may need to try it first without the modified pfilesearch additon and using the Advanced buttons search first of all (then partially working with dash). Unless I get round to further debugging of course.

EDIT2: May have fixed the bulk of it. Was a bashism (case statement form I think in pfilesearch, so needed to amend pfind line 429 to:

[url]"' <action>bash -c ". $PROGPATH/func -search"</action>'"[/url]

It is possible there are some other instances I've used sh -c when bash -c will be necessary. For speed of conversion I guess always easiest to use bash -c though who knows what trouble that may cause later!

EDIT3: Note that you get rid of the initial pfind grep error messages if you export a value for LANG before running the program. Generally not important. There are some other small error messages during running, but I think they are there whether using bash or dash (?). Program seems to work fine though.

EDIT4: Downloads deleted since I have since converted most recent pfind 6.3

wiak

Last edited by wiak on Tue 05 Jun 2018, 01:37; edited 8 times in total
Back to top
View user's profile Send private message 
phat7

Joined: 05 Jun 2015
Posts: 113

PostPosted: Sun 03 Jun 2018, 22:26    Post subject:  

How to execute gtkwialog_0.8.4_i386.deb.tar you linked on page 1?
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Sun 03 Jun 2018, 23:04    Post subject:  

phat7 wrote:
How to execute gtkwialog_0.8.4_i386.deb.tar you linked on page 1?


You haven't given me sufficient information to answer you properly phat7, (but I'll do my best anyway). In particular, are you on a Debian-based system or a Puppy? - note that the file is a deb package (though I believe many pups can use that too).

After first removing the dummy (false) .tar extension you should install the package. The installation package manager will then put the gtkwialog executable file into /usr/bin, which is in your system's executable search PATH so will be found from then on. Just like with legacy gtkdialog, you use this to create new programs. Example scripts that should work with it automatically are given in post 4 of this thread; you need to copy the content of any one of these examples into a text file, give that text file a filename of your choice, and make it executable, from the commandline, with

Code:
chmod +x your_chosen_filename


For example, once you correctly have gtkwialog installed in /usr/bin from the supplied deb package, you could try executing the following one of the post 4 example scripts:

Code:
#!/bin/bash

sub_filemanager (){
 rox &
}
export -f sub_filemanager

script='
<vbox>
  <entry>
    <variable>MYENTRY</variable>
    <input>ls -al /bin/sh</input>
  </entry>
  <hbox width-request="480">
    <text><label>Open filemanager:</label></text>
    <button>
      <input file stock="gtk-home"></input>
      <action>bash -c sub_filemanager</action>
    </button>
    <button ok></button>
  </hbox>
</vbox>'
export script

gtkwialog -b -p script


From the directory you've stored the your_chosen_filename program, you run it with:

Code:
./your_chosen_filename


If rox filemanager is not on your system, you could, say, change the rox & code line number 4 above to be pcmanfm &, or whatever filemanager your system has.

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

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

PostPosted: Mon 04 Jun 2018, 02:16    Post subject:  

After the above success with pfind, I decided to have a go at pburn since it has a similar code organization. I regret that decision...

pburn is full of <action> lines of various sorts that need a shell added when trying to convert with gtkwialog -b mode. I believe there are also bashisms in some of these actions, so legacy gtkdialog won't work when underlying shell is dash.

I have had to give up on that one for now - tons and tons of code changes needed and what makes it harder is that it keeps changing from dialogs surrounded by double quotes to dialogs surrounded by single quotes, which require a different overall <action> quoting pattern...

And the <action></action> lines are all embedded in the middle of complex lines (rather than being separated to own lines).

A nightmare to convert.

Perhaps it would be easier to leave it in legacy gtkdialog mode (which is gtkwialog also with -a or -b option) and then modify some of the code to us dash ok rather than bash for the <action>commandlines. I haven't put head into that mode of thought yet, so I'm not sure if that is easy, easier, or likely. Has Slitaz not once used pburn? If so, and using busybox ash, they must have recoded some of it for legacy gtkdialog, but maybe I'm imagining I saw it in Slitaz (or somewhere else).

I may come back to it - but don't hold out hope for that...

I much prefer to convert the bash export -f using programs (such as my own and also some of the rcsrn51's peasy suite) - that's usually easy.

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

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

PostPosted: Mon 04 Jun 2018, 11:49    Post subject: bash/gtkwialog app cast2chrome now published
Subject description: works on Puppy with bash or Debian with dash etc...
 

I've now published my first dash, ash, and bash system compatible app, 'cast2chrome' here:

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

Depends on gtkwialog of course (running in -b mode).

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


Joined: 11 Dec 2013
Posts: 3224
Location: holland

PostPosted: Mon 04 Jun 2018, 14:29    Post subject:  

Hi wiak, thanks for the pfind convert, I can' t really compare with what I did because I was testing with newer version 6.3, but will look at it later (now busy with new BionicDog release, almost ready).
Anyway I learned that not only "export -f" or other bashisms need to be modyfied but also other commands need the bash -c or sh -c in front of it.
About pburn... I had the feeling already that it would be too complicated, so I tried with pfind (which turned out to be a "hard nut to crack" for me).

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Mon 04 Jun 2018, 20:31    Post subject:  

fredx181 wrote:
Hi wiak, thanks for the pfind convert, I can' t really compare with what I did because I was testing with newer version 6.3, but will look at it later (now busy with new BionicDog release, almost ready).

Fred


Ah sorry, I was careless not using new pfind. Point me to where it is and I'll convert it.

EDIT: I've looked at the DD github site but couldn't see Bionic repository with new one (EDIT2: found it). I have now downloaded pfind 6.3 deb from Bionic repo.

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

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

PostPosted: Tue 05 Jun 2018, 00:25    Post subject:  

EDIT: Please note that I missed a line in the pfind available in the download link below but Fred has found it for me. It is in script /usr/local/pfind/func inside menuitem() at the top of that code. The line in there needs changed to this:

Code:
<action>bash -c "echo '$2' > /tmp/pfind-tmp'$PROGPID'"</action>


As Fred says, that gets the right click action working on the menu list of found items (something like that anyway). Note that the bash -c (or sh -c) is required here because of the > redirection. A shell is needed to do redirection. end_of_EDIT

For my own use, and testing, I have now converted pfind 6.3 (from BionicDog repo) to use gtkwialog -b and thus work with underlying dash shell(for example on pristine Ubuntu or Debian) or busybox ash shell (e.g. on pristine Slitaz).

Had some trouble in getting it to work because needed the following format for if true, and if false action commandstrings (previously I had the bash -c stupidly at the very front here...):

Code:
<action>if true bash -c "echo true > '$WORKDIR'/ADVANCED_GUI_STATUS"</action>


Note that above quoting works when overall dialog is surrounded by single quotes. When it is surrounded by double quotes it is probably best (or at least I find it easier) to temporarily modify the dialog to use single quotes for the <action>commandstring line. That is:

Code:
"'<action>if true bash -c "echo true > '$WORKDIR'/ADVANCED_GUI_STATUS"</action>'"


I have a deb of my converted pfind package temporarily at the link below so fredx181 can test it, but note that this is not a release, official or unofficial, per say - pfind is not my program...

Please find fixed download provided by Fred a few posts down.

NOTE WELL: this will NOT work with legacy gtkdialog. You need gtkwialog installed on your system for this dash-or-ash-or-bash-capable version.

I don't in any case guarantee it is a perfect conversion. May need a few tweaks yet, though seems to work fine in my quick tests.

@fred: actually I've now PM'd you about this conversion so you can arrange what to do with it.

wiak

Last edited by wiak on Wed 06 Jun 2018, 13:40; edited 1 time in total
Back to top
View user's profile Send private message 
darry19662018

Joined: 31 Mar 2018
Posts: 224

PostPosted: Wed 06 Jun 2018, 06:17    Post subject:  

Hi Wiak,

I have installed this Gtkwialog in Racy 5.5 and removed the old pfind and installed your new modified one and it works. Pfind seems a lot faster using gtkwialog.
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Wed 06 Jun 2018, 06:54    Post subject:  

darry19662018 wrote:
Hi Wiak,

I have installed this Gtkwialog in Racy 5.5 and removed the old pfind and installed your new modified one and it works. Pfind seems a lot faster using gtkwialog.


It possibly will be a bit faster since not so many system calls to shell with the gtkwialog -b mode being used in that modified pfind.

Surprised it worked in Racy - good to know, thanks.

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


Joined: 11 Dec 2013
Posts: 3224
Location: holland

PostPosted: Wed 06 Jun 2018, 11:58    Post subject:  

Here's pfind_6.3_gtkwialog with the small fix for right-click menu included (see wiak's EDIT on top of his before last post)
https://fredx181.github.io/StretchDog/NoRepo/pfind_6.3_gtkwialog_all.deb

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Wed 06 Jun 2018, 13:54    Post subject:  

I have read a comment posted elsewhere that indirectly suggested that gtkwialog used with bash, when the underlying /bin/sh is dash is somehow in some way unsafe or prone to failure. That comment is false. Gtkwialog is simply more flexible than legacy gtkdialog in a way that allows it to be safely used by someone who prefers to use the more powerful bash programming language (no matter what the underlying system shell is).

Gtkwialog, in that sense, is simply a better Gtkdialog, which did prevent the use of many of bash's powerful features when underlying shell was the likes of dash or ash. Gtkwialog removes that limitation. Bash was designed for the purpose of writing more sophisticated scripts and there is nothing unsafe about bash (despite some using the word bashisms as an attack on a perfectly good language when used correctly via a bash interpreter, which gtkwialog, unlike gtkdialog, allows).

Neither code protectionism or jealousy are ever a good reason to attack developments and progress by others in that underhand negative and more than potentially misleading manner. If a person has no interest in this project, that is fine, but misleading others about its potential or value is not, which is more than just having a different opinion. Get your technical facts straight and correct (rather than twisted) if you are going to state them in that manner, for whatever your 'personal' reasons may be.

wiak (alias mcewanw - early developer with Toni and Fred of DebianDog family)
Back to top
View user's profile Send private message 
aaaaa


Joined: 22 May 2018
Posts: 20

PostPosted: Wed 06 Jun 2018, 14:28    Post subject:  

Hello wiak

I haven't used gtkwialog, but i read it adds improvements to gtkdialog

I think the changes can be safely added to gtkdialog. I was thinking of env variables.

For example, a script can be marked as GTKWIALOG by adding
Code:
#!/bin/sh
.
.
.
export GTKWIALOG=1


In gtkdialog itself, the code to determine if the new approach is to be used would be as simple as this:

Code:

#include <stdlib.h>

if (getenv("GTKWIALOG")) {
 GTKWIALOG=1;
}


This is just an idea i had..
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Wed 06 Jun 2018, 14:35    Post subject:  

Yes, these are alternatives to command argument mode switches, though I've no problem with the latter either.

Your suggestion is certainly better than the earlier multiple symlink suggestion IMO, but I'm lazy to have to export new variables to the environment, as and when mode change required, and prefer the command arg switches to be honest, which were also trivial to implement. The program works exactly as standard gtkdialog anyway if no switch to say otherwise put on the commandline. So it's all in a name in that sense really. I won't push gtkwialog if no one wants to use it anyway - just for my own fun in the end maybe, except that any such gtkdialog-like apps I write in the future will use it and any developments on my older apps.

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


Joined: 22 May 2018
Posts: 20

PostPosted: Wed 06 Jun 2018, 16:07    Post subject:  

So i read a bit more about the current situation, ok.

But it was just a suggestion, i myself don't care much about the fate of gtkdialog.

But i'd be tempted to use this patched version when the time is right (i.e. 2019).

You might to want add those lines anyway (getenv())

Ok, i read some previous comments, just want to reiterate that it's interesting. Now i know about the repo.

It's easy to sync both repos
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 5 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.0754s ][ Queries: 14 (0.0097s) ][ GZIP on ]