Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

READ-ONLY-MODE: PLEASE DO NOT POST NEW STUFF!
  New Forum: http://forum.puppylinux.com
 
 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 Wed 12 Aug 2020, 12:19
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
YAD - Tips
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 43 of 56 [838 Posts]   Goto page: Previous 1, 2, 3, ..., 41, 42, 43, 44, 45, ..., 54, 55, 56 Next
Author Message
Wognath

Joined: 19 Apr 2009
Posts: 424

PostPosted: Mon 05 Aug 2019, 14:31    Post subject: accept input at timeout  

Hello,
Can yad accept input at timeout, without hitting enter or OK? Like this:
Code:
z=`Xdialog --timeout 5 --interval 5000 --stdout --inputbox "Enter a number and wait" 0 0` ; echo $z

Sorry if the answer is somewhere in this long thread; I looked Shocked Thanks in advance
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1352

PostPosted: Mon 05 Aug 2019, 15:22    Post subject:  

I don't think it can but I'll be happy to stand corrected. There's an --always-print-result option, but the yad manual says
Quote:

--always-print-result
Print result for any of the return codes. This options doesn't work if timeout was reached or Escape was pressed.

_________________
Fatdog64-810|+Packages|Kodi|gtkmenuplus
Back to top
View user's profile Send private message 
phat7

Joined: 05 Jun 2015
Posts: 184

PostPosted: Wed 07 Aug 2019, 04:26    Post subject: Re: accept input at timeout  

Wognath wrote:
Can yad accept input at timeout, without hitting enter or OK? Like this:
Code:
z=`Xdialog --timeout 5 --interval 5000 --stdout --inputbox "Enter a number and wait" 0 0` ; echo $z

Nice
Back to top
View user's profile Send private message 
Wognath

Joined: 19 Apr 2009
Posts: 424

PostPosted: Sat 10 Aug 2019, 14:33    Post subject:  

SIGUSR1: Close dialog with 0 exit code. Very Happy
Code:
 yad --entry > /tmp/z & sleep 5 ; pkill -SIGUSR1 yad ; z=$(</tmp/z)

If more than one yad running:
Code:
yad --title unique    ...    pkill -SIGUSR1 -f "yad.*unique"
Back to top
View user's profile Send private message 
phat7

Joined: 05 Jun 2015
Posts: 184

PostPosted: Sun 11 Aug 2019, 01:53    Post subject:  

Code:
z=$(yad --entry & sleep 5 ; pkill -SIGUSR1 yad)


This may work even better:
Code:
z=$(timeout -s SIGUSR1 5 yad --entry)
Back to top
View user's profile Send private message 
misko_2083


Joined: 08 Nov 2016
Posts: 114

PostPosted: Mon 12 Aug 2019, 12:35    Post subject:  

fredx181 wrote:
misko_2083 wrote:
Fredx181, if you want to make one, even simpler version of yradio,
you can use the list for navigation between the radio categories and stations.

Here's an example with the notification icon.


Hey Misko, thanks anyway, but I have no idea how to implement your code in yradio, if you feel like it sometime, maybe you want to do it ?
(also I'm not sure if I understand what the improvement exactly can be Rolling Eyes , but it sounds promising what you're suggesting )

Fred

Sorry for the late reply. I'm too lazy. It's so hot these days.
Tried it and it didn't go as I planed.

Yad versions are kicking off.
Current is 4.1
In the meantime yad switched to gtk3, entry is deprecated...

https://groups.google.com/forum/#!forum/yad-common
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4481
Location: holland

PostPosted: Mon 12 Aug 2019, 14:43    Post subject:  

misko_2083 wrote:
fredx181 wrote:
misko_2083 wrote:
Fredx181, if you want to make one, even simpler version of yradio,
you can use the list for navigation between the radio categories and stations.

Here's an example with the notification icon.


Hey Misko, thanks anyway, but I have no idea how to implement your code in yradio, if you feel like it sometime, maybe you want to do it ?
(also I'm not sure if I understand what the improvement exactly can be Rolling Eyes , but it sounds promising what you're suggesting )

Fred

Sorry for the late reply. I'm too lazy. It's so hot these days.
Tried it and it didn't go as I planed.

Yad versions are kicking off.
Current is 4.1
In the meantime yad switched to gtk3, entry is deprecated...

https://groups.google.com/forum/#!forum/yad-common


No problem, dear misko ! , I'm lazy too these days,, btw Smile
Very, very disappointed Crying or Very sad about the latest yad development, I always liked the choice for the gtk2 version, seems now that v0.41 is the last one supporting it.

Fred

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


Joined: 08 Nov 2016
Posts: 114

PostPosted: Tue 13 Aug 2019, 04:38    Post subject:  

fredx181 wrote:

No problem, dear misko ! , I'm lazy too these days,, btw Smile
Very, very disappointed Crying or Very sad about the latest yad development, I always liked the choice for the gtk2 version, seems now that v0.41 is the last one supporting it.

Fred

Well things have to go forward. Even if they work perfectly.
Xfce 4.14 is now out and ported to gtk3.

Thing about yad that is going to be difficult is theming.
Latest requires gtk 3.22, and since version 3.20 themes have to be ported from 3.18.
Back to top
View user's profile Send private message 
Wognath

Joined: 19 Apr 2009
Posts: 424

