Page 3 of 5

Posted: Thu 15 Aug 2013, 08:03
by sunburnt
Thanks Jasper; A command sequence, instead of a value ( sort of...).

But isn`t the "$" needed on the alias to make it work?

Posted: Thu 15 Aug 2013, 08:22
by Jasper
Hi again

No it doesn't need a $.

Posted: Thu 15 Aug 2013, 10:15
by mikeb
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

Posted: Thu 15 Aug 2013, 10:54
by mikeb
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

Posted: Thu 15 Aug 2013, 15:49
by sunburnt
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.
.

Posted: Thu 15 Aug 2013, 19:42
by mikeb
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....
A way to do away with GTK and QT, and have a rational GUI foundation.
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++..
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

Posted: Thu 15 Aug 2013, 20:38
by sunburnt
You`re very skilled Mike, don`t ever let anyone tell you otherwise. :wink:

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

Posted: Thu 15 Aug 2013, 22:34
by greengeek
sunburnt wrote:You`re very skilled Mike, don`t ever let anyone tell you otherwise. :wink: .
Except when it comes to making straight arrows :)

Posted: Thu 15 Aug 2013, 23:00
by mikeb
Yes I forgot there was a drawing tablet attached.... Mr smiley was relieved I noticed it eventually,

I wonder if this is why I have only once been asked to write technical documentation?

I am on the blunt side of the cutting edge....

mike

Posted: Sat 17 Aug 2013, 03:54
by sunburnt
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

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

Posted: Sat 17 Aug 2013, 10:47
by mikeb
tis a bash thingy it seems... this test works interminal

tart=--file-filter="Image | *.jpg *.jpeg *.png *.xpm *.svg *.ico *.bmp *.tif *.gif" ; yad --file-selection --filename=/mnt/hda2/ --geometry=600x400+20+20 "$tart"

so no wrapper quotes for making the variable and double quote in the command line...

note there is a slipped in ',' in the img variable in your script...

tested the above in a quick script and it worked...

mike

Posted: Sat 17 Aug 2013, 18:36
by sunburnt
Many thanks Mike; After a bit of fiddling I got the filters working.

--confirm-overwrite= doesn`t show the text. Last item I think.

But this is minor stuff, I`ll figure it out. Thanks again... Terry

Posted: Sat 17 Aug 2013, 20:09
by mikeb
Hmm might need quotes again.
To test it you open with --filename=existing_file and then ok... should prompt the popup if you did not know already.

Generally all my testing has been done on gtk 2.12 ... I assume you are using a more recent release which does at least confirm compatability.

With the filebrowser and other widgets one hopes to use it rather than a combination of (g)xmessage, Xdialog, yafsplash, gtklogfileviewer in conjunction with gtkdialog without the more dubious of the latters functions.

Well one has no brain so time to flee

mike

Posted: Sun 18 Aug 2013, 02:30
by sunburnt
I`ll keep fiddling. It`s close to being more automated and easier to use.

Yeah, like another thread I`m following, Puppy`s a monster mash of O.S. parts.

But there`s a few variants that attempt to fix this with Xfce, or Lxde, or ???

Posted: Sun 18 Aug 2013, 11:12
by mikeb
Hmm a unified desktop like Xfce4 can help.... trying to have a common system can only be of benefit. Actually on puppy I use an old approach of early xfce4 plus Rox which is a light fast method but does give a more unified taskbar, useful additions and a complient menu system...no hacky scripts needed. I also recently added those alternative drive icons...the ones driven by binaries and they are so much easier/lighter to work with especially for multiuser. Scripts are useful but overuse has its drawbacks.

As for puppy as a whole compiling it as an independant distro would make much more sense...after all ubuntu and slackware are hardly minimalist and there are some rediculous dependancies. I cut memory footprint of mplayer down 50% just by rebuilding with only whats needed as a media player as an example.

But I digress but its your thread so we can without any tantrums :D

have fun

mike

hijacking another thread by using this one lol...death to /usr/bin/bootmanager. As I found with japanese motorbikes the more I removed the better they ran ;)

Posted: Sun 18 Aug 2013, 20:05
by sunburnt
Hey Mike; Nearly ready to post my wrapper script for the yad Filer.

# I`m thinking that the --confirm-overwrite should just be a permanent "save" default.

I can`t think of a circumstance that overwriting a file without warning is a good idea.

What do you think?
.

Posted: Sun 18 Aug 2013, 23:59
by mikeb
Hmm yes.... I would say thats expected behaviour.

It definately saves the script writer having to add a check and perhaps it should be default in the binary too. I will double check if there are any drawbacks on that one.

Today I am in NT4 land posting in Opera 10 so will play tomorrow....

regards

Mike

Posted: Tue 20 Aug 2013, 19:00
by sunburnt
Can`t get the Save Overwrite Text to accept spaces no matter what I try.
So I did the usual Linux thing of substituting underlines.

I like this way better than Xdialog`s filer and it`s more controllable than the GTK FileDialog.
This is my new filer for any Puppy apps. I make. Other distros. may not have Yad in them.

Here`s the wrapper script that mods. the Yad File Dialog.

Posted: Tue 20 Aug 2013, 21:21
by mikeb
args="$args --confirm-overwrite=$Txt".... hmm perhaps some escaping needed.... as an original rather than generated command line it behaves...or it does for me.
I like this way better than Xdialog`s filer and it`s more controllable than the GTK FileDialog.
Yes it reaches the parts others do not...plus some other useful functions in there...I have yet to fully utilise it but will have a frenzy at some point

Ok this produces the desired result....

Code: Select all

TXT="Butt Cheek" ; ARGS="--confirm-overwrite=$TXT" ; yad --file-selection --save --filename=app.log "$ARGS"

each level of variable nesting reverses the need for quotes it seems.

mike

Posted: Wed 21 Aug 2013, 01:25
by sunburnt
Hey Mike; I pasted your code and Yad didn`t even give a Save dialog, it was a dir. dialog!

I`ve about had it with Bash not handling command lines and spaces.
And then the apps. join in and add insult to injury.

I`m just going to use underlines, it`s okay...

I uploaded a newer one, all it does is check for Yad and error if it`s not found. ( Portability )