How to load gtksee in automatic photo presentation?

Using applications, configuring, problems
Message
Author
User avatar
gdemonta
Posts: 190
Joined: Mon 19 Feb 2007, 08:17
Location: Paris, France

How to load gtksee in automatic photo presentation?

#1 Post by gdemonta »

Hi all,
I was just wondering if it was possible to automaticly open a picture with the "presentation" mode of GTKsee, so we have a windows xp's equivalent.
It would be great to add the fullscreen and fit into screen -i and -s options.
I tried the set run action with those options but gtksee always open in the last directory and doesn't open in full and fit screen.
thanks a lot if anyone knows how to do this!
Guillaume
[color=blue]Dumbledore: "The evidence of the Dark Lord's return is incontrovertible"[/color]
IBM X31 - Puppy 2.16 Hard disk install with EZpup

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#2 Post by HairyWill »

Good idea.

Rather than using GTKSee, why not just call qiv directly.
For a start change the rox MIME type action for images to something like

Code: Select all

exec qiv -fmsd 2 `dirname "$1"`/*
There are at least two problems with this:

1. fairly easily to solve, my simple example tries to view every file in the directory

2. I think this will be more tricky. At the moment my example orders the files alphabetically and always starts at the top regardless of which file you clicked on. You can use the -F switch to load the list of files to view from a file. You could order this list so that it starts with the file clicked and then continues down the alphabet and wraps to the beginning of the alphabet. What I definitely don't know how to do is to ask rox what criteria the files shown in the window are currently ordered by. You could just assume alphabetic.

the qiv -f fullscreen option might be a problem for newbies as it takes a small amount of imagination to get out of (ESC or q). If you remove the -f you still get the window maximised but with decoration which might be better.

Somehow it would be good to give the user some instructions. The only way I can see to do this inside qiv is for the user to invoke fullscreen (f) and then (F1 or ?). Maybe a small window with a question mark that is always on top could be used to open some instructions.

I tend not to use GTKSee because it is quite slow, rox with big thumbnails is faster at creating thumbnails and calling qiv from the command line gives easier control over slideshows.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#3 Post by HairyWill »

getting better

Code: Select all

#! /bin/sh
#exec defaultpaint "$1"
cd `dirname "$1"`
FILE=`basename $1`
ls | sed -n '/'$FILE'/,$p' > /tmp/slideshow
ls | sed -n '1,/'$FILE'/p' >> /tmp/slideshow
FILES=`cat /tmp/slideshow`
exec qiv -msd 2 $FILES
One thing I don't like about this is that the line to start qiv contains an entry for each file to display. Presumably if your directory is big enough the command line will overflow.

I tried to overcome this using -F to load all the files in /tmp/slideshow but then qiv sorts them alphabetically and I can't find a switch to turn it off.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
gdemonta
Posts: 190
Joined: Mon 19 Feb 2007, 08:17
Location: Paris, France

#4 Post by gdemonta »

Thanks a lot HairyWill!
I will try this tonight on my puppy laptop as I'm at work now. I thought of gtksee as I didn't know qiv. But any idea is welcomed, as I don't have internet at home and won't be able to post back until tomorrow!
[color=blue]Dumbledore: "The evidence of the Dark Lord's return is incontrovertible"[/color]
IBM X31 - Puppy 2.16 Hard disk install with EZpup

User avatar
Getnikar
Posts: 143
Joined: Sat 17 Jun 2006, 02:34
Location: Gold Coast, Australia

Re: Load gtksee in automatic photo presentation

#5 Post by Getnikar »

gdemonta wrote:I was just wondering if it was possible to automaticly open a picture with the "presentation" mode of GTKsee, so we have a windows xp's equivalent.
It would be great to add the fullscreen and fit into screen -i and -s options
This is essentially what I have done.

Code: Select all

echo 'exec defaultImageHandler "$@"'>/root/Choices/MIME-types/image
echo 'gtksee -i -f "$1"'>/usr/local/bin/defaultImageHandler
Then, when you are in rox and click on any file whose mime-type is an image, gtksee shows the image full screen. Hit [Esc] to exit.

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#6 Post by HairyWill »

The creation of defaultimagehandler is a good point
this makes it much easier to modify the action for a number of similar mime types.

I found that I had to remove the more specific mime type entries such as image_jpeg image_x-png to allow the the generic type of image to be recognised.

This allows a two tier approach with a general handler for images and possibly a different one for some specific mime types.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
gdemonta
Posts: 190
Joined: Mon 19 Feb 2007, 08:17
Location: Paris, France

#7 Post by gdemonta »

Hi Hairy Will and Getnikar,
I tried the three solutions you posted:
- Hairy Will 1st: worked very well, except when the directory had a space in it (mine was "Mes documents") qiv couldn't open the pistures in it.
- Hairy Will 2nd: didn't worked, qiv tried to open pictures in the MIME types folder!
- Getnikar: Worked very well, except the lack of speed Hairy Will had foreseen, and the fact that you cannot actually do slideshow, you can only click on each picture, but it's a start!
But thanks a lot, by tweaking it a little more, maybe I will succeed in having the perfect slideshow!
[color=blue]Dumbledore: "The evidence of the Dark Lord's return is incontrovertible"[/color]
IBM X31 - Puppy 2.16 Hard disk install with EZpup

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#8 Post by HairyWill »

use of double quotes helps to solve the problem with spaces in the directory name but I haven't worked out how to cope with spaces in the image filenames.

Code: Select all

#! /bin/sh
cd "`dirname "$1"`"
FILE=`basename $1`
TAIL=`ls | sed -n '/'$FILE'/,$p'`
HEAD=`ls | sed -n '1,/'$FILE'/p'`
exec qiv -msd 2 $TAIL $HEAD
I'm not sure if it is me or qiv that it is the problem. I've tried this

Code: Select all

#! /bin/sh
cd "`dirname "$1"`"
FILE=`basename $1`
TAIL=`ls | sed -n '/'"$FILE"'/,$p' | sed 's/ /\\\ /'`
HEAD=`ls | sed -n '1,/'"$FILE"'/p' | sed 's/ /\\\ /'`
exec qiv -msd 2 $TAIL $HEAD
Which should escape the spaces but doesn't appear to work, it still considers the spaces as separators between the files . If I use ps to check the command that has been called I see

Code: Select all

qiv -msd 2 picture\ one.jpg picture\ two.jpg
If I try running this from the prompt it works

<edit id="1">removed a couple of nasty spurious quotes that got into the sed lines when I was retyping</edit>
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#9 Post by HairyWill »

Bomb proof?

Code: Select all

#! /bin/sh
cd "`dirname "$1"`"
FILE=`basename $1`
TAIL=`ls | sed -n '/'"$FILE"'/,$p' | sed 's/ /\\\ /'`
HEAD=`ls | sed -n '1,/'"$FILE"'/p' | sed 's/ /\\\ /'`
echo '#!/bin/sh' > /tmp/slideshow
echo 'exec qiv -msd 2' $TAIL $HEAD >> /tmp/slideshow
chmod 700 /tmp/slideshow
exec /tmp/slideshow
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
Getnikar
Posts: 143
Joined: Sat 17 Jun 2006, 02:34
Location: Gold Coast, Australia

#10 Post by Getnikar »

No not bombproof. You need to parse the parameter line in a loop: something like

Code: Select all

while "$1" ; do
  VFiles="$VFiles $1" ; shift
done
There are lots of examples around in shell scripts that give you the idea on how to do this .

Thanks for the info on qiv. I did not know it was there. It seems faster than gtksee, so I shall look at switching.

On a related note:
These apps that need wrappers need the PATH to be reversed. Puppies PATH of /bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin:/root/my-applications/bin is pretty much the reverse of what most unix/linux setup use. With the PATH set to something more like /root/my-applications/bin:/usr/local/bin:/usr/X11R7/bin:/usr/sbin:/sbin:/usr/bin:/bin you should be able to put a wrapper into your own bin to override one in /usr/local/bin, which itself might be a wrapper or alternative for an executable further down the stack. As far as I can see Puppies setup should be changed.[/code]

User avatar
Getnikar
Posts: 143
Joined: Sat 17 Jun 2006, 02:34
Location: Gold Coast, Australia

#11 Post by Getnikar »

ps Add "'s in as shown below?

Code: Select all

...
FILE="`basename $1`"
TAIL="`ls | sed -n '/'"$FILE"'/,$p' | sed 's/ /\\\ /'`"
HEAD="`ls | sed -n '1,/'"$FILE"'/p' | sed 's/ /\\\ /'`"

User avatar
Getnikar
Posts: 143
Joined: Sat 17 Jun 2006, 02:34
Location: Gold Coast, Australia

Re: Load gtksee in automatic photo presentation

#12 Post by Getnikar »

Getnikar wrote:This is essentially what I have done.

Code: Select all

echo 'exec defaultImageHandler "$@"'>/root/Choices/MIME-types/image
echo 'gtksee -i -f "$1"'>/usr/local/bin/defaultImageHandler
Then, when you are in rox and click on any file whose mime-type is an image, gtksee shows the image full screen. Hit [Esc] to exit.
Based on feedback above, this is better code for the /usr/local/bin/defaultImageHandler bit:

Code: Select all

#!/bin/bash
[ "$2" ] && vS=s
gtksee -if$vS "$@"
This runs gtksee as a slideshow if you select more than one file.

I also added the defaultImageHandler wrapper into the OpenWith directory. This is done in the rox gui, or run this comand

Code: Select all

ln -s ../../../../usr/local/bin/defaultImageHandler /root/.config/rox.sourceforge.net/OpenWith
Now. you can click on a graphics file in rox, [right mouse button] Open With defaultImageHandler, and they it runs full screen, and if multiple file are chosen (Ctrl-[left mouse button], then [right mouse button]) they run as a full screen slideshow.

BTW. When in gtksee fullscreen, again try [right mouse button] and select menub options to stop the slideshow, and/or exit full screen. From there you can select a 'Browse' toolbar icon to browse the directory where the files are.

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#13 Post by HairyWill »

http://www.murga-linux.com/puppy/viewto ... 226#125226
GuestToo wrote:you can right click any file and click Send To (or Open With) ... then click Customise

basically, you can put a symlink to a program in the Send To folder ... or you can copy or create a program, for example, a script, in the Send To folder

if you put a directory or symlink to a directory in the Send To folder, it will appear as a sub menu in the Send To menu

you can open the Send To menu quickly by right clicking a file or directory while holding down the shift key


another trick (nothing to do with the Send To folder): you can open multiple items by selecting the items and dragging them to the Home icon on the desktop ... for example, you could select 4 or 5 text files or mp3 files etc etc in /root and drag them to the Home icon
Last edited by HairyWill on Fri 29 Jun 2007, 12:11, edited 1 time in total.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#14 Post by GuestToo »

another alternative might be to install gqview

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#15 Post by HairyWill »

Bomb proof usually gets a reaction :-) even if it is used with a question mark.

Talking of the Open With menu qiv is in there already though of course it is not clear what it does, may renaming the link to "qiv-slideshow" would be good. Its lack of instruction are a problem and as it it just a symling to qiv with no parameters it does not reduce images to fit the screen until you hit the magic "m". Gtksee is much stronger in this respect. so works better for the newbie.

I tried viewing 1000 images from a fairly slow samba share, qiv took a few seconds to start gtksee took over a minute.

Thinking about it further clicking on a single file should not launch a slide show and qiv is the fastest single image viewer.

Getnikar thanks for the pointers on parameter parsing I haven't done that before it didn't work for me until I put square brackets around the test

Code: Select all

while [ "$1" ] ; do
  VFiles="$VFiles $1" ; shift
done
My original program was only expecting one parameter anyway, a single file, so it wasn't a problem I think.

Thanks for pointing out the missing quotes.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
Getnikar
Posts: 143
Joined: Sat 17 Jun 2006, 02:34
Location: Gold Coast, Australia

#16 Post by Getnikar »

HairyWill wrote:until I put square brackets around the test
Square brackets *are* the test. See 'man bash': '[ ..]' is alternative coding for 'test'.

Here is my new defaultImagehandler

Code: Select all

#!/bin/bash
if [ "$2" ] ; then
	qiv -fmtps "$@"
else
	if [ "$1" ] && [ -d "$1" ] ; then
		qiv -fmtps "$1"/*
	else
		qiv -fmtp "$1"
	fi
fi
It runs directories or multiple files as fullscreen slideshows, and shows single files fullscreen.

Thanks for the heads-up on qiv being already in OpenWith. Itworks well as is, to show single files at their original size. Of course, as you mentioned, hotkeys switch qiv to alternative views anyway, irrespective of how initially started. Either way, and with gtksee as well, Puppy has adequate image handling, although for finding an image quickly I still miss the iconised thumbnails that Ubuntu's Nautilus provides. Then again I am sure that that comes at a cost of overhead, so in the interest of maintaining a lean Puppy I probably would not want that sort of thing in Puppy.

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#17 Post by HairyWill »

nice, very neat, works well for me.

Playing devils advocate, because I want it both ways gtksee filters out the files that aren't images.

And whilst I'm being unreasonable qiv's source needs hacking so that the information bar also says "help(F1)" :wink:
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
gdemonta
Posts: 190
Joined: Mon 19 Feb 2007, 08:17
Location: Paris, France

#18 Post by gdemonta »

Everything looks great!! I'm going to try this over the week end. thanks all!
[color=blue]Dumbledore: "The evidence of the Dark Lord's return is incontrovertible"[/color]
IBM X31 - Puppy 2.16 Hard disk install with EZpup

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#19 Post by HairyWill »

Getnikar wrote:although for finding an image quickly I still miss the iconised thumbnails that Ubuntu's Nautilus provides
Rox does thumbnails, at maximum they are about 100 pixels across. Is that not what you want?
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
Getnikar
Posts: 143
Joined: Sat 17 Jun 2006, 02:34
Location: Gold Coast, Australia

#20 Post by Getnikar »

HairyWill wrote:
Getnikar wrote:although for finding an image quickly I still miss the iconised thumbnails that Ubuntu's Nautilus provides
Rox does thumbnails, at maximum they are about 100 pixels across. Is that not what you want?
Brilliant. Yes, thanks, now I see them - [Right click] on the Eye-con :-)

Post Reply