PostPosted: Tue 13 Aug 2019, 11:49    Post subject:  

phat7 wrote:
Code:
z=$(timeout -s SIGUSR1 5 yad --entry)
Compact and works perfectly. Thanks!
Back to top
View user's profile Send private message 
phat7

Joined: 05 Jun 2015
Posts: 184

PostPosted: Thu 15 Aug 2019, 23:03    Post subject:  

Wognath wrote:
phat7 wrote:
Code:
z=$(timeout -s SIGUSR1 5 yad --entry)
Compact and works perfectly. Thanks!
You’re welcome. May I ask how you want to use it? I can not imagine a situation when such timeout is useful. Perhaps drag and drop?
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3822
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 16 Aug 2019, 03:55    Post subject:  

Bonjour,
Just for info:
Arrow A handy script for translations... using yad. Smile

Cheers.

_________________

Puppy Search
Back to top
View user's profile Send private message Visit poster's website 
Wognath

Joined: 19 Apr 2009
Posts: 424

PostPosted: Fri 16 Aug 2019, 14:38    Post subject:  

phat7 wrote:
May I ask how you want to use it?

I forget to hit enter, or I'm too lazy to click OK Sad I have been using Xdialog --timeout --interval, would have been surprised if yad could not do the same--although it required some reading between the lines.
Code:
suspend; z=$(timeout -s SIGUSR1 5 yad --text "enter password" --entry --no-buttons) ; if correct then resume else log out

z=$(timeout -s SIGUSR1 5 yad --text "Shut down and save, or..." --form --field "No save":CHK --field "Reboot":CHK) ; case $z in...
Back to top
View user's profile Send private message 
misko_2083


Joined: 08 Nov 2016
Posts: 114

PostPosted: Fri 16 Aug 2019, 15:36    Post subject:  

Wognath wrote:
phat7 wrote:
May I ask how you want to use it?

I forget to hit enter, or I'm too lazy to click OK Sad I have been using Xdialog --timeout --interval, would have been surprised if yad could not do the same--although it required some reading between the lines.
Code:
suspend; z=$(timeout -s SIGUSR1 5 yad --text "enter password" --entry --no-buttons) ; if correct then resume else log out

z=$(timeout -s SIGUSR1 5 yad --text "Shut down and save, or..." --form --field "No save":CHK --field "Reboot":CHK) ; case $z in...

yad has an option:
Code:
yad --text "Shut down and save, or..." --form --field "No save":CHK --field "Reboot":CHK --timeout=5  --timeout-indicator=bottom
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4481
Location: holland

PostPosted: Fri 16 Aug 2019, 16:10    Post subject:  

misko_2083 wrote:
yad has an option:
Code:
yad --text "Shut down and save, or..." --form --field "No save":CHK --field "Reboot":CHK --timeout=5 --timeout-indicator=bottom


That doesn't give any output for me without clicking OK (which is where this is all about)

@All , note that the "timeout" command can probably be a symlink to busybox on Puppy and there's difference between busybox versions, see radky's and mochimoppels's comments here:
http://murga-linux.com/puppy/viewtopic.php?p=1031680#1031680
http://murga-linux.com/puppy/viewtopic.php?p=1031795#1031795

Fred

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


Joined: 08 Nov 2016
Posts: 114

PostPosted: Fri 16 Aug 2019, 19:38    Post subject:  

fredx181 wrote:
misko_2083 wrote:
yad has an option:
Code:
yad --text "Shut down and save, or..." --form --field "No save":CHK --field "Reboot":CHK --timeout=5 --timeout-indicator=bottom


That doesn't give any output for me without clicking OK (which is where this is all about)

@All , note that the "timeout" command can probably be a symlink to busybox on Puppy and there's difference between busybox versions, see radky's and mochimoppels's comments here:
http://murga-linux.com/puppy/viewtopic.php?p=1031680#1031680
http://murga-linux.com/puppy/viewtopic.php?p=1031795#1031795

Fred

Well patch it.
in src/main.c find timeout_cb function
and add the call to function yad_print_result () before yad_exit ()

This is an example with 0.41 with added yad_print_result function
Code:

static gboolean
timeout_cb (gpointer data)
{
  static guint count = 1;
  GtkWidget *w = (GtkWidget *) data;

  if (options.data.timeout < count)
    {
      yad_print_result ();
      yad_exit (YAD_RESPONSE_TIMEOUT);
      return FALSE;
    }

  if (w)
    {
      gdouble percent = ((gdouble) options.data.timeout - count) / (gdouble) options.data.timeout;
      gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (w), percent);
      if (g_settings_get_boolean (settings, "show-remain"))
        {
          gchar *lbl = g_strdup_printf (_("%d sec"), options.data.timeout - count);
          gtk_progress_bar_set_text (GTK_PROGRESS_BAR (w), lbl);
          g_free (lbl);
        }
    }

  count++;

  return TRUE;
}

Then compile, and try:
Code:
 yad --text "Shut down and save, or..." --form --field "No save":CHK --field "Reboot":CHK --timeout=5 --timeout-indicator=bottom

Wink
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 43 of 56 [838 Posts]   Goto page: Previous 1, 2, 3, ..., 41, 42, 43, 44, 45, ..., 54, 55, 56 Next
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. 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.1518s ][ Queries: 12 (0.0924s) ][ GZIP on ]