The time now is Sat 14 Dec 2019, 16:02
All times are UTC - 4 |
Page 1 of 21 [309 Posts] |
Goto page: 1, 2, 3, ..., 19, 20, 21 Next |
Author |
Message |
MochiMoppel

Joined: 26 Jan 2011 Posts: 1947 Location: Japan
|
Posted: Mon 30 Jan 2017, 04:05 Post subject:
Building MMview, a universal file viewer Subject description: ... using gtkdialog's chooser widget |
|
This recent thread about the undocumented chooser widget brought up the question: What can it be used for?
Not much, as it seems. Among the only 7 scripts in Slacko 5.6 which use it, only Nathan's wallpaper app uses it for image previews. All others use it as a simple file picker.
I take this as a challenge to build something more useful.
Ever since I used TotalCommander, a 2-pane file manager, I liked the Quickview feature: A file list in one pane and the content of the selected file in the other pane. For image files it would be a representation of the image, for text files it would be the file content, for zip files the content of the zip container. With add-ons other file formats may be readable/viewable.
Main Features of MMview
Supports common text formats
Supports most image formats, incl. RAW formats
Supports common audio/video formats (displays metadata, requires ffprobe or avprobe)
Supports common file compression formats
Supports eBook format EPUB
Supports directories (displays disk usage, sizes of subdirectories)
Supports executables (displays usage message)
Supports virtual files in /proc and /sys (for geeks!)
Search function
Command line interface
File create/rename/move/copy/delete
Horizontal or vertical layout
Fullscreen mode
Line wrapping
Line numbers
Can display file properties, MD5 checksums, ID3 tags of audio files
Can display image metadata (Exif, IPTC , XMP)
Can play audio files (requires ffplay or avplay)
Can play video files in separate window (requires ffplay or avplay)
Displays full paths, MIME types and charsets
Starts with last used directory and last used window size
Provides keyboard shortcuts for most actions
ROX-Filer compatible: "Open With ..." menu
ROX-Filer compatible: Shift+! opens shell command box
ROX-Filer compatible: Dblclick or Enter/Space key opens file in its default application
ROX-Filer compatible: Selecting file sends its full path to PRIMARY buffer
Built-in standard features (but nevertheless noteworthy)
Drag'n'drop from Chooser to Desktop: Creates desktop shortcut
Drag'n'drop from Chooser to ROX-Filer: Copies file (while pressing Shift: moves file)
Drag'n'drop from ROX-Filer to Chooser: Jumps to the file in list (changes chooser's directory as needed)
Entering first letter of a file name jumps to the file in list
Changelog
2019-10-29
Added: More support for binary files (view ASCII strings)
Added: ASCII table
Added: Support for image formats CURSOR, QIF/QTIF and ICNS
Fixed: MMview may not restart in last used folder
Fixed: Issue with right-to-left characters (e.g. Arabic)
2019-08-29
Added: Support for busybox v1.30 or newer
Changed: Various keyboard shortcuts
Fixed: Several minor incompatibilities with new distros
2019-07-02
Added: "Convert text string" dialog now also generates each character's Unicode UTF-16 codepoint
Improved: MMview can start with a specific file selected and not just with a file's directory (requires xdotool)
Fixed: When text displayed in fullscreen mode tooltip may stay on screen even after closing fullscreen mode
2019-04-09
Added: Support for binary files (display of hex values)
Added: Tool to convert text strings into UTF-8 character codes
Changed: Menu layout
2018-11-01
Added: Support for ROX-Filer's "Open With..." actions (aka Right-click actions)
Changed: MiddleClick now opens "Open with..." dialog
2018-09-20
Added: Support for RAW and many other image formats (see update post)
Added: Support for image metadata (Exif, IPTC , XMP)
Added: Option to disable Instant View mode
Changed: "Fit images to viewer size" now default mode, previous "Original size" mode removed
2018-08-03
Improved: Properties view now largely compatible with ROX-Filer's Properties dialog
Added: "Count" display for directories, compatible with ROX-Filer's Count dialog
Added: Menu item "Compress/Decompress" (Ctrl+G)
Changed: Location of config settings
Improved: Various features (see update post)
2018-05-19
Added: Menu item "New". Creates new file or directory
Added: Menu item "Properties". Displays file properties
Added: Toolbar button "Properties"
Added: Menu item "MD5 checksum". Displays MD5 checksum and checks file against MD5 history
2018-04-19
Added: Optional line wrapping
Changed: Menu layout
2018-01-17
Added: Support for eBook format EPUB
Added: Support for image formats ANI and PCX
Added: Toolbar
Removed: Shift+Click functionality (open in default editor)
Improved: Various features (see update post)
2017-11-09
Added: Toggle text fullscreen
Fixed: Some issues re. multiuser and alternative window manager support (thanks SFR)
Removed: Ability to save last window position
Improved: Various features (see update post)
2017-10-20
Added: Toggle images fullscreen (size 100%)
Added: Toggle images fullscreen (size fit to screen)
2017-09-13
Added: Better command line compatibility
Added: Open commandbox with last command
Added: Command line history
Removed: VTE (terminal) support
2017-08-07
Added: Basic file management functions Rename/Move/Duplicate/Delete
Added: Support for Lucid 5.2.8 (and probably other older Puppies)
2017-06-22
Fixed: Compatibility issue with Fatdog
2017-06-21
Added: Support for HTML (*.htm/html), Abiword (*.abw), Notecase (*.ncd) files
2017-05-24
Fixed: Removed a comment that caused a buffer overflow error on some systems
2017-05-22
Added: Shell command box
Added: Terminal pane
Added: Tooltips for all menu items in "View","Commandbox" and "Terminal" menus
Added: Shortcut for start/stop of audio/video play (Ctrl+Z)
Changed: Menu structure
2017-04-16
Added: Menu item "Show line numbers" ; Shortcut F2
Added: Menu item "Refresh" ; Shortcut F5
Added: Menu item "Find ..." ; Shortcut Ctrl+F
Added: Menu item "Find again" ; Shortcut F3
Added: Support for initrd.gz images (thanks SFR)
Added: Support for .iso images and .zip , .7z archives
Changed: Shortcut for "Execute selected file in console" from F5 to Ctrl+F5
Changed: Shortcut for "Open in default editor" from F2 to Ctrl+E
Removed: Display of disk usage for symlinked directories and directory /proc
2017-04-06
Added: Display of archive contents (supported formats .tar, .pet , .txz, .gz , .gzip, .bzip2, .deb). Experimental!
Added: On-demand info for directory disk usage. Includes subdirectories (first level only, largest first). Shortcut F1
Added: Run menu
Added: Option to run selected executable in console. Shortcut F5
Improved: Displaying directory size now times out after 1 sec. to prevent stutter. F1 can be used instead.
2017-03-20
Added: Vertical layout option (Preferences menu)
Added: Support for audio/video files in Tahrpup
Improved: Better use of available viewer area
Improved: Better support for SVG files
Various minor improvements
2017-03-10
Added: Preferences menu
Added: Option to scale images to viewer size (thanks some1)
Added: Option to autoplay video files
Added: Support for *.mkv and *.wma files
Added: Support for "iso*" and "unknown-8bit" charsets (requires iconv)
Fixed: F2 now works
Improved: Autoplay option for audio files can now be set from menu
Improved: Several performance optimizations
2017-02-12
Added: Menu bar
Added: Keyboard shortcuts
Added: Display of usage message for executables (on demand)
Added: Display of directories' total size (disk usage)
Added: (Invisible) refresh button. Used by chooser widget. Prevents repeated file inputs of same file.
Improved: Compatibility with various Puppies ( 'x-' prefix removed from MIME types)
Improved: Performance when killing audio streams
2017-02-09
Added: scrollbars for images larger than viewer pane (thanks dejan555)
Fixed: selecting files didn't preserve "accessed" and "changed" timestamps, causing ROX to mark files in bold
2017-02-05
Changed: 'pkill' to 'busybox pkill'. Some Puppies seem to miss the busybox symlink (thanks dejan555)
Removed: Some redundant code in fill_statusbar function
2017-02-04
Added: Shift+Click support for text files
Added: Support for ID3 tags and audio/video encoding info; Requires ffprobe
Added: Autoplay support for audio/video files (experimental and disabled by default); Requires ffplay
2017-01-30
First version
Newest gzipped version
 |
Description |
Uncompress gzipped file and make script executable
|

Download |
Filename |
mm_view_20191029.gz |
Filesize |
21.78 KB |
Downloaded |
1401 Time(s) |
Description |
Screenshot shows older version 2017-02-09 |
Filesize |
233.85 KB |
Viewed |
3751 Time(s) |

|
Last edited by MochiMoppel on Tue 29 Oct 2019, 02:17; edited 67 times in total
|
Back to top
|
|
 |
greengeek

Joined: 20 Jul 2010 Posts: 5624 Location: Republic of Novo Zelande
|
Posted: Mon 30 Jan 2017, 05:19 Post subject:
|
|
Nice. Looks handy. I will give this a workout over the next few days. So far a couple of comments:
1) I navigated to a .wav and clicked it - it played in pmusic but then the "NAD5" theme of pmusic disappeared and returned to a default theme. I guess this is nothing to do with navigating via mm_quickview - just some peculiarity of my system but thought I would mention it anyway. Will post back if I find the trigger for this behaviour.
2) I felt it would have been nice to have an "up" arrow or "back arrow". Of course it is possible to click on the directory titles shown above the "places" pane, but it would have been more natural to have an arrow if poss.
Looks good!
EDIT ps: I did not understand what is meant by "Drag'n'drop Chooser => ROX-Filer: Copies file " (will try more tomorrow)
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6609 Location: Valåmoen, Norway
|
Posted: Mon 30 Jan 2017, 14:48 Post subject:
|
|
This is a great initiative. Maybe we will for the first time see a workable filemanager based on gtkdialog.
Quote: | Entering first letter of a file name jumps to the file in list | This beats Rox
Maybe the quickview feature could embed a simple audioplayer as well. The following commands will both play most audio. The latter will play video too...
Code: | ffmpeg -i /path/input_file.mp3" -f au - | aplay
ffplay -i /path/input_file.mp3
|
_________________ Stardust resources
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1512 Location: Ukraine
|
Posted: Mon 30 Jan 2017, 15:54 Post subject:
|
|
Dear MochiMoppel,
Brilliant idea and already working nicely. Yes, many tweaks and enhancements may follow, but it is already a great idea and functioning thing. Thanks.
With kind regards,
vovchik
|
Back to top
|
|
 |
