A custom File & Folder selector.

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#21 Post by Karl Godt »

A forum thread with Yad examples would be good, but perhaps belated.
I Googled it and couldn`t make heads or tails of it, seems poorly organized.
technosaurus started to fiddle with yet-another-dialog here :
Zenity/Yad and scripts http://murga-linux.com/puppy/viewtopic.php?t=58306 in August 2010 ( Lupu-5.1.1 / Lupu-5.2 )

yad as keyword in the forum search with focus to the programming section in posts gave me 80 hits .

stu90 | stu91, L18L , RSH | R-S-H are some freaks that used yad in their apps .

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#22 Post by mikeb »

Perhaps its a case of puppy does things a certain way and that's that.
But I will play and reap the fruits of such labours lol...... along with saves in ram, 252 sfs, correct sfs layer order, multiuser, etc etc. and lob potentially useful stuff around...at least grub4dos got adopted in the end in spite of protests.

mike back on his bike

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#23 Post by Flash »

Sunburnt, as for functionality of your file management program, may I suggest that it somehow incorporate the functionality of the "tree" program? Perhaps a button that says "Expand all folders" or something like that. Every file manager will expand a particular folder to show the next level of subfolders it contains - if you click on the parent folder. But no file manager I'm aware of will open a folder so that all of its subfolders, and all of their subfolders, are shown expanded down to the bottom level of folders. Tree is the only way I've found to do what I want, and I'm surprised that no file manager can do what Tree can do. It seems like a feature that would be included in all file managers.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#24 Post by sunburnt »

Flash; I know of no file browser or tree widget that expands all in a branch either.
Could be useful for rapid tree movement, and also for a graphical tree display.
# My selector app. uses list boxes only, BaCon has no tree like GtkDialog has.

mikeb; Any Linux will do what any other will, with all the dependencies installed...

Karl; At least they look normal compared to Xdialog, it`s ugly as hell.
Yad is a Zenity fork and replacement, Zenity is not developed I think.

# My Puppy version has both Yad and Zenity.
Trying both of them, the option: -filename=/mnt/sda1 only gives a dir dialog.!
And it isn`t even in the dir., it just highlights the dir. to enter it. Really odd...

Code: Select all

yad --file-selection --filename=/mnt/sda3

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#25 Post by sunburnt »

THANKS vovchik; For the BaCon compile code line.
It reduced my WallPuppy file from 192 KB to 142 KB.

THANKS Karl; For the upx help.
It reduced vovchik`s code file from 142 KB to 26 KB... WOW.!

# Overall that`s slightly more than a 7 times compression.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#26 Post by mikeb »

try
yad --file-selection --filename=/mnt/sda3/
I assume without the trailing / it assumes a file locating call instead.... A later version probably checks for file/folder status. I have been twiddling with the code and its as straightforward as you can get for c/gtk so modding is easy even for me.
mikeb; Any Linux will do what any other will, with all the dependencies installed...
Not really talking about code compatability but rather politics. :D

One side effect of upx is that a dependency check no longer works.

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#27 Post by sunburnt »

You`re correct about the trailing slash of course.

So... How about the start-up size, it`s tiny on my version of Puppy.???
I see nothing in the Help about setting the start-up size of the dialogs.

# Thanks for the upx tip about dependencies.
For most of the utility type apps. I make it`s not a problem.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#28 Post by mikeb »

Yes defaults seems to be using minimum space possible......fine for most dialogs but perhaps needs a fallback for this one.

size option is the generic X one of --geometry=400x300+20+20
.... actually at least you don't have to have the default huge gtk version :)
That's width/height/offsetX/offsetY
or use --height=nn --width=nn instead... there's --center too.

note the
--multiple Allow multiple files to be selected
option... a bonus bunny .

mike

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#29 Post by greengeek »

Flash wrote:Tree is the only way I've found to do what I want, and I'm surprised that no file manager can do what Tree can do. It seems like a feature that would be included in all file managers.
Hi Flash, I just saw a comment from SFR regarding tree displays - is this of any interest:
http://www.murga-linux.com/puppy/viewto ... e29#718936

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#30 Post by sunburnt »

greengeek and Flash; All of the WinExplorer type filers have a tree for the left panel.
But this may not have been what Flash was talking about.

mikeb; I don`t know why I didn`t think of that, after all my work with GtkDialog.

Fiddling around I figured out the file filtering, but only for the first filter.

Code: Select all

yad --file-selection --filename=/mnt/sda3/ --geometry=600x400+20+20 --file-filter=*.png|*.jpg
yad --file-selection --filename=/mnt/sda3/ --geometry=600x400+20+20 --file-filter=*.png *.jpg
### I don`t understand: --file-filter=NAME | *.png *.jpg
.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#31 Post by mikeb »

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

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#32 Post by sunburnt »

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: Select all

# 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: Select all

#####	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"

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#33 Post by mikeb »

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 :)

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#34 Post by sunburnt »

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

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.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#35 Post by mikeb »

Well its Linux...anything goes lol. This weeks kernel says this, next week that, simon says .... consistancy and gtk in particular are sworn enemies.
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.
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

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#36 Post by sunburnt »

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"'

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#37 Post by mikeb »

--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

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#38 Post by sunburnt »

I guess I`m not clear on what`s the purpose of aliases ?
Last edited by sunburnt on Thu 15 Aug 2013, 07:58, edited 1 time in total.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#39 Post by sunburnt »

And another Q:
I just don`t get " --confirm-overwrite=[TEXT] ".
I mean "TEXT". :?
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: Select all

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, 08:06, edited 3 times in total.

Jasper

#40 Post by Jasper »

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.

Post Reply