Building MMview, a universal file viewer

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

#196 Post by perdido »

MochiMoppel wrote:Update 2018-04-19 (see also initial post)
Got most of them :)
Missing 5-24-17 & 5-22-17

Thanks mochimoppel!

Image

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#197 Post by MochiMoppel »

perdido wrote:Got most of them :)
Missing 5-24-17 & 5-22-17
:lol:
Try ebay

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#198 Post by MochiMoppel »

mfb wrote:As shown in the image - I've clicked the icon immediately below "Help" , chosen the "root" directory, then typed a lower case "m" and the single file and the three unhidden directories which start with that character are listed.

My questions are - is the list for information only - or can I view any of the four items directly from the list and, if so, how?
You can view any of the listed items by pressing F5 (Refresh)
This location box (and the search box) are part of the chooser widget and make more sense when the chooser is used as originally intended - as a mere file picker, where the chooser would close after the user picked a filename and pressed an OK button.

Gtkdialog does not make these elements available for programming and I see little use for them in MMview. One thing you can do is to paste a file path into the location box and view the file immediately (after pressing F5). No need use the tree. The tree remains unchanged (see screenshot).

BTW: This widget is the basis for the File-Open dialogs in most GTK applications like Geany,Leafpad,Palemoon,Firefox etc. Unless you have selected Search or Recently Used, some built-in keyboard shortcuts can be used:
- Ctrl+L toggles the location box
- Typing '/' (forward slash) will open it too
- My favorite: Ctrl+V will open it and paste the content of the clipboard. (not supported in Geany)
All these tricks are supported in MMview.

IMO the search box works a bit better. It searches for files in your $HOME directory (usually /root), populates the tree with the results and keeps the entry even after closing the box, though apparently no keyboard shortcuts are available.
Attachments
location_box.jpg
(55.6 KiB) Downloaded 661 times

mfb

#199 Post by mfb »

My thanks to MochiMoppel (the author of this "viewer") for his helpful answer in the post immediately above and also for this entire project.

Explorers will find 25 Main + 4 Built-in (well worth a read) features currently listed in the opening post at page 1 of this thread and, of course, the download should they wish to try them.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#200 Post by MochiMoppel »

Update 2018-05-19 (see also initial post)

Rearranged and simplified "File" menu. Three new features added.

New (file or directory)
This combines the "New Blank file" and "New Directory" menu items of ROX-Filer into one menu item. Shortcut Ctrl+N is same as in ROX-Filer. To create a directory a trailing / (slash) has to be added to the new name.
Unfortunately gtkdialog is unable to reliably determine the currently displayed directory (if a selected or currently entered directory is empty). For this reason the full filepath is provided as default template.

Properties
Layout similar to the ROX-Filer dialog. Most of the values are the result of a single stat command. The "Used on disk" size information for files is not available in ROX-Filer and may be useful (and hopefully is correct :lol: )
Some other ROX specific items like "Run action" are (not yet) implemented.

MD5 checksum
Does what it says. The twist is that it records previously checked files and their checksum and thus makes it easy to find identical files or answer the nagging question "Are these 2 file identical?"

Have fun!
Attachments
new_features_mm_view_20180519.jpg
(95.34 KiB) Downloaded 435 times

User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

#201 Post by perdido »

