Page 3 of 18

Posted: Thu 09 Feb 2017, 23:30
by smokey01
@MM which is the latest script? The one with the fake .gz still has the -p switch which causes the filenames to be bold. The script in the code box says it's the first script. Maybe providing the script in the first post with a fake .gz and a version in the filename might be clearer.
Thanks

Posted: Fri 10 Feb 2017, 02:31
by MochiMoppel
@smokey01 Thanks for the hint. I hope I made it clear now that only the version in the first post is the newest one. It appears that also dejan555 got confused.

Very soon I might have to stop the code listing and turn to downloadable script since the code is getting too fat.

Posted: Fri 10 Feb 2017, 16:44
by step
Hi MochiMoppel, If I click a symbolic link to a text file the view pane is blank. Is it a limitation of the chooser GTK widget? Thanks for this script.

edit: MochiMoppel followed up by PM. the problem is identified and solved.

Posted: Sat 11 Feb 2017, 17:13
by peebee
MochiMoppel wrote:....You need to use proper quoting in this script .... or you could simple symlink to defaultfilemanager, where you did the quoting right, hence no problems with defaultfilemanager.
Thanks for the pointers - they led me to make other beneficial changes.....

Posted: Sun 12 Feb 2017, 13:42
by MochiMoppel
New features in update 2017-02-12 (see also initial post)

Menu bar (shortcut F10)
Offers keyboard access for all and shortcuts for most functions.

Usage messages for executables
Most binaries in the various bin directories display a short usage message when the user types

Code: Select all

<filename> --help
into a console. Sometimes it should rather be -help, -h or nothing at all... no rules ... hit and pray.
The script tries --help and -help and displays the output in the viewer pane. Most of the times it succeeds. It's a convenient way to get an idea what all these little programs are about.

Since this function executes a file and not just reads it, it is available only on demand (shortcut F1) .
The function contains some safeguards against "rogue" utilities:
- Works only for programs which contain the string 'usage:'
- Runs the program in a tiny console window
- Kills the console automatically, latest after 0.5 sec.

Directory tree size
The script displays the disk usage of a directory tree (command du -hs ). Symlinks and directories containing only zero size files are displayed as 0, completely empty directories are displayed as empty.
Can be a bit slow for very large directories but generally the speed is acceptable.

Window size and position
The script now remembers its last size and position on screen if the user closes the window with the Close button or the (new) keyboard shortcut Ctrl+Q.

Posted: Mon 13 Feb 2017, 06:22
by greengeek
Love the way the viewer displays the size when you singleclick a directory. Very handy.

I do have a problem with it not displaying some text files. Is this due to my locale or the encoding selection or something? I can read the file pci.ids but not the file usb.ids
See attached pic:

Posted: Mon 13 Feb 2017, 06:35
by greengeek
Is there any way to enable a rightclick "open with" menu in the chooser widget?

Posted: Mon 13 Feb 2017, 12:07
by vovchik
Dear MochiMoppel,

It is getting better all the time. One thing I miss, though, from an earlier version is:

Code: Select all

				 ctl=`file -b "$vCHOOSER"|awk -v mw="$MAXUNSCALED_X" -v mh="$MAXUNSCALED_Y" '{if ($(NF-2)*$NF!=0){if ($(NF-2)<=mw&&$NF<=mh){z=1} else z=2;print z;}}'` 

and 

                 ctl=`exiv2 -ps "$vCHOOSER"|awk -v mw="$MAXUNSCALED_X" -v mh="$MAXUNSCALED_Y" 'NR==4&&NF>3{if ($(NF-2)*$NF!=0){if ($(NF-2)<=mw&&$NF<=mh){z=1} else z=2;print z;}}'`

in the case statement and this in the gtkdialog part:

<width>'$MAXUNSCALED_X'</width><height>'$MAXUNSCALED_X'</height>

I wonder whether that could not be an option that could be set in the menu.

With kind regards,
vovchik

Posted: Tue 14 Feb 2017, 02:06
by MochiMoppel
greengeek wrote:I do have a problem with it not displaying some text files. Is this due to my locale or the encoding selection or something?
No.Yes.No.
I have included support for iso-8859-1 in my private edition but didn't include it in the posted version. Given that it requires an extra utility and that it is not widely used I thought I should wait until I know if there is demand for it. I also have no clue what other encodings need support, so if anyone can enlighten me I would be grateful.
greengeek wrote:Is there any way to enable a rightclick "open with" menu in the chooser widget?
There is no way to enable any rightclick action since chooser's built-in rightclick dialog can't be removed/customized.
vovchik wrote:One thing I miss, though, from an earlier version is:
It was never included in an earlier version. Of course you are free to implement some1's code if it suits your needs. I still prefer dejan555's solution.

Posted: Tue 14 Feb 2017, 10:39
by some1
Convert iso-encodings to UTF 8.
Inject this as a case-statement,fx. after the ascii-case

Code: Select all

*charset=iso-*)
    iconv -f "ISO_${vSTATUSBAR##*=iso-}" -t UTF-8 "$vCHOOSER"  > $MSGFILE
    ln -fsn  "$MSGFILE"   $FILELNK
    ;;

