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 Tue 14 Aug 2018, 16:09
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
YAD - Tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 29 of 31 [456 Posts]   Goto page: Previous 1, 2, 3, ..., 27, 28, 29, 30, 31 Next
Author Message
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Fri 08 Jun 2018, 05:11    Post subject:  

Howabout using yad --file-selector (or MMview) as a wifi network connection display manager? Perform a scan and use data for each ssid to generate a .jpg (using 01mickos wallpaper generator) or .svg (maybe easier) to populate a directory in /tmp or on disk. This should be so easy to code and unique in the world of wifi connection tools! Are you up for this Fred? Misky? Mochi?
Back to top
View user's profile Send private message MSN Messenger 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1570
Location: Japan

PostPosted: Fri 08 Jun 2018, 22:47    Post subject:  

stemsee wrote:
Are you up for this Fred? Misky? Mochi?
Not me. I know nothing about wifi.
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Sun 10 Jun 2018, 05:22    Post subject:  

Fair enough ... The main thing is the algorithm to convert/imbed selected scan data into the image, and have that algorithm function in reverse to extract scan data from the image back into usable text strings.

Any file selector/browser then becomes a Wifi/network connection app.

EDIT: completed ... a basic function
2018-06-10-170413_729x405_scrot.png
 Description   
 Filesize   89.51 KB
 Viewed   409 Time(s)

2018-06-10-170413_729x405_scrot.png

Back to top
View user's profile Send private message MSN Messenger 
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Mon 11 Jun 2018, 06:39    Post subject:  

With rox and yad --file-selection --add-preview
xscreenshot-20180611T113639.png
Description 
png

 Download 
Filename  xscreenshot-20180611T113639.png 
Filesize  79.1 KB 
Downloaded  82 Time(s) 
Back to top
View user's profile Send private message MSN Messenger 
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Sat 30 Jun 2018, 06:04    Post subject:  

does anyone know why I am not getting any exit codes from this

Code:
   yad --image=$track/images/$line.svg --window-icon="$pics/wifi24.png" --geometry="$(cat $camino/geometry/$WINDOWTITLE)" --title="$WINDOWTITLE" --text "Yes to keep this connection\nNo try next open AP/nCancel to stop and exit!" --button=gtk-yes:0 --button=gtk-no:2 --button=gtk-cancel:1 --timeout-indicator=top --timeout=8

It looks like this
2018-06-30-110313_577x309_scrot.png
 Description   
 Filesize   45.9 KB
 Viewed   299 Time(s)

2018-06-30-110313_577x309_scrot.png

Back to top
View user's profile Send private message MSN Messenger 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1570
Location: Japan

PostPosted: Sat 30 Jun 2018, 06:44    Post subject:  

stemsee wrote:
does anyone know why I am not getting any exit codes from this

Don't know why it wouldn't work. How do you read the exit codes?
Works here as expected for this stripped down code:
Code:
yad --button=gtk-yes:0 --button=gtk-no:2 --button=gtk-cancel:1 --timeout-indicator=top --timeout=8
echo $?
Returns exit codes 0,2,1,70 (timeout) or 252 (Alt+F4)
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Sat 30 Jun 2018, 08:13    Post subject:  

Thanks MochiMoppel

Firstly I associated the yad statemnet with a variable goOn=`yad ...`
and then ret=$?, followed by a case statement. When I first implemented these they seemed to work, but now not. i wonder if the extra variables confuse yad (ie yad has a bug).

Is there a constraint on how many functions bash can address? Or how many functions and variables a script may produce?
Back to top
View user's profile Send private message MSN Messenger 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1570
Location: Japan

PostPosted: Sat 30 Jun 2018, 09:41    Post subject:  

stemsee wrote:
Firstly I associated the yad statemnet with a variable goOn=`yad ...`
and then ret=$?, followed by a case statement.

When exactly is "then"? If you add ret=$? after your yad statement, still within the command substitution (= the expression delimited by backtics), the value of ret will be lost as soon as you finish your assignment to variable goOn.
If you add ret=$? after the goOn assignment, the value will always be 0.