MochiMoppel wrote:[size=16
MD5 checksum
Does what it says. The twist is that it records previously checked files and their checksum and thus makes it easy to find identical files or answer the nagging question "Are these 2 file identical?"

Have fun!
Hi MochiMoppel,

Will the recorded md5 checksum survive a reboot?

Thanks for the new version!

.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#202 Post by tallboy »

Hello MochiMoppel.
Can you tell me if there is a way to make a better view of which column is active? Independent of which theme I use, the 'active' fields in the columns have the same colour, and only an almost invisible dotted line around the field indicate which on is the active one at the moment, so I navigate up and down the wrong column all the time. Is it possible to make a frame around the active field, or maybe the active column, in a different color? I use Lucid 5.2.8.7.
I would also appreciate a list of all key shortcuts that can be used, both those from mm-view and rox and possibly also from gtkdialog.
Attachments
mm-view.png
(63.57 KiB) Downloaded 347 times
True freedom is a live Puppy on a multisession CD/DVD.

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

#203 Post by greengeek »

tallboy wrote:Can you tell me if there is a way to make a better view of which column is active? Independent of which theme I use, the 'active' fields in the columns have the same colour, and only an almost invisible dotted line around the field indicate which on is the active one at the moment, so I navigate up and down the wrong column all the time..
I use the arrow (highlighted in green below) as an indicator of active column. Also shows the direction of sort (ascending or descending). Or did I misinterpret your question?
Attachments
Active.jpg
(62.89 KiB) Downloaded 307 times

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#204 Post by tallboy »

I am afraid you did! :D That arrow is still there if you navigate up and down in the leftmost Places column with Root/Desktop/Filesystem etc.
If you use the arrow keys to move focus between the two columns, there is no good indication of which colummn you visit right now, you cannot see which one is active in the picture.
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#205 Post by MochiMoppel »

perdido wrote:Will the recorded md5 checksum survive a reboot?
Well, I would be surprised if anything survives a reboot.
Currently the config directory is set as CNFGDIR=$HOME/tmp/mm_view/ which - at least in earlier Puppies - is a tmp directory not saved at shutdown. I explained earlier that I don't want to leave any traces of this beta script in the user's system. Many users might try it once and then want to forget about it. Maybe it's time that I change this setting to CNFGDIR=$HOME/.config/mm_view/. The frustrated early adopters are probably gone by now :lol:

As for the MD5 history: It's currently set (look at the beginning of the script) as MD5LIST=${TEMPDIR}md5list.tmp , so it won't even survive a MMview restart. If you change this to MD5LIST=${TEMPDIR}md5list.txt it will stay alive until you shut down Puppy. If you need the list even after a reboot I would be interested to know why. The setting for this would be MD5LIST=${CNFGDIR}md5list.txt.

@tallboy: You asked the same question 11 months ago. Did you read my response?

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#206 Post by musher0 »

/var/tmp lasts a little longer.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#207 Post by tallboy »

Sorry MochiMoppel, my memory is clearly not what it was...
(I've forgotten the answer too, so I'll start digging.)

OK, found it!
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#208 Post by MochiMoppel »

tallboy wrote:OK, found it!
And? Did you fix the issue of your Stardust theme or find a better theme?

As many of the customized GTK themes Stardust fails to distinguish between "active" and "selected" status. It shouldn't as the difference is important, not just in MMview but also in ROX-Filer. Less important but still annoying to me the failure to distinguish between a "prelight" and "selected" button.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#209 Post by tallboy »

MochiMoppel wrote:And? Did you fix the issue of your Stardust theme or find a better theme?
Neither! :oops:
I have always been honest, and I hope my answer will not embarrass you. I actually switched back to my good, old lynx! It is faster in use, and have all the functions I need, but it doesn't have a nice, modern GUI like mm_view.
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#210 Post by MochiMoppel »

I've now checked some more GTK themes. Some are a bit better than Stardust but the differences in contrast are marginal.
I didn't find a single customized theme where buttons look like buttons and appear "sunken" when they are pressed. The only theme that gives this useful visual feedback (and also provides a decent contrast) is the default Raleigh theme and its sibling Emacs.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#211 Post by MochiMoppel »

I intend to add "Run action" to the MMview Properties display and mimic the Properties dialog of ROX-Filer

ROX-Filer determines the "run action" by the MIME type.
So the question is: How does ROX-Filer determine the MIME type?

MMview uses the file command to retrieve the MIME type and displays it in the statusbar. ROX-Filer often disagrees.

While file looks into a file and determines MIME types primarily by magic numbers, ROX-Filer firstly tries to determine MIME by the file extension (as defined in /usr/share/mime/globs). Consequently ROX-Filer is easily fooled by a fake extension. Add a .jpg extension to any file and ROX-Filer "sees" an image file.

It would be not my job to correct ROX. If ROX produces nonsense MMview would have to faithfully reproduce the nonsense.
I thought that this would be easy with the -m option of the rox command:

Code: Select all

-m, --mime-type=FILE	print MIME type of FILE and exit
Two surprises:
1) The MIME type rox -m outputs may depend on the state of the executable file attribute. For files on a FAT file system, where the executable attribute is automatically set for all files, this may lead to funny results.