Posted: Wed 15 Feb 2017, 02:54
by MochiMoppel
I tried the script in tahrpup.
ffprobe and ffplay are missing. Does tahrpup offer alternatives?

Posted: Sat 18 Feb 2017, 08:35
by fabrice_035
Hi,

Nice idea, but i found a problem with ffprobe and MKV files, show nothing.

:wink:

[edit]
found solution, add octet-stream for support MKV files

Code: Select all

    *│*audio*|*│*video*|*octet-stream*|*'.mp3 '*|*'.ogg '*)      
bye.

Posted: Mon 20 Feb 2017, 03:29
by MochiMoppel
fabrice_035 wrote:found solution, add octet-stream for support MKV files

Code: Select all

    *│*audio*|*│*video*|*octet-stream*|*'.mp3 '*|*'.ogg '*)      
Yes, you can, but you shouldn't :lol:

octet-stream can be anything. It only tells you that it's a binary. It shouldn't be used in the case statement.
Instead you should use the file extension.

So far I didn't give much attention to videos.
With autoplay enabled you can hear them....not much fun

If you put the following case before the *│*audio*|*│*video*|*'.mp3 '*|*'.ogg '*) case you can actually see them. They will appear in a small external window. Sorry, no way to embed them in gtkdialog:

Code: Select all

    *│*video*|*'.mkv '*)
        if (( $AUTOPLAY )) ;then
            ffplay -x 320 -y 180 -i "$vCHOOSER"  &
            echo -n $! > $PID_FFP
        fi
        ffprobe "$vCHOOSER" > $MSGFILE
        ln -fsn  $MSGFILE     $FILELNK
        ;; 
This still needs some tweaks which I will include in the next update, but for now it should work. Does it?

Posted: Fri 10 Mar 2017, 13:50
by MochiMoppel
New features in update 2017-03-10 (see also initial post)

Image scaling
Based on some1's proposal this solution removes most of my initial concerns and includes some improvements:
- Scaled or unscaled display can be set in the new Preferences menu        (vovchik, I heard you :lol: )
- The selected mode becomes effective immediately. No restart required.
- A new text label indicates if the displayed image is scaled or not
- The scale is determined by the intial window size.Though it can't be changed dynamically by resizing the window during a session, it can be changed by resizing the window, followed by a restart (the last window size is saved and used as default for the restart)
- The image is loaded only by the notebook page used for display, not for both pixmap pages

Autoplay
Autoplay for audio and video files is implemented and can be enabled via the Preferences menu. The chosen setting takes effect immediately.

New file formats
Some new file formats and codesets are supported.

Posted: Fri 10 Mar 2017, 15:45
by vovchik
Dear MochiMoppel,

Thank you! It is really well written, and performs beautifully. And thanks for the scaling preference. :) This is a very nice little app, guys!

With kind regards,
vovchikl

Posted: Sat 11 Mar 2017, 05:51
by mavrothal
This is a REALLY nice utility.
I think should be in every puppy!
I can understand that you may not want to have it in woof-CE (you might reconsider though...) but maybe have it as a pet to facilitate the build process.

A couple of issues that you might consider addressing is the appearance of /mnt/home as (the proper mount point name) "dev_save", that may be a bit confusing. It is also a duplication since the relevant partition is also shown.
There is also no indication if a partition is mounted. Partitions auto-mount if clicked upon but provide no way to unmount them. BTW not sure how partitions are ordered in the side panel. Reverse volume-forward partition?

Anyway, is still super. 8)

Posted: Sat 11 Mar 2017, 07:38
by greengeek
Thanks for sorting the encoding handling - /usr/share/usbids now displays correctly on my system. (This file is a very interesting list of known usb device ids - a good reference)

If I close the mmquickview window by using the "close" radio button it will remember (and display) the last_viewed_directory (or item) when I next start the utility. Alternatively if I terminate the window by clicking the X button it does not remember the directory or item I was viewing during the previous run. Is there any way to allow mmquickview to remember it's last viewed directory when X is clicked?

One thing I like about having a viewer is that I can investigate the code within my scripts just by clicking them - no more risk of the code being actually executed when I click. (how often have I clicked on various text files to read them then accidentally clicked an executable script and started to panic about what it is doing...)

cheers!

Posted: Sat 11 Mar 2017, 12:56
by jamesbond
Very nice code. Do you mind if I get this included in Fatdog?

Posted: Sat 11 Mar 2017, 14:17
by belham2
jamesbond wrote:Very nice code. Do you mind if I get this included in Fatdog?
+1


Told ya, Mochi, it was just a matter of time. :wink: Quickview has worked great in all the dpup-stretch builds I'm experimenting with. Never even thought to drop it in Fatdog64, I assumed it would not work right out of the box. Gonna try now that James posted :D

Posted: Sat 11 Mar 2017, 15:40
by drunkjedi
belham2 wrote:Never even thought to drop it in Fatdog64, I assumed it would not work right out of the box. Gonna try now that James posted :D
I already tested it mate.
Works nicely in Fatdog.

Most scripts work in 62 bit as well as 32 bit.