YAD - Tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#781 Post by fredx181 »

@misko
Fredx, If you move the current time to the window title bar, can you think of anything that you would use the first tab for?
Thanks, on itself it's nice, but I'm not sure about it because on my setup the text in the title bar is moving so much (probably depends on font type used for title bar, if it would be Monospace type it should be ok)

@vovchik
I like the idea of the current time in the window bar. As for the empty area, what about a checkbox (relative time) and spinbox for relative time-setting (i.e. in fifteen mintues)?
Something to keep in mind, thanks.

@Argolance
I had fun internationalizing the first version.... Maybe a little too soon?
Yes probably :wink:
As for the empty area, what about a checkbox (relative time) and spinbox for relative time-setting (i.e. in fifteen mintues)?

Sorry, I do not understand what you mean.
I think vovchik refers to misko's example where the top part of the GUI is sort of useless (as current time is already displayed on title bar) and can be used for some other options like spinbox for setting relative time (e.g. alarm after 15 min).

Fred

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#782 Post by Argolance »

Bonsoir,
Thank you!
Right click menu doesn't seem to work here.
IMO, self containing is great from a coding point of view but less from a visual point of view.
May I make a suggestion: I think that the window title: Alarm, the head text "S e t A l a r m" and the button text "Set alarm" are redundant. "S e t A l a r m" as window title, no "S e t A l a r m" before current time and just OK for the button?
And what about "aplay" and "/usr/share/audio/2barks.wav" as defaults?

Cordialement.
Attachments
191130_192142_619x168_easyshot.jpg
(14.63 KiB) Downloaded 370 times

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#783 Post by fredx181 »

Argolance wrote:Right click menu doesn't seem to work here.

Strange... works for me, could it be because you directly paste the code in terminal ?
Then it doesn't work because of the menu code contaning "!"
IMO, self containing is great from a coding point of view but less from a visual point of view.
My reason to like self containing in general is because it works OOTB copying the code into a script and run it without needing extras.
But we can make later on a .pet containing icons with your setup of course.
May I make a suggestion: I think that the window title: Alarm, the head text "S e t A l a r m" and the button text "Set alarm" are redundant. "S e t A l a r m" as window title, no "S e t A l a r m" before current time and just OK for the button?
Yes, fine for me.
And what about "aplay" and "/usr/share/audio/2barks.wav" as defaults?
Not sure, aplay cannot play all audio types (2barks.wav should be ok, although not available in all systems)

Fred

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#784 Post by Argolance »

could it be because you directly paste the code in terminal ?
Then it doesn't work because of the menu contaning "!"
Sorry, yes it is! :wink:
But we can make later on a .pet containing icons with your setup of course.
I don't particularly like "my" icons but I find that the red circles are less explicit: you can't guess what it is, it could be any other warning. IMO, it's not slight enough (I mean a bit too noticeable) and we don't know what it's about.
Not sure, aplay cannot play all audio types (2barks.wav should be ok, although not available in all systems)
Not sure simple user know where and how to find/type any other player than mplayer which may not be present on all Puppies. Select one of the players installed on the system and listed in the box (using the command "which" or something else)?
Regarding the famous Puppy "waw waw", I was convinced that it was present on all puppies... :?

Something else: repeat value=0 > repeat endlessly?

Cheers!

Cordialement.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#785 Post by fredx181 »

Hi all, Re: alarm script, just to let you know, I'm struggling :wink: with it, trying to keep support for multiple alarms set and at the same time adding extra options, such as canceling and stopping the alarm (from tray) makes it extra complicated, but I'll probably come up with something within the next days (including some suggestions, thanks Argolance).

Fred

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#786 Post by Argolance »

@fredx181
See you soon and good luck! :)

User avatar
misko_2083
Posts: 114
Joined: Tue 08 Nov 2016, 13:42

#787 Post by misko_2083 »

