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 03 Sep 2014, 01:19
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
A custom File & Folder selector.
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 7 [97 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7 Next
Author Message
mikeb


Joined: 23 Nov 2006
Posts: 8232

PostPosted: Tue 13 Aug 2013, 18:30    Post subject:  

Ok sussed it

NAME gives a group of file types....

But for your example its

yad --file-selection --filename=/mnt/sda3/ --geometry=600x400+20+20 --file-filter="IMAGES | *.png *.jpg"

I got caught out with the --notification in the same way... when the pipe symbol is used as a deliminator then quotes are essential otherwise bash interprets it as such. The above gives a IMAGES tab which shows png and jpg as desired...

you can specify multiple selectable types (like gimp file dialogs) by --file-filter=*.jpg --file-filter=*.png or NAMED like above. For example that could give a 'show all files' option eg
--file-filter="IMAGES | *.png *.jpg" --file-filter="ALL | *.*"

I saw mention of a 'manual' for yad but it eludes me.

mike
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Tue 13 Aug 2013, 21:49    Post subject:  

I`m not sure what the group thing is all about, but the double quotes worked with or without it.
Both these lines work:
Code:
# yad --file-selection --filename=/mnt/sda3/ --geometry=600x400+20+20 --file-filter="IMAGES |*.png *.jpg"
# yad --file-selection --filename=/mnt/sda3/ --geometry=600x400+20+20 --file-filter="*.png *.jpg"

However it`s touchy about variables.
The geometry has to be separated and double-quoted (--geometry="$yadW"x"$yadH"+"$yadX"+"$yadY").
Strangely the file path doesn`t have to be quoted at all.

This works nicely:
Code:
#####   Show Yad filer dialog at upper right corner of screen.

                        #####   Path must have ending /      eg: /path/
pf=/mnt/sda3/docs/pics/girls/

yadW=600

scrW=`xwininfo -root |grep '\-geo' |sed 's#.* ##;s#x.*##'`

yadX=$((scrW-yadW-5))

ext='*.png *.jpg'

yad --file-selection --filename= --geometry="$yadW"x400+"$yadX"+0 --file-filter="$ext"
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8232

PostPosted: Wed 14 Aug 2013, 07:40    Post subject:  

Hmm geometry was unquoted for me .. oddness.

grouping..... in the example the dialog would show 'IMAGES' rather than the '*.png *.jpg' eg you could have a dozen extensions but only show IMAGES so avoiding a long list and less confusing for a casual user..

Actually the quotes solve having multiple types I just realised.

I find software like crossword puzzles... you get to know the authors style Smile

mike
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Wed 14 Aug 2013, 13:51    Post subject:  

And perhaps not so much "style", as what`s forced upon us... Rolling Eyes

Are the group files types shown in a list somewhere?

Yeah, the geometry and filter patterns need double quoting.
But the /path/file doesn`t.
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8232

PostPosted: Wed 14 Aug 2013, 14:28    Post subject:  

Well its Linux...anything goes lol. This weeks kernel says this, next week that, simon says .... consistancy and gtk in particular are sworn enemies.

Quote:
Are the group files types shown in a list somewhere?

the list of *.jpg *.png *.gif would be replaced by 'IMAGES' in the dialog. In other words its an alias for a group of file extensions.

Quote:
Yeah, the geometry and filter patterns need double quoting.
But the /path/file doesn`t.

Unless there are spaces in names in the usual unix way.

mike
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Wed 14 Aug 2013, 14:42    Post subject:  

Good point, then the /path/file needs quotes too.

So is there a list of aliases, or how do you make your own? images='*.png" "*.jpg"'
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8232

PostPosted: Wed 14 Aug 2013, 15:06    Post subject:  

--file-filter="IMAGES |*.png *.jpg"

IMAGES IS the alias for png/jpg above.... it could be ALLOWED or PYJAMAS....


on a general note I get caught out in the end not adding quotes with command lines....

mike
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Wed 14 Aug 2013, 23:45    Post subject:  

I guess I`m not clear on what`s the purpose of aliases ?
Last edited by sunburnt on Thu 15 Aug 2013, 03:58; edited 1 time in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Thu 15 Aug 2013, 03:57    Post subject:  

And another Q:
I just don`t get " --confirm-overwrite=[TEXT] ".
I mean "TEXT". Confused
Can`t programmers communicate like the rest of us do?

# I know what overwrite does. What`s the purpose of TEXT ?
Boolean TRUE / FALSE ? . y / n ?

Code:
File selection options
  --file                                         Display file selection dialog
  --file-selection                               Alias for --file
  --filename=FILENAME                            Set the filename
  --multiple                                     Allow multiple files to be selected
  --directory                                    Activate directory-only selection
  --save                                         Activate save mode
  --separator=SEPARATOR                          Set output separator character
  --confirm-overwrite=[TEXT]                     Confirm file selection if filename already exists
  --file-filter=NAME | PATTERN1 PATTERN2 ...     Sets a filename filter


### I`ve got a script I`ll post that utilizes all of the Yad Filer options in a simple CLI command.
.

Last edited by sunburnt on Thu 15 Aug 2013, 04:06; edited 3 times in total
Back to top
View user's profile Send private message 
Jasper


Joined: 25 Apr 2010
Posts: 1111
Location: England

PostPosted: Thu 15 Aug 2013, 04:00    Post subject:  

Hi,

I'm a lousy typist so here is my longest alias:

alias t="cd /root/.etc/X11 && sleep 1 && mv xorg.conf zxorg.conf && sleep 1 && mv zzxorg.conf xorg.conf && sleep 1 && mv zxorg.conf zzxorg.conf && sleep 1 && restartwm"

I just type t (which is short reminder for transfer) and Return.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Thu 15 Aug 2013, 04:03    Post subject:  

Thanks Jasper; A command sequence, instead of a value ( sort of...).

But isn`t the "$" needed on the alias to make it work?
Back to top
View user's profile Send private message 
Jasper


Joined: 25 Apr 2010
Posts: 1111
Location: England

PostPosted: Thu 15 Aug 2013, 04:22    Post subject:  

Hi again

No it doesn't need a $.
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8232

PostPosted: Thu 15 Aug 2013, 06:15    Post subject:  

Ok screenies are the only way here...

yad --file-selection --file-filter="IMAGES | *.png *.jpg" --file-filter="ALL | *.*"

produces the first... see the options list....

yad --file-selection --filename=/root/vincent.jpg --save --confirm-overwrite="Eat More Bananas?"

Provides alternative text for the confirm dialog...second image.

By the way how can GTK2 be set for single click in theshortcuts pane? Set at compile time?

mike
alias.png
 Description   
 Filesize   10.32 KB
 Viewed   307 Time(s)

alias.png

over.png
 Description   
 Filesize   28.39 KB
 Viewed   286 Time(s)

over.png

Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8232

PostPosted: Thu 15 Aug 2013, 06:54    Post subject:  

Hmm i fiddled with the sources a little...

--form spinwheel output is now an integer and not floating... seemed logical and easier for scripts.

Color selector in -form dialog now has 6 digit result not 12.

Removed mysterious error with --notification dialog connected with middle click exit...removed option...in any case it could be added to the right click menu if required.

mike

edit ..update see later post

Last edited by mikeb on Tue 27 Aug 2013, 17:18; edited 1 time in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Thu 15 Aug 2013, 11:49    Post subject:  

mikeb; Downloaded your modded Yad dialog, I`ll look at it.
Haven`t seen the shortcuts pane, so I haven`t a clue...

It`s senseable to make a std. filter list to be used for all of the file dialogs.
So to set it in code at startup don`t use an alias with "--file-filter=".

Q: Can no alias and a std. set of aliases be used together? . A: YES...
So filtering at startup, and the popup menu works to choose new filtering.


Mike, you do C programming it appears, ever mess with X ( custom windows ) ?
A way to do away with GTK and QT, and have a rational GUI foundation.


Jasper; Ah yes, that`s what the alias command does, it makes cli commands.
.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 7 [97 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.0825s ][ Queries: 12 (0.0076s) ][ GZIP on ]