A custom File & Folder selector.
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
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
I`m not sure what the group thing is all about, but the double quotes worked with or without it.
Both these lines work:
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:
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"
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"
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
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
Well its Linux...anything goes lol. This weeks kernel says this, next week that, simon says .... consistancy and gtk in particular are sworn enemies.
mike
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.Are the group files types shown in a list somewhere?
Unless there are spaces in names in the usual unix way.Yeah, the geometry and filter patterns need double quoting.
But the /path/file doesn`t.
mike
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 ?
### I`ve got a script I`ll post that utilizes all of the Yad Filer options in a simple CLI command.
.
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
.
Last edited by sunburnt on Thu 15 Aug 2013, 08:06, edited 3 times in total.
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
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
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
--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, 21:18, edited 1 time in total.
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.
.
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.
.
Well its nice to have an option...eg for pburn I can avoid a huge list of mp3 when all I want is the pburn file....the alias option is just for user friendliness and not essential....
It does not come naturally like other languages I play with.
FLTK looks nice but has never taken off as a major alternative.
The shortcut pane is... see piccie... see how skilled I am with a mouse.
mike
I am a bad hacker,,,I find C akin to double dutch though realising what a low level language it is it at least makes a little more sense to me....as for C++..A way to do away with GTK and QT, and have a rational GUI foundation.
It does not come naturally like other languages I play with.
FLTK looks nice but has never taken off as a major alternative.
The shortcut pane is... see piccie... see how skilled I am with a mouse.
mike
- Attachments
-
- short.png
- (69.91 KiB) Downloaded 469 times
You`re very skilled Mike, don`t ever let anyone tell you otherwise.
FLTK is pretty spartan from what I`ve seen in Tiny Core Linux.
Ahhh, the Places pane...
I hate wasted space, the file dialog puts the filter aliases above the buttons.
It should be next to the buttons, then the panes would be proper full height.
.
FLTK is pretty spartan from what I`ve seen in Tiny Core Linux.
Ahhh, the Places pane...
I hate wasted space, the file dialog puts the filter aliases above the buttons.
It should be next to the buttons, then the panes would be proper full height.
.
Got most of it working, but the file filters is just kicking my arse.
Anyone see anything that`s wrong with this picture?
There`s test code at the bottom that shows the command line.
For help type: yfiledlg -h
Anyone see anything that`s wrong with this picture?
There`s test code at the bottom that shows the command line.
For help type: yfiledlg -h
Code: Select all
#!/bin/sh
######### Setup a Yad file/dir. selector.
##### Usage: yad_filer [-f,-d,-m,-s,-t][-o /path/file][-p /path,-g W, H, X, Y][-x ext.]
appP=`dirname $0`
i=1
all='--file-filter="All | *"' ##### Combo list of file groups.
hid='--file-filter="Hidden | .*"'
doc='--file-filter="Document | *.txt *.pdf *.doc *.docx *.xml *.htm* *.pps *.ppt* *.csv"'
img='--file-filter="Image | *.jpg *.jpeg *.png *.xpm *.svg *.ico *.bmp *.tif, *.gif"'
aud='--file-filter="Audio | *.mp3 *.mp2 *.wma *.ogg *.aac *.ac3 *.flac *.m4a *.wav'
aud=$aud' *.m4a *.m4b *.m3u *.m1a *.mka *.mpa *.pcm *.midi *.mid *.m4p *.m4r"'
vid='--file-filter="Video | *.mp4 *.m4v *.ogm *.wmv *.wmx *.mpe *.mpeg *.mpg *.avi *.vob'
vid=$vid' *.mov *.qt *.mpeg-1 *.mpeg-2 *.mp2v *.m2v *.m2s *.mpa *.mp2 *.m2a *.asf *.asx *.swf"'
while [ $i -le $# ] ##### Loop: Parse command args.
do
case `echo $@ |cut -d' ' -f$i` in
-f) args="$args --file" ; ((i=i+1)) ;; # file dialog
-d) args="$args --directory" ; ((i=i+1)) ;; # folder dialog
-m) args="$args --multiple" ; ((i=i+1)) ;; # multi. select
-s) args="$args --save" ; ((i=i+1)) ;; # save file
-o) eval O=\${$((i+1))} ; Txt=`cat $O` # overwrite file
args="$args --confirm-overwrite=$Txt" ; ((i=i+2)) ;;
-p) eval O=\${$((i+1))} ; args="$args --filename=$O" ; ((i=i+2)) ;; # startup /path
-x) eval O=\${$((i+1))} ; args="$args --file-filter=$O" ; ((i=i+2)) ;; # extension filters
-t) TB=55 ; ((i=i+1)) ;; # taskbar offset
# window geometry
-g) eval W=\${$((i+1))} ; eval H=\${$((i+2))} ; eval X=\${$((i+3))} ; eval Y=\${$((i+4))}
scrW=$((`xwininfo -root |grep '\-geo' |sed 's#.* ##;s#x.*##'`-5))
# scrW=`xwininfo -root |grep '\-geo' |sed 's#.* ##;s#x.*##'`
[ $W -gt $scrW ]&& W=$scrW # fix W
[ $((W+X)) -gt $scrW ]&& X=$((scrW-W)) # fix X
scrH=`xwininfo -root |grep '\-geo' |sed 's#.*x##;s#+.*##'`
[ $H -gt $scrH ]&& H=$((scrH-TB)) # fix H
[ $((H+Y)) -gt $scrH ]&& Y=$((scrH-H-TB)) # fix Y
args="$args --geometry=${W}x${H}+${X}+${Y}" ; ((i=i+5)) ;;
# help
-h) echo -e '\n\t\t#####\tyFileDlg\n\n\t# Usage: yFileDlg [opt.1] [opt.2] ...\n'
echo -e '\tFile open: -f\n\tDirectory open: -d\n\tPath: -p /path/'
echo -e '\tSave file: -s\n\tOverwrite file: -o filename'
echo -e '\tMultiple files & folders: -m\n\tExtension patterns: -x *.txt *.doc'
echo -e '\tGeometry: -g W H X Y\n\tTaskbar offset: -t ( Comes before -g )\n'
exit ;;
esac
done
echo -e "\nScreen W x H = $scrW x $scrH\n\nYAD$args $all $hid $doc $img $aud $vid\n"
yad $args $all $hid $doc $img $aud $vid