A custom File & Folder selector.

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#46 Post 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
Attachments
short.png
(69.91 KiB) Downloaded 469 times

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

#47 Post 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.
.

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

#48 Post 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 :)

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

#49 Post 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

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

#50 Post 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

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

#51 Post 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

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

#52 Post 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

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

#53 Post 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

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

#54 Post 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 ???

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

#55 Post 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 ;)

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

#56 Post 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?
.

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

#57 Post 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

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

#58 Post 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.
Attachments
yad.file.dlg.gz
(1.25 KiB) Downloaded 363 times
Last edited by sunburnt on Wed 21 Aug 2013, 01:44, edited 1 time in total.

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

#59 Post 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

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

#60 Post 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 )

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

#61 Post by mikeb »

Hmm well I do remember having fun with such as mencoder guis and so on. Then there's linux mutations to deal with where last weeks function syntax get reversed for no reason and /sys folders get moved lol.

Now why have my pepper plants not produced peppers?
Give me a tall ship and a sea to sail on.... actually a small boat will do since I know nothing about sail usage.

So did I accidentally but successfully hijack your topic in the end ? :D

regards

Mike

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

#62 Post by sunburnt »

Depending on other`s work is always a scary scenario. I know that well.

What part of the world do you live in? Pepper plants are picky.

To me the most interesting part of any thread is when the subject is exhausted.
Then interesting conversation usually takes place and the ideas begin to flow.
.

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

#63 Post by mikeb »

Actually chili pepper plants. In the past I have had a good crop grown on a windowsill.. These are in a poly greenhouse and have no peppers at all.. my frustration was fueled when I noticed this boat persons crop thriving ...the secret was the river water apparently.
Alternative explantion is that where we are is simply a place where plants (and people) do not thrive lol

Ideas hmm... they tend to come in phases followed by annoying others with them :D

mike

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#64 Post by amigo »

Sometimes an excess of fertilizer will cause plants to not flower and bear fruit. Also, chile plants do not like low temps at night -under 18C or 55F.

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

#65 Post by mikeb »

Hmm general purpose compost and no added fertiliser. Not had colder nights for some time but perhaps the temperature swings of outside are not to their liking. Actually these were some packets of seeds that the children bought and most of them failed to germinate ... I have noticed poorer growth / fruiting from older seeds before so might be a factor though these were pretty recent date on them.

One gets attached though I have not tried talking to them..
One irk are sudden bursts of hot sunshine and resultant very upset seedlings...the greenhouse is a recent addition...I though a more controlled enviroment would be a good idea after the soggy cold previous summer....plus I have always wanted one :)

The soil here is quite acidic/clay and I have got used to what prefers it ... the new guinea pig is building up a good stock of compost for next year though.

@sunburnt.... perhaps topic needs altering to Gardeners question time...

My fingers are not quite as green as I would like them to be.

mike

Post Reply