fredx181 wrote:Hi all, Re: alarm script, just to let you know, I'm struggling :wink: with it, trying to keep support for multiple alarms set and at the same time adding extra options, such as canceling and stopping the alarm (from tray) makes it extra complicated, but I'll probably come up with something within the next days (including some suggestions, thanks Argolance).

Fred
Well, you could try "at" command instead of sleep.
That at daemon survives reboot even.

Code: Select all

at -l       # will list pending jobs (or atq)
at -r <num> # will remove job <num>  (or atrm)
Vovchik, relative time is a good idea.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#788 Post by Argolance »

misko_2083 wrote:Vovchik, relative time is a good idea.
I asked above what this means: "relative" time? :roll:

User avatar
misko_2083
Posts: 114
Joined: Tue 08 Nov 2016, 13:42

#789 Post by misko_2083 »

@Agrolemon, At Sunset, at dawn, at full moon, tomorrow afternoon, at lunchtime, when the fat lady sings...
Well, something like that :lol:

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#790 Post by Argolance »

@misko_2083
Don't laugh: I didn't understand because in French, the word "relative" can be understood as the opposite of "absolute" whereas in English, it means "which is related to"! :D
We call them false or fake friends! :wink:
Cheers.

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

#791 Post by vovchik »

Dear argolance et al.,

Here is a version using your icon style - but as a self-contained tiny svg. What do you think?

With kind regards,
vovchik
Attachments
yadalarm-tray-argolance.tar.gz
(2.1 KiB) Downloaded 137 times

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#792 Post by Argolance »

Bonsoir,
vovchik wrote: What do you think?
I think it's all good, using these icons or any others! 8)
Thank you a lot.
The fact that the icons are contained in the script itself is a real plus. As fredx181 points out, it works "out of the box"! I thought the possible forms were limited, but I was wrong.
On my side, just for fun, I played with the script - this lets me to better understand how yad works - and possible icon themes (... that maybe be changed into svg files?)

Cordialement.
Attachments
191201_165429_604x449_easyshot.jpg
(34.5 KiB) Downloaded 237 times
191201_161402_639x263_easyshot.jpg
(21.28 KiB) Downloaded 237 times
191201_155608_647x665_easyshot.jpg
(59.84 KiB) Downloaded 238 times

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#793 Post by fredx181 »

Very nice, Argolance and vovchik !! 8) , looks like you have a similar degree of obsession with this as I have :lol:

Fred

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

#794 Post by vovchik »

Dear all,

Here is the script with a throbbing alarm bell svg. :)

With kind regards,
vovchik
Attachments
yadalarm-tray-bell.tar.gz
(2.61 KiB) Downloaded 131 times

User avatar
misko_2083
Posts: 114
Joined: Tue 08 Nov 2016, 13:42

#795 Post by misko_2083 »

Argolance wrote:@misko_2083
Don't laugh: I didn't understand because in French, the word "relative" can be understood as the opposite of "absolute" whereas in English, it means "which is related to"! :D
We call them false or fake friends! :wink:
Cheers.
English, French are two crazy languages in which the pronunciation doesn't match the written word. :lol:

Freddie "at" command?

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#796 Post by fredx181 »

A L A R M !! :lol: :lol:
Image

Hi, no need to be alarmed :wink: it's just about a new alarm script (attached) with changes and improvements.
Mostly focused on being able to cancel and stop the alarm even in case of multiple alarms.
Also tried putting together the ideas and suggestions into it, e.g.
- Repeat can be set to 0, which means infinite
- Tray icon will change from "waiting" icon to "running" icon when the alarm sound starts playing.
- The alarm can be shut off (once running) by right-click the icon > Stop alarm and exit tray
- The GUI a little changed
@Argolance, would be nice if you change to your liking and share (the big alarm clock icon you showed is nice), if you want of course.
Note in case you will translate, there's one function depending on "Set to" phrase: Alarm is running in the background... Set to $hr:$mn Changing "Set to" may make canceling fail. (don't know if is important, just mentioning)
@misko, thanks for "at" recommendation, maybe comes in handy for later.
@vovchik, I initially wanted to use your .svg icon setup with the "Argolance" icons, but found that on one of my systems, they show as empty (transparent) image, any idea why ?
EDIT: Few minutes later, re-attached, made small change on the GUI.

