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 Wed 20 Aug 2014, 04:52
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Countdown to Action - GUI timer
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
stu90


Joined: 25 Feb 2010
Posts: 1401
Location: England. Dell Inspiron 1501. Dpup

PostPosted: Mon 20 Jun 2011, 12:33    Post_subject:  Countdown to Action - GUI timer  

[Admin note: the posts in this thread were moved from this thread.]
Hi L18L,
Sorry for not replying sooner Embarassed

I got side tracked with another little yad project 'Countdown to Action' (circumstance permitting your input would be greatly appreciated)

No biggie with the font selection - your original fc-list update has been working ok for me. - i think urxvtset has turned out pretty sweet considering it was only a few input boxes to start with. Smile

thanks for help.
countdown.gz
Description 
gz

 Download 
Filename  countdown.gz 
Filesize  770 Bytes 
Downloaded  251 Time(s) 

Edited_time_total
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Mon 20 Jun 2011, 14:21    Post_subject: Countdown to Action
Sub_title: input
 

Hi stu90
you wrote:
I got side tracked with another little yad project 'Countdown to Action' (circumstance permitting your input would be greatly appreciated)

I have installed 'Countdown to Action' and at first run I had some problems.
Code:
# ./cou*
Countdown: 0,000000 minutes
Execute: urxvt
rxvt: unable to calculate font width for 'Dingbats:style=Regular:pixelsize=16:minspace=True', ignoring.
rxvt: unable to load base fontset, please specify a valid one using -fn, aborting.
#

Having changed the font to Fixed Bold it was OK.
So I am thinking there is a bug with Dingbats.
Or why is it rxvt instead of urxvt???

What input are you expecting?
-Date?
-Drag and drop for Execute?
-Editable Combobox ?
-Passing the task to cronjob?
Everything seems to be possible.

Cheers
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Mon 20 Jun 2011, 15:40    Post_subject: Countdown to Action  

v 0.2
Code:
#!/bin/bash

TITLE="Countdown To Action"
VERSION="0.2"
ICON="/usr/share/pixmaps/yad.png"
TEXT="<b>Enter Time \nto countdown\nbefore Action. </b> "
TIME=`date +%H:%M`
DATE=`date +%Y-%m-%d`


 ### GUI countdown - action ###
 
  COUNTDOWN=$(yad --title="$TITLE $VERSION" --text="$TEXT" --image=/usr/share/pixmaps/away.png \
 --form --separator=" " \
 --field="Minutes":NUM "0!0..59" \
 --field="Hours":NUM "0!0..23" \
 --field="Action" "urxvt" )

echo $COUNTDOWN
  if [ "$COUNTDOWN" = "" ];then
  echo "Exiting" && exit
  else
  ## get minutes ##
  MINS=`echo $COUNTDOWN | cut -d" " -f1 | cut -d "." -f1 | cut -d "," -f1`
  echo "Countdown: $MINS minutes"

  ## get hours ##
  HOURS=`echo $COUNTDOWN | cut -d" " -f2 | cut -d "." -f1 | cut -d "," -f1`
  echo "Countdown: $HOURS hours"

  ## get new action ##
#  SETACTION=`echo $COUNTDOWN | cut -d" " -f2-`
  SETACTION=`echo $COUNTDOWN | cut -d" " -f 3`
  [[ ! "$SETACTION" ]] && yad --title="$TITLE Info" --text=" Make sure to add an Action to perform " && echo "Exiting" && exit
  echo "Execute: $SETACTION "
 
  TIMER=`echo $(($MINS*60))`
 
  ASTART=`date | cut -d" " -f-4`
 
  exec 3> >(yad --notification  --image="$ICON" --listen)
  echo tooltip: "Countdown action will be performed in $MINS minutes time from <b>$ASTART</b> " >&3
  sleep $TIMER
  exec 3>&-

 ### 10 seconds to cancel action ###
