YAD - Tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#271 Post by seaside »

I have the same version-

Code: Select all

yad --version
0.38.1 (GTK+ 2.24.30)
After "create folder" is clicked and a name entered, a "tab" writes the new folder and returns the dialog to a "no selected directory" mode.

Or you could click on the dark section to the right of the entry.

The path of the new directory is returned in both cases.

Cheers,
s
(Not exactly my idea of intuitive :D )

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#272 Post by gyro »

@seaside,

Thanks.
I think "Enter" is more intuitive than "Tab", but that's life.
But, at least it's not just me.

@Geoffrey,
Thanks.
I'll try to give "0.36.3" a go to see if it is different for me.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#273 Post by gyro »

@Geoffrey and seaside,
gyro wrote:It all seems to work fine except when I use the "Create Folder" button. After typing in the name of the new folder I hit the "Enter" key, and nothing happens.
Using

Code: Select all

yad --version
0.36.3 (GTK+ 2.24.30)
The "Enter" key does what I expect. It causes the new directory to be accepted and it gets opened.
So the remaining question is, do any of the versions between 0.36.3 and 0.38.1 function "correctly"?

gyro

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#274 Post by Geoffrey »

gyro wrote:@Geoffrey and seaside,
gyro wrote:It all seems to work fine except when I use the "Create Folder" button. After typing in the name of the new folder I hit the "Enter" key, and nothing happens.
Using

Code: Select all

yad --version
0.36.3 (GTK+ 2.24.30)
The "Enter" key does what I expect. It causes the new directory to be accepted and it gets opened.
So the remaining question is, do any of the versions between 0.36.3 and 0.38.1 function "correctly"?

gyro
I'm most likely getting it wrong on what you want to do.

Code: Select all

INIT_DIR="$(pwd)"
RET_DIR=$(yad --center --borders=6 --title "dircrypt - Select encrypted directory" \
        --file --directory --width=600 --height=400 --filename="$INIT_DIR/") 
        
echo $RET_DIR
This works fine, create directory press enter or left mouse on new directory text to create and select directory,
OK button to confirm selected directory and continue to next script action, or Cancel button to abort.
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#275 Post by gyro »

Geoffrey wrote:I'm most likely getting it wrong on what you want to do.
Unfortunately, sort of yes.
I'm happy with the script code, as the rest of my script makes use of $RET_DIR.
My problem was with yad version 0.38.1, where the "Enter" key failed to do what I expected when using the "Create Folder" button in the select directory dialog.

Problem solved:
The "Enter" key works as expected in both yad version 0.36.3 and the recent 0.38.2.

@seaside,
Upgrade to yad 0.38.2 and the problem is fixed.

So the YAD tip is: avoid version 0.38.1

gyro

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#276 Post by Geoffrey »

gyro wrote:So the YAD tip is: avoid version 0.38.1
Yes, https://groups.google.com/forum/#!forum/yad-common
YAD 0.38.2 released

This is a bugfix release. One serious bug was fixed, update is highly recommended

Changes in this release:

- fix enter behavior
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#277 Post by gyro »

Geoffrey wrote:Buttons in --form --field are the width of the window

Code: Select all

yad --form --field="test1:FBTN" "yad --text='test1'" \
--field="test2:FBTN" "yad --text='test2'" \
--field="test3:FBTN" "yad --text='test3'"
Thanks for this example, I find such a column of buttons quite useful as a kind of menu with each button executing a corresponding script.

gyro

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#278 Post by step »

I see that some people are using YAD 0.38.2. I have upgraded too, from 0.36.3, but I think 0.38.2 bombs X11. Twice already I clicked a yad --entry dialog button and X11 crashed. The first time I found myself back at the console prompt, and had to restart X manually. The second time X restarted automatically. All this happened on Fatdog64-710.
My script involves closing the yad dialog with "kill -USR2 $YAD_PID", but I'm not positive this is connected to X11 crashing.

edited after vovchik's post below: X11 restarted again with yad 0.36.3, so this issue isn't version dependent. On to more investigation...
Last edited by step on Sun 05 Feb 2017, 12:37, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#279 Post by vovchik »

Dear step,