2) ROX-Filer's properties dialog may not agree with the output of rox -m. With ROX-Filer having its own method of MIME sniffing the prediction of the run action becomes difficult.

In order to sort out this mess I have listed MIME types produced by different commands and for different filenames and attributes. I marked results which I find plain wrong red, those acceptable yellow and the "good" ones green.

Based on this table I will have to come up with a formula for MMview.
Attachments
mime_types.png
(55.69 KiB) Downloaded 850 times

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#212 Post by MochiMoppel »

Another day, another ROX oddity.

I stumbled upon the "Count" dialog. This dialog is very impressive and I would like to copy the functionality for MMview. It is very fast. E.g. after selecting the /usr directory the "Count" dialog tells me in the blink of an eye that this directory contains 369 M, in total 13226 files in 1191 directories.
Good. But this isn't "disk usage" as it claims. 369 M is the sum of 13226 single file sizes.

On the other hand the "Properties" dialog shows disk usage - sometimes. It does it only for directories. For single files it shows filesize in byte units. ROX does never show disk usage of a single file.
Attachments
rox-directory-sizes.png
(78.67 KiB) Downloaded 799 times

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#213 Post by MochiMoppel »

Update 2018-08-03 (see also initial post)

Completed "Properties" view, new additional infos for directories and a new menu item to compress/decompress files.

Properties
The Properties view now includes (almost) all features of the ROX properties dialog - only better.

My problem with ROX-Filer's "Run action" item: Most of the time only something feeble like "defaultviewer $@" is displayed.
That's not good enough. Knowing the code that is executed when the user clicks on a file in ROX-Filer is OK, but I also need to know the name of the script which contains the code, otherwise I can't change it.

Guessing the script name does not help here as ROX may store the code in up to 6 different files. E.g. for a PNG file this could be
/root/.config/rox.sourceforge.net/MIME-types/image_png
/root/.config/rox.sourceforge.net/MIME-types/image
/etc/xdg/rox.sourceforge.net/MIME-types/image_png
/etc/xdg/rox.sourceforge.net/MIME-types/image
/root/Choices/MIME-types/image_png
/root/Choices/MIME-types/image

Though ROX will display the script name if it can't figure out the code, it would then not display the code
For ROX it is script name or code, for MMview it's script name and complete code.
As a bonus MMview checks and displays the real application behind default<whatever>.

Count
Pressing F1 after selecting a directory now displays a count of all files in this directory and the accumulated size of all files. See previous post for details.

Compress/decompress file
A new menu item in the File menu. Nothing spectacular, just a toggle to gzip/unzip a file.
Note that this adds/removes a .gz extension.

Other changes
- Permanent settings are now saved to $HOME/.config/mm_view
- Improved support for multiple instances. No clean-up if another instance of MMview still runnung
- Improved running/terminating of audio/video play. No more PID temporary file
- Applying F1 on directory with hundreds of subdirectories displays result dramatically faster (<1sec vs. former 1min)
- Find (Ctrl+F) now faster (redundant function call removed)
Attachments
properties_rox_vs_mmview.jpg
(101.08 KiB) Downloaded 750 times
new_features.jpg
(83.27 KiB) Downloaded 757 times

mfb

#214 Post by mfb »

Hi MochiMoppel,

Thank you very much for your update.

An immediate favourite, for me, is your new feature whereby

- Permanent settings are now saved to $HOME/.config/mm_view

so that mm_view

starts with last used directory and last used window size.

As a really minor point - I always toggle "Document Line Wrapping" to on - so I wonder if that might be easily saved, as well.

--------------------------------------

PS You've been a star help to me, but the Forum software is not always reliable and both of my most recent PMs to you remained in my Outbox for weeks.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#215 Post by vovchik »

Dear MochiMoppel,

Thanks. Very nice improvements - and useful. All working for me.

With kind regards,
vovchik

Post Reply