(
   echo "99" ; sleep 1
   echo "90" ; sleep 1
   echo "80" ; sleep 1
   echo "70" ; sleep 1
   echo "60" ; sleep 1
   echo "50" ; sleep 1
   echo "40" ; sleep 1
   echo "30" ; sleep 1
   echo "20" ; sleep 1
   echo "10" ; sleep 1 ) |
#  yad --progress --title="$TITLE $VERSION" --text=" Your action will executed in 10 seconds.\n <b>To abort click cancel!</b> " \
#  --percentage=0 --auto-close --auto-kill
  yad --progress --title="$TITLE $VERSION" --text=" Your action will executed in 10 seconds.\n To abort click cancel! " \
  --percentage=0 --auto-close --auto-kill
  if [ "$?" = -1 ] ; then
  yad --error --text=" Aborted by user! "
  fi
  ### action to execute ###
  echo $SETACTION startet.
  time eval $SETACTION
 
fi
exit
count_action.png
 Description   -
 Filesize   9.29 KB
 Viewed   1542 Time(s)

count_action.png

Back to top
View user's profile Send_private_message 
stu90


Joined: 25 Feb 2010
Posts: 1401
Location: England. Dell Inspiron 1501. Dpup

PostPosted: Tue 21 Jun 2011, 07:26    Post_subject: Re: Countdown to Action  

L18L wrote:
v 0.2


Hi L18L,
Great update on Countdown to Action - perhaps we should start a new thread for this application?

My own need for it is to turn off my laptop when downloading torrents so as not to use up all my internet allowance.

I already though of another idea though as a PC/internet timer for parents - probably won't fool any of the older more savy kids who could kill its process but should work ok for younger kids with timedown progress window set to no buttons and borderless to stop them from canceling it. Smile

thanks.
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Tue 21 Jun 2011, 08:42    Post_subject: Re: Countdown to Action  

Hi stu90,
you wrote:
My own need for it is to turn off my laptop when downloading torrents so as not to use up all my internet allowance.

I already though of another idea though as a PC/internet timer for parents - probably won't fool any of the older more savy kids who could kill its process but should work ok for younger kids with timedown progress window set to no buttons and borderless to stop them from canceling it. Smile

why not just
Code:
wget http://....... && shutdown


timer,
there is /usr/local/pschedule
parents,
kid should use wary112 (unprivileged user fido)

Sorry, I do not see a reason to reinvent these wheels at the moment. Wink
Back to top
View user's profile Send_private_message 
stu90


Joined: 25 Feb 2010
Posts: 1401
Location: England. Dell Inspiron 1501. Dpup

PostPosted: Tue 21 Jun 2011, 09:16    Post_subject: Re: Countdown to Action  

L18L wrote:
Hi stu90,
you wrote:
My own need for it is to turn off my laptop when downloading torrents so as not to use up all my internet allowance.

I already though of another idea though as a PC/internet timer for parents - probably won't fool any of the older more savy kids who could kill its process but should work ok for younger kids with timedown progress window set to no buttons and borderless to stop them from canceling it. Smile

why not just
Code:
wget http://....... && shutdown


timer,
there is /usr/local/pschedule
parents,
kid should use wary112 (unprivileged user fido)

Sorry, I do not see a reason to reinvent these wheels at the moment. Wink


You can use wget to download torrent files - i was unaware of this Question

Yes running as fido would be best to stop any mishaps but Lucid puppy and most all the earlier puppies do not have this option Sad

Sure most things have been done before - but i don't see it as reinventing the wheel - merely more choice, with the added bonus of of having some fun and hopefully learning something along the way Cool

cheers.
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Tue 21 Jun 2011, 10:24    Post_subject: Re: Countdown to Action  

stu90 wrote:
added bonus of of having some fun and hopefully learning something along the way Cool.

Bingo
If you start a new thread I will join Smile
Back to top
View user's profile Send_private_message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Thu 23 Jun 2011, 16:45    Post_subject: Countdown to Action  