belham2
Joined: 15 Aug 2016 Posts: 1707
|
Posted: Mon 30 Jan 2017, 16:23 Post subject:
|
|
Wow, mochi, this thing is something! I am always fooling with simple scripts and/or setting up *.desktop files w/ them, and Quickview lets me see all this stuff immediately. Plus, upon re-opening, it remembers where I left off. That is awesome! What would be incredible is what I wrote in the pic I put below (the highlighted). Still, Quickview is already good, and I am in the process of replacing ROX (I usually have 2 file mgrs always, usually PCManFM or Thunar along with ROX). Now ROX is getting removed and replaced by this! I love it. I hope it keeps moving forward and more new features are added. Thank you, Mochi!!
Here it is working in X-tahr-2.0:
Description |
|
Filesize |
206.65 KB |
Viewed |
3494 Time(s) |

|
|
Back to top
|
|
 |
keniv
Joined: 06 Oct 2009 Posts: 569 Location: Scotland
|
Posted: Mon 30 Jan 2017, 17:54 Post subject:
|
|
@MochiMoppel
I have it working in the latest version of Lucid 5287 s2. Very fast. However it does not work in Wary 5.5. I used the same file for both and put it in the same place in both. Here is the output of running it in Wary in a terminal.
Code: | # mm_quickview
/root/my-applications/bin/mm_quickview: line 57: unexpected argument `(' to conditional binary operator
/root/my-applications/bin/mm_quickview: line 57: syntax error near `(^'
/root/my-applications/bin/mm_quickview: line 57: ` if [[ $vCHOOSER =~ (^/sys/) ]] ;then '
|
I'm not sure what this means but I hope it means something to you. Any hope of getting it to work in wary?
Regards,
Ken.
|
Back to top
|
|
 |
Rattlehead

Joined: 11 Sep 2008 Posts: 367
|
Posted: Mon 30 Jan 2017, 18:41 Post subject:
|
|
Tested in Tahr605, works flawlessly.
Impressive. Kudos. Additionally, in this case, considering GTK-Dialog's syntax, that looks like freaking barb wire. Whenever I try to come up with something myself I have to take an aspirin later...
|
Back to top
|
|
 |
slavvo67
Joined: 12 Oct 2012 Posts: 1617 Location: The other Mr. 305
|
Posted: Mon 30 Jan 2017, 19:25 Post subject:
|
|
Very nice... ahhh but those pesky pdf files...
|
Back to top
|
|
 |
drunkjedi

Joined: 24 May 2015 Posts: 897
|
Posted: Mon 30 Jan 2017, 21:08 Post subject:
|
|
Hi MochiMoppel,
Great coding again friend.
Thanks mate.
Great thing about these simple codes, they work on both 32 and 64bit...
zigbert wrote: | Quote: | Entering first letter of a file name jumps to the file in list | This beats Rox  | ROX in Fatdog does this.
It's a forked branch by Jun7 or something similar, I don't remember exactly.
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6609 Location: Valåmoen, Norway
|
Posted: Tue 31 Jan 2017, 08:20 Post subject:
|
|
drunkjedi wrote: | zigbert wrote: | Quote: | Entering first letter of a file name jumps to the file in list | This beats Rox  | ROX in Fatdog does this.
It's a forked branch by Jun7 or something similar, I don't remember exactly. | Thanks for the info !
_________________ Stardust resources
|
Back to top
|
|
 |
MochiMoppel

Joined: 26 Jan 2011 Posts: 1947 Location: Japan
|
Posted: Tue 31 Jan 2017, 22:52 Post subject:
|
|
Thank you all for the unexpected feedback. I hope not to raise too high expectations with this little exercise. After all gtkdialog's toolkit is quite limited, and so is the chooser widget.
My intention is to keep it simple and fast. Speed benchmark: Scrolling through chooser's file list with the UP and DOWN keys on my old Atom netbook. This requires a lot of refreshes and calculations. If scrolling stutters and doesn't feel snappy anymore, I don't implement it - at least not for this auto viewing mode. On demand viewing options for processor intensive tasks may come later.
@greekgeek: I'm sure you will figure it all out when you play with it
@zigbert: I have no intention to turn this into a file manager. I have to be careful not to let it head too far into that direction. My conscience forbids me to build something even less feeble than ROX-Filer .
Playing audio files is not a problem. The problem is chooser's event handling. You will not care and not even notice when text in the viewer pane is refreshed twice, but you will be utterly annoyed when audio is refreshed repeatedly.
@vovchik: Thank you for your kind encouragement.
@belham2: Good idea. Text in the viewer can be edited, so why not save it? This was one of the first thoughts that came to my mind. 2 reasons why I gave up on it:
1) Conceptually this should remain a viewer. The user should have confidence that no action will change the source data. Allowing saving or even auto-saving would not fit into this concept.
2) Theoretical it would be possible only for smaller files. There is a limit of ~128K for variable size, which will cause chooser to freeze when you attempt to read files bigger than that. I avoid this limitation by setting the variable to export="false", but his makes saving impossible.
Of course you are right that there should be an easy way to edit and save a script that you see in the viewer. One way that already works: drag&drop the file to a Leafpad desktop icon or whatever you want to edit it with (it is not possible to "embed" Leafpad into the viewer pane).
ROX-Filer has a nice solution: When you Shift+click on a text file, the file will open in the default editor. I like that. Gtkdialog does not support mouse+key combinations, but I will implement it somehow. Maybe I should give this priority.
@keniv: Looks like an old bash version in Wary 5.5. Try to steal /bin/bash from a newer Puppy and copy it to Wary 5.5.
@Rattlehead: Aspirin is not good for you. A glass of Rioja Gran Reserva works better!
@slavvo67: Trying to view PDFs in anything else than a dedicated PDF viewer is a waste of time. This goes for many other formats.
@drunkjedi: Thanks for testing in 64bit Puppies.
[Edit] Removed reference to bash with regard to 128k variable limit.
Last edited by MochiMoppel on Tue 05 Sep 2017, 12:27; edited 1 time in total
|
Back to top
|
|
 |
slavvo67
Joined: 12 Oct 2012 Posts: 1617 Location: The other Mr. 305
|
Posted: Tue 31 Jan 2017, 23:02 Post subject:
|
|
Acknowledged. One note, at least in 64 bit, the viewer seems to zoom jpg photos at maybe a 200 % or more. Not sure if it was intended to view photos but just a comment. In that light, it also doesn't adjust with the window size of the file viewer so it will look like maybe a 300% zoom when the file viewer is not full screen and maybe 200% when the file viewer is maximized.
I used something similar in Windows quite a while back. Has anyone tested this with files like .eml for example?
|
Back to top
|
|
 |
keniv
Joined: 06 Oct 2009 Posts: 569 Location: Scotland
|
Posted: Wed 01 Feb 2017, 12:26 Post subject:
|
|
@MochiMoppel
Quote: | Looks like an old bash version in Wary 5.5. Try to steal /bin/bash from a newer Puppy and copy it to Wary 5.5. | .
As you suggested, I swapped /bin/bash from Lucid 5287 s2 which as I said I also use and mm_quickview is now working on Wary 5.5.
Thanks for the help.
Ken.
|
Back to top
|
|
 |
Rattlehead

Joined: 11 Sep 2008 Posts: 367
|
Posted: Thu 02 Feb 2017, 13:35 Post subject:
|
|
MochiMoppel wrote: |
@Rattlehead: Aspirin is not good for you. A glass of Rioja Gran Reserva works better! |
Thank you for the medical advice, 100% agreed, I used the word "aspirin" as a metaphor only
|
Back to top
|
|
 |
MochiMoppel

Joined: 26 Jan 2011 Posts: 1947 Location: Japan
|
Posted: Thu 02 Feb 2017, 23:07 Post subject:
|
|
drunkjedi wrote: | zigbert wrote: | Quote: | Entering first letter of a file name jumps to the file in list | This beats Rox  | ROX in Fatdog does this.
It's a forked branch by Jun7 or something similar, I don't remember exactly. | I find it hard to believe that this works. ROX-Filer uses single characters !,? or = as shortcuts and the user can define more single letters as menu shortcuts. It has to be either jump to file or honor shortcut. ROX-Filer can hardly do both at the same time.
|
Back to top
|
|
 |
|
Page 1 of 21 [309 Posts] |
Goto page: 1, 2, 3, ..., 19, 20, 21 Next |
|
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
|