Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 21 Nov 2017, 08:20
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Building a universal file viewer
Post new topic   Reply to topic View previous topic :: View next topic
Page 4 of 12 [172 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, ..., 10, 11, 12 Next
Author Message
smokey01


Joined: 30 Dec 2006
Posts: 2657
Location: South Australia

PostPosted: Thu 09 Feb 2017, 19:30    Post subject:  

@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

_________________
Software <-> Distros <-> Tips <-> Newsletters
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Thu 09 Feb 2017, 22:31    Post subject:  

@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.
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 950

PostPosted: Fri 10 Feb 2017, 12:44    Post subject:  

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.

_________________
Fatdog64-710|+Packages|Kodi|Findnrun|+forum|gtkmenuplus

Last edited by step on Sat 11 Feb 2017, 15:08; edited 1 time in total
Back to top
View user's profile Send private message 
peebee


Joined: 21 Sep 2008
Posts: 3007
Location: Worcestershire, UK

PostPosted: Sat 11 Feb 2017, 13:13    Post subject:  

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

_________________
LxPup = Puppy + LXDE
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Sun 12 Feb 2017, 09:42    Post subject:  

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:
<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.
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4716
Location: Republic of Novo Zelande

PostPosted: Mon 13 Feb 2017, 02:22    Post subject:  

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:
textfile_no_display.jpg
 Description   
 Filesize   77.3 KB
 Viewed   529 Time(s)

textfile_no_display.jpg

Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4716
Location: Republic of Novo Zelande

PostPosted: Mon 13 Feb 2017, 02:35    Post subject:  

Is there any way to enable a rightclick "open with" menu in the chooser widget?
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Mon 13 Feb 2017, 08:07    Post subject:  

Dear MochiMoppel,

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

Code:

             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
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Mon 13 Feb 2017, 22:06    Post subject:  

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.
Back to top
View user's profile Send private message 
some1

Joined: 17 Jan 2013
Posts: 75

PostPosted: Tue 14 Feb 2017, 06:39    Post subject:
Subject description: read iso-encodings
 

Convert iso-encodings to UTF 8.
Inject this as a case-statement,fx. after the ascii-case
Code:

*charset=iso-*)
    iconv -f "ISO_${vSTATUSBAR##*=iso-}" -t UTF-8 "$vCHOOSER"  > $MSGFILE
    ln -fsn  "$MSGFILE"   $FILELNK
    ;;
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Tue 14 Feb 2017, 22:54    Post subject:  

I tried the script in tahrpup.
ffprobe and ffplay are missing. Does tahrpup offer alternatives?
Back to top
View user's profile Send private message 
fabrice_035

Joined: 28 Apr 2014
Posts: 433

PostPosted: Sat 18 Feb 2017, 04:35    Post subject:  

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:

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


bye.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Sun 19 Feb 2017, 23:29    Post subject:  

fabrice_035 wrote:
found solution, add octet-stream for support MKV files
Code:

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

Yes, you can, but you shouldn't Laughing

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:
    *│*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?
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Fri 10 Mar 2017, 09:50    Post subject:  

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 Laughing )
- 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.
mm_quickview_20170310.png
 Description   
 Filesize   130.06 KB
 Viewed   211 Time(s)

mm_quickview_20170310.png

Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Fri 10 Mar 2017, 11:45    Post subject:  

Dear MochiMoppel,

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

With kind regards,
vovchikl
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 4 of 12 [172 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, ..., 10, 11, 12 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0669s ][ Queries: 14 (0.0081s) ][ GZIP on ]