Dear L18L,

Countdown to Action is a great little utility. I would only make one slight change to line 32. As written, the input field does not accept arguments. In order for parameters to be passed, line 32 should look like this:

Code:
SETACTION=`echo $COUNTDOWN | cut -d" " -f 3-`


I just added a "-" after 'cut -d" " -f ', which means cut takes all fields starting with f3. Thanks for the utility.

With kind regards,
vovchik
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Thu 23 Jun 2011, 17:06    Post_subject: Re: Countdown to Action  

vovchik wrote:
...
I just added a "-" after 'cut -d" " -f ', which means cut takes all fields starting with f3. Thanks for the utility.
...

Learning from each other is fun.
Thank you very much for the - (Minus) Smile

The credits go to stu90.
I have just added the field HOUR and ranges for the numeric fields.
Code:
man yad
Cool
Back to top
View user's profile Send_private_message 
stu90


Joined: 25 Feb 2010
Posts: 1401
Location: England. Dell Inspiron 1501. Dpup

PostPosted: Thu 23 Jun 2011, 22:42    Post_subject:  

This is a little Yad application to perform a simple countdown for x minutes or hours then perform a user defined action or string of actions, such as shutdown puppy (wmpoweroff) or play a media file etc.

When you set a countdown action there will be an icon in the system tray as a reminder - 10 second before the countdown action is performed a little gui window will open alerting you an action is to be performed in 10 seconds and giving the option to cancel the action if you wish.

urxvt in the action field is not needed to run an action, it is just there as an example.



Dependencies:
Countdown to Action requires Yad-0.12.2 to be installed - download is available on this link:
http://www.murga-linux.com/puppy/viewtopic.php?p=536533#536533

Tested on Lucid Puppy.

Thanks.
countdown-0.3.pet
Description 
pet

 Download 
Filename  countdown-0.3.pet 
Filesize  5.28 KB 
Downloaded  247 Time(s) 
Back to top
View user's profile Send_private_message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Fri 24 Jun 2011, 07:06    Post_subject: c2a  

Sorry Stu,

I guess my thanks should have been addressed mainly to you Smile In any case, the utility is useful, and collaboration is always nice to see. To make this app even more complete, you might consider adding a launch at hh:mm and a file select button for the action that would update the input box.

With kind regards,
vovchik

PS. I use this icon for the GUI. It's a bit big, but I like it.
clock4.png
 Description   
 Filesize   61.46 KB
 Viewed   1550 Time(s)

clock4.png

Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Fri 24 Jun 2011, 16:43    Post_subject: Countdown
Sub_title: working in wary
 

An additional combobox for choosing from /usr/share/applications.
The checkbox decides where to take the action from.
The input field which I have renamed to "Command" has to be at last position because it can contain more than 1 string.

Writing this down I have got the idea taking another separator than blank that this condition would exist no more.