You need to print the value of $ret to stdout within the command substitution:.
Code:
goOn=$(yad --button=gtk-yes:0 --button=gtk-no:2 --button=gtk-cancel:1 --timeout-indicator=top --timeout=8; ret=$? ;echo $ret)
case $goOn in
0) echo you pressed yes ;;
1) echo you pressed cancel ;;
2) echo you pressed no ;;
*) echo you did not press a button;;
esac
Assigning $? to ret makes little sense here. You could echo $? directly.
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Sat 30 Jun 2018, 10:51    Post subject:  

That explains the results I was seeing perfectly!

Ervyreihtng is wronikg fnie aiagn! I can see taht I was mnixig dnefifret mhoteds!

Tnahks McohiMpoepl

semsete
Back to top
View user's profile Send private message MSN Messenger 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1570
Location: Japan

PostPosted: Sat 30 Jun 2018, 11:04    Post subject:  

Yu'reo womelec!
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Sat 30 Jun 2018, 11:13    Post subject:  

MochiMoppel wrote:
Yu'reo womelec!


Ha ha! The linguistic code is that the first and last letter of each word must be as the usual spelling but internal letters can be in any order! Native like level English reader's brains will get the correct reading!

smeetse
Back to top
View user's profile Send private message MSN Messenger 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1570
Location: Japan

PostPosted: Sat 30 Jun 2018, 20:00    Post subject:  

I figured that a clever English brain would get the meaning with only the first letters in its usual place.
Of course the brain of a genius would need no specific order at all.
Covfefe!
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Sun 01 Jul 2018, 00:57    Post subject:  

Since when does coffee have a 'v' in it? 'v' must be a sugar free sweetener!
Back to top
View user's profile Send private message MSN Messenger 
misko_2083


Joined: 08 Nov 2016
Posts: 53

PostPosted: Mon 02 Jul 2018, 22:26    Post subject:  

stemsee wrote:
Since when does coffee have a 'v' in it? 'v' must be a sugar free sweetener!

It's one of those internet memes. That is how Trump spells "coverage" on twitter. Very Happy

In English or other languages, the brain can see the whole word at once as long as the first and the last letters are in the right possition. Although it takes more time to read such text.

As you can see, by the Mochi's word play, the brain can easily be tricked.


-----------------------------------------------------------------------

By the way, how does timeout indicator works?
If the timeout is set to 8 seconds, the progress bar can reach 9 or even 10 occasionally. Rolling Eyes

Code:

#!/bin/bash
i=1
while true
 do
   echo "1:#$(date '+%T')"
   echo "2:#$(date '+%D %a')"
   echo "3:#${i}"
   echo "3:$(( ${i}*100 /8 ))"
   i=$(($i+1))
   sleep 1
 done | yad --multi-progress \
             --bar="Time":NORM \
             --bar="Date":NORM \
             --bar="Countdown":NORM \
             --window-icon="clock" \
             --image="clock" \
             --borders="20" \
             --no-buttons \
             --timeout-indicator=top \
             --timeout=8


------------------------------------------

With both --watch-bar=3 and --auto-close included, the dialog will close before the timeout is reached.

Perhaps, yad applies a custom version of the the general theory of relativity. Time is relative to the length of the Gtk+ bar? Laughing
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2260
Location: In The Way

PostPosted: Wed 04 Jul 2018, 04:28    Post subject:  

misko_2083 wrote:

It's one of those internet memes. That is how Trump spells "coverage" on twitter. Very Happy

Something I would never have known!

Quote:
Perhaps, yad applies a custom version of the the general theory of relativity. Time is relative to the length of the Gtk+ bar? Laughing

So, that is why I look so young!
Back to top
View user's profile Send private message MSN Messenger 
Display posts from previous:   Sort by:   
Page 29 of 31 [456 Posts]   Goto page: Previous 1, 2, 3, ..., 27, 28, 29, 30, 31 Next
Post new topic   Reply to topic 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.1448s ][ Queries: 12 (0.0547s) ][ GZIP on ]