Page 14 of 42
Posted: Tue 08 Nov 2016, 19:42
by vovchik
Dear Misko,
Very nice, and nicely coded. I just added a bit of eye candy.
With kind regards,
vovchik
Posted: Wed 09 Nov 2016, 09:53
by vovchik
Dear all,
Here is a little YAD-based task killer. I found most of the code somewhere and modded it a bit. It's not too bad, but it is not the fastest thing in the world. It seems to work.
With kind regards,
vovchik
Posted: Thu 10 Nov 2016, 03:47
by misko_2083
vovchik wrote:Dear Misko,
Very nice, and nicely coded. I just added a bit of eye candy.
With kind regards,
vovchik
Vovchik, it looks great.
Just found this for the .bashrc
similar to this
http://worldwidemann.com/a-gui-file-pic ... s-of-code/
Code: Select all
# Yad gui file selector
# put in .bashrc and call with ctrl+g from terminal
select_files() {
local file files i IFS=' '
local -n l=READLINE_LINE p=READLINE_POINT
while IFS= read -rd '' file; do printf -v 'files[i++]' %q "$file"
done < <(yad --file --multiple --width=600 --height=600 --center | tr '|\n' '\0\0')
files="${files[*]}" l=${l:0:p}$files${l:p} p=$((p+${#files}));
}
bind -x '"\C-g":select_files'
Regards
Posted: Thu 10 Nov 2016, 10:14
by vovchik
Dear Misko,
Thanks. It's very compact and convenient, and available everywhere.
With kind regards,
vovchik
Posted: Thu 10 Nov 2016, 23:46
by step
My bash shell returns an error when parsing Misko's script - but I can't find a syntax error anywhere in it. Anyone with the same problem?
Code: Select all
sh: syntax error near unexpected token `<'
That's the "<" before "<("
Code: Select all
# bash --version
GNU bash, version 4.3.42(1)-release (x86_64-unknown-linux-gnu)
Posted: Sat 12 Nov 2016, 08:22
by MochiMoppel
step wrote:My bash shell returns an error when parsing Misko's script - but I can't find a syntax error anywhere in it. Anyone with the same problem?
Code: Select all
sh: syntax error near unexpected token `<'
That's the "<" before "<("
Even without looking into the script the error message is obvious: "<(" would be a bash
process substitution which is not available when you invoke bash in POSIX mode. i.e. with a
#!/bin/sh shebang.
Use
#!/bin/bash instead.
Posted: Sat 12 Nov 2016, 19:33
by step
MochiMoppel wrote:pocess substitution which is not available when you invoke bash in POSIX mode. i.e. with a #!/bin/sh shebang.
Use #!/bin/bash instead.
Thanks MochiMoppel. Actually, I was pasting the code directly into terminal, so there was no shebang involved. But I'm pretty sure you hit the nail on its head. There are other ways to enable POSIX mode, so I'll check my setup to ensure that POSIX is disabled.
Posted: Mon 05 Dec 2016, 09:08
by april
I have one I want to get going but don't know how .
I'm after a form that comes up with say 8 fields on one line and then the next line down is the same but a different background colour.
Multiple lines , say 1000 and scrolling . Ability to work through each field in order and enter takes it to the next line.
Now it is needed to look exactly like a bank statement and have the same data fields as date number details code debit credit balance and presented(T/F).
If anyone knows Quickbooks I want it to look just like one of their bank entry forms
Anyone ever done similar?
Posted: Sun 22 Jan 2017, 17:46
by gyro
I've just discovered yad and I'm trying to use it for a little project I'm working on,
but I have a problem.
I'm using the following code to select a directory:
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/")
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. I expect it to cause the new folder name to be accepted.
I'm doing this on puppy_xenial_7.0.4 using
Code: Select all
yad --version
0.38.1 (GTK+ 2.24.30)
(I downloaded and compiled it.)
Has anyone had a similar problem?
Is it likely to be a bug in this particular version?
Note1: All my other yad dialogs seem to work as expected.
Note2: Before "discovering" yad, I wrote a gtk C program to do the same thing, calling the builtin gtk_file_chooser_dialog. It looks rather similar, except that the "Enter" key works after naming a new folder.
gyro
Posted: Sun 22 Jan 2017, 23:39
by Geoffrey
gyro, works ok for me with yad
Code: Select all
yad --version
0.36.3 (GTK+ 2.24.23)
yeah the new folder is created by either a mouse click or enter key, the button's do nothing, they need to be give an action
Code: Select all
INIT_DIR="$(pwd)"
RET_DIR=$(yad --center --borders=6 --title "dircrypt - Select encrypted directory" \
--button="gtk-ok:0" --button="gtk-cancel:1" --file --directory --width=600 --height=400 --filename="$INIT_DIR/")
[[ $? -eq 0 ]] && SOME_ACTION
[[ $? -eq 1 ]] && SOME_OTHER_ACTION
Posted: Mon 23 Jan 2017, 01:32
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
)
Posted: Mon 23 Jan 2017, 03:08
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
Posted: Mon 23 Jan 2017, 05:56
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
Posted: Mon 23 Jan 2017, 07:06
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.
Posted: Mon 23 Jan 2017, 21:23
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
Posted: Mon 23 Jan 2017, 22:31
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
Posted: Tue 24 Jan 2017, 00:50
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
Posted: Sun 05 Feb 2017, 10:18
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...
Posted: Sun 05 Feb 2017, 11:05
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
Posted: Sun 05 Feb 2017, 12:35
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.