Code:
#!/bin/bash

 ## Stu90 ## L18L ##
 ## Countdown to Action ##
 ## editable command or combobox v3a
 
 TITLE="Countdown To Action"
 VERSION="0.3a"
 ICON="/usr/share/pixmaps/c2a.png"
 TEXT="<b>Enter Time to countdown \nbefore\nAction or Command. </b> "
 TIME=`date +%H:%M.%P`
 DATE=`date +%d-%m-%Y`


  ### GUI countdown - action ###
  COUNTDOWN=$( yad --title="$TITLE $VERSION" --text="$TEXT" --form --separator=" " --image="$ICON" \
--field="Minutes":NUM "0!0..59" \
--field="Hours":NUM "0!0..23" \
--field="Action":CB "`ls /usr/share/applications | tr '\n' '!' | sed s/.desktop//g `" \
--field="Ignore Command":CHK TRUE \
--field="Command" "urxvt" \
)

   echo $COUNTDOWN
   if [ "$COUNTDOWN" = "" ];then
   echo "Exiting" && exit
   else
 
   ## get minutes ##
   MINS=`echo $COUNTDOWN | cut -d" " -f1 | cut -d "." -f1 | cut -d "," -f1`
   echo "Countdown: $MINS minutes"
   ## countdown minutes ##
   TIMERM=`echo $(($MINS))`'m'

   ## get hours ##
   HOURS=`echo $COUNTDOWN | cut -d" " -f2 | cut -d "." -f1 | cut -d "," -f1`
   echo "Countdown: $HOURS hours"
   ## coundown hours ##
   TIMERH=`echo $(($HOURS))`'h'   

   ## get new action ##
   IGNORE_COMMAND=`echo $COUNTDOWN | cut -d" " -f4`
   if [ "$IGNORE_COMMAND" = "TRUE" ] ; then   
    SETACTION=`echo $COUNTDOWN | cut -d" " -f 3`
    SETACTION=`cat /usr/share/applications/${SETACTION}.desktop | grep Exec= | cut -d "=" -f 2 `
   else
    # must be the last input because number of parameters is unknown
    SETACTION=`echo $COUNTDOWN | cut -d" " -f 5-`
    [[ ! "$SETACTION" ]] && yad --title="$TITLE Info" --text=" Make sure to add an Action to perform " && echo "Exiting" && exit
   fi
   echo "Execute: $SETACTION "
   
   ## tray notification ##
   exec 3> >(yad --notification  --image="$ICON" --listen)
   echo tooltip: "Countdown action will be performed \n in <b>$HOURS</b> hours and <b>$MINS</b> minutes time from \n <b>$TIME $DATE</b> " >&3
   
   ## sleep for x hours + x minutes ##
   sleep $TIMERH | sleep $TIMERM
   exec 3>&-

   ### 10 seconds / cancel notification ###
  (
    echo "99" ; sleep 1
    echo "90" ; sleep 1
    echo "80" ; sleep 1
    echo "70" ; sleep 1
    echo "60" ; sleep 1
    echo "50" ; sleep 1
    echo "40" ; sleep 1
    echo "30" ; sleep 1
    echo "20" ; sleep 1
    echo "10" ; sleep 1 ) |
  yad --progress --title="$TITLE $VERSION" --text=" Your action will be executed in 10 seconds. " \
  --percentage=0 --auto-close --auto-kill
  if [ "$?" = -1 ] ; then
  yad --error --text=" Aborted by user! "
  fi   
 
  ### action to execute ###
  echo $SETACTION startet.
  time eval $SETACTION
   
 fi
 exit
countdown3a.png
 Description   
 Filesize   9.03 KB
 Viewed   1604 Time(s)

countdown3a.png

Back to top
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 2376
Location: Germany

PostPosted: Fri 04 Nov 2011, 00:30    Post_subject:  

Hello,

i have downloaded and installed the pet, but it won't run.

Error Message:
Code:
sh-3.00# /root/my-applications/bin/countdown
/root/my-applications/bin/countdown: line 17: yad: command not found

Exiting
sh-3.00#

What does it mean and what can i do, to get this tool running? I'm using Puppy Studio 3.3 and Lucid 525 (528).

RSH

Edit:

Sorry, but i must have been blind. Found the yadxxx.pet, downloaded it, and now it works.
Back to top
View user's profile Send_private_message 
DPUP5520

Joined: 16 Feb 2011
Posts: 801

PostPosted: Fri 04 Nov 2011, 00:36    Post_subject:  


_________________
PupRescue 2.5
Puppy Crypt 528
Back to top
View user's profile Send_private_message 
DPUP5520

Joined: 16 Feb 2011
Posts: 801

PostPosted: Fri 04 Nov 2011, 00:38    Post_subject:  

wtf thats weird, anyway you need yad which can be found here

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

_________________
PupRescue 2.5
Puppy Crypt 528
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1165s ][ Queries: 13 (0.0043s) ][ GZIP on ]