I am using the same version (0.38.2) and have not experienced your problem in Tahr, so I don't really think it is a "version" problem. I compiled YAD myself for Inetl and for my Raspberry PI. This runs fine on my various machines:

Code: Select all

#!/bin/bash

function CLOSE_EXIT()
{
    echo "Close and exit..."
    kill -s SIGUSR1 $YAD_PID
} ; export -f CLOSE_EXIT

yad  --text "<b>Simple Dialog</b>" --button="OK:bash -c CLOSE_EXIT"
With kind regards,
vovchik

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#280 Post by step »

Dear vovchik,

thank you. I'm using kill -USR1 in a similar fashion. I also don't think anymore that it's a "version" problem, because the X11 restart just happened again, this time with yad 0.36.3. I need to investigate further what's going on.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#281 Post by slavvo67 »

Code: Select all

	
yad --form --field="test1:FBTN" "yad --text='test1'" \
--field="test2:FBTN" "yad --text='test2'" \
--field="test3:FBTN" "yad --text='test3'"
Strangely, the above code just gives me the first box. Maybe it's my version of YAD? I'm using 37, which is I guess a bit dated now.....

Anyone?

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#282 Post by LazY Puppy »

Image
Attachments
Screenshot-2017-02-09-01-00-09.jpg
(41.67 KiB) Downloaded 641 times
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#283 Post by slavvo67 »

Works in terminal but not as a script written via Geany and saved as an executable file. Anyone? Very strange to me...

More strange, it works now but this way:

yad --form --field="test1:FBTN" "yad --text='test1'" --field="test2:FBTN" "yad --text='test2'" --field="test3:FBTN" "yad --text='test3'"

Why does yad have to be typed over and over? I don't get it...

For some strange reason, when it's all one line; it works. When lines are separated with the \ and continued on the next line.... she doesn't work for me....

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#284 Post by Geoffrey »

slavvo67 wrote:Works in terminal but not as a script written via Geany and saved as an executable file. Anyone? Very strange to me...

More strange, it works now but this way:

yad --form --field="test1:FBTN" "yad --text='test1'" --field="test2:FBTN" "yad --text='test2'" --field="test3:FBTN" "yad --text='test3'"

Why does yad have to be typed over and over? I don't get it...

For some strange reason, when it's all one line; it works. When lines are separated with the \ and continued on the next line.... she doesn't work for me....
yad --text='test1' is the sample function of yad --form --field="test1:FBTN", it displays a yad window with the text "test1" for the buttons field that's all, it can be any function you like

LazY Puppy try a more recent yad version.

Code: Select all

#! /bin/bash
yad --form --field="test1:FBTN" "yad --text='test1'" \
--field="test2:FBTN" "yad --text='test2'" \
--field="test3:FBTN" "yad --text='test3'"
This in a bash script works for me
Attachments
yad-field-buttons.jpg
(36.72 KiB) Downloaded 619 times
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#285 Post by gyro »

From my memory of reading the changelog, the FBTN feature was introduced at version 0.26.0

Yad tip: To use the FBTN feature, use yad >= 0.26.0

Real example:
The main screen of "dircrypt", http://www.murga-linux.com/puppy/viewtopic.php?t=109598.

gyro

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#286 Post by slavvo67 »

I'm running 37.0 but sometimes Victor breaks a version when implementing new things.... Maybe I'll upgrade again ....


Thanks

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#287 Post by slavvo67 »

Is there any way to pass the drag and drop to the next part of the script without requiring the ok box to be clicked? The no buttons option does not advance unless you close the actual window....

Thank you

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#288 Post by MochiMoppel »

slavvo67 wrote:Is there any way to pass the drag and drop to the next part of the script without requiring the ok box to be clicked?
Which "ok box"? You should place the "next part" before the yad statement as a function:

Code: Select all

function myfunction {
	Xdialog --msgbox "You dropped\n$0" x
}
export -f myfunction

yad --width=200 --height=200 --dnd --command="bash -c 'myfunction'"

stemsee

#289 Post by stemsee »

solved!

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#290 Post by step »

Hi all, the conversation that we started, near page 16, about a drag-and-drop script has grown into yet-another script here --> screenshot.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

Post Reply