EDIT 2019-12-05: Canceling from tray needed a fix, should work now, re-attached.
See also here:
http://murga-linux.com/puppy/viewtopic. ... 88#1043688

Fred
Attachments
yalarm.tar.gz
yad alarm updated 2019-12-05 , extract and run yalarm
(2.73 KiB) Downloaded 176 times
2019-12-02-184318_680x179_scrot.png
yalarm
(31.5 KiB) Downloaded 835 times
Last edited by fredx181 on Thu 05 Dec 2019, 10:37, edited 1 time in total.

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

#797 Post by vovchik »

Dear Fred,

Good question why the argolance SVGs show up blank on that machine. Is in a compositing "feature" or alpha-channel problem with the Xorg? I've not experienced it before, but it could be that the gdk_pixbuf_loader (which normally handles icon loading within gtk progs) on that system only partially supports svgs, or the yad there was compiled without cairo? I am just speculating.... Weird.

With kind regards,
vovchik

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#798 Post by fredx181 »

Hi vovchik, just for info, it's on the same computer, same yad version, but diiferent Debian version (Buster, on Stretch it works fine), it's not only with yad, btw, with viewnior (image viewer) its shows empty too.
All the other "pre-made" .svg's from you are showing correctly on Buster, btw. Weird indeed... Not a complaint or big problem, just like to understand why. I'll test some more later.

Fred

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#799 Post by Argolance »

Hello,
Thank you fredx181!
Sorry I didn't answer earlier, but I wasn't home.

Code: Select all

(yad:12506): GLib-WARNING **: g_strcompress: trailing \
I saw somewhere on the web that this warning is a result of wrong command line which must be escaped in a bash fashion. :roll:
When I cancel tray and exit from the right click menu, the systray icon is closed but the process not... and the bells ring!
As for internationalization, this time I'll wait a little while for the script to be fully finalized. :wink:

[EDIT] Additional question:
Now, to understand how YAD works (for me it is still largely mysterious because the logic is very "special"...), how to move the Set command

Code: Select all

'bash -c "alrm %1 %2 %3 %4 %5 %6 %7 %8 %9"'
to a usual "OK" button placed down the window, close to a "Cancel" one?

Thanks.
Cordialement.

Cordialement.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#800 Post by fredx181 »

Hi Argolance,
(yad:12506): GLib-WARNING **: g_strcompress: trailing \
Yes, thats because of a small mistake I made in the yad code, part of the GUI code at the bottom should be this:

Code: Select all

yad --plug="$$" --tabnum=1 --form --cycle-read --columns=2 --field="\t\t\t\t\Current Time:\t\t: " --field="               \t\t\t\t\t\t:lbl" &
(without extra \ after \t\t\t\t\t\t)
But it's just a warning, as far as I know it doesn't affect how things work.
When I cancel tray and exit from the right click menu, the systray icon is closed but the process not... and the bells ring!
Strange... works ok for me, I guess you mean right-click on the "waiting" icon and "Cancel Alarm and Exit tray"
I tested just now in Xenialpup also and works well for me.
Could be that you edited things in script (e.g. for translation) ?
Now, to understand how YAD works (for me it is still largely mysterious because the logic is very "special"...), how to move the Set command
Code:
'bash -c "alrm %1 %2 %3 %4 %5 %6 %7 %8 %9"
to a usual "OK" button placed down the window, close to a "Cancel" one?
Yeah, sure,"special", it should be possible to move the Set button to a usual "OK" button placed down the window, but then it will close the dialog (which I prefer not to) and also requires a completely different setup AFAIK to get all the variables from the fields.

EDIT:
but then it will close the dialog
that may be wrong :?:

Fred
Last edited by fredx181 on Wed 04 Dec 2019, 19:10, edited 1 time in total.

Post Reply