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

#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

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

#216 Post by perdido »

Once again, thank you MochiMoppel!

It was a nice suprise to see MMview included in upup bionic beaver.

One of my "would like to see" things, not urgent :)

I like how ROX lets me go deeper into the directory tree with a single mouse click. Is something like that planned for MMview?

.

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

#217 Post by MochiMoppel »

mfb wrote:As a really minor point - I always toggle "Document Line Wrapping" to on - so I wonder if that might be easily saved, as well.
Relatively easy, but may I ask why you need line wrapping so often? For my decision not to save this setting I took Geany as a model. Geany saves almost everything - except line wrapping. It always reverts to no wrap, and for an editor I consider this a good design. Have you tried fullscreen mode? I use this a lot when the viewer pane is not wide enough. Documents in EPUB format MMview already display in line wrap mode by default.
vovchik wrote:Very nice improvements - and useful. All working for me.
Glad to hear that. In order to find out which Puppy you are using I checked your posting history and stumbled on your gxlat project. Very impressive. I would like to play with the massive gawk command of the trans script in MMview , but first I have to get it to work and then - the more daunting task - I have to understand it.
perdido wrote:I like how ROX lets me go deeper into the directory tree with a single mouse click. Is something like that planned for MMview?
Quick answer: no.
Technically it is not possible. The GtkFileChooserDialog, the "father" of gtkdialog's chooser widget, does not allow this selection mode - for very good reasons.

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#218 Post by slavvo67 »

Mochi:

I haven't looked at this in quite sometime. Congratulations, your file viewer has come along nicely. Can I ask you to consider a few things?

In viewing .jpg files, you have an option under preferences to fit image in viewer size. When using that option, it reflects the % of the original size and the actual size, For example, "Scaled at 30% of 1080x1350." When an image isn't scaled to fit the image viewer, it solely states, "Original Size". Would you consider reflecting the size of the original image next to the "Original Size" wording, such as, "Original Size 600x800?"

Secondly, the .rtf preview window shows the hidden code instead of just the typed letter. Is there a way to fix that?

Either way, it's a great file viewer! - Thanks. Slavvo67

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

#219 Post by MochiMoppel »

slavvo67 wrote:When an image isn't scaled to fit the image viewer, it solely states, "Original Size". Would you consider reflecting the size of the original image next to the "Original Size" wording, such as, "Original Size 600x800?"
The header text is just a hint to distinguish original sized from scaled images. Even in scale mode an image would be labeled as "Original Size" when the image fits into the viewer pane without scaling, so the header is there to avoid ambiguities. In scale mode the dimension has to be calculated and the width/height values in the header are a by-product of this calculation.

Currently In original size mode no calculation is taking place. That's good for performance. Would I add a calculation just to add the image size to the header, I would not only worsen performance but I would also have to deal with the problem of fetching dimension values for all supported image formats. There is simply no single tool that would give me this information and for some formats there is no tool at all.
slavvo67 wrote: Secondly, the .rtf preview window shows the hidden code instead of just the typed letter. Is there a way to fix that?
There is nothing broken so there is nothing to "fix". What you see is not hidden code but the content of the RTF file. It's the same as with your earlier request for PDF: If you want to see the source data of the file converted into a styled document you will need to open it with a dedicated program. If you expect MMview to convert RTF into plain text I have to disappoint you:
- Puppy does not ship with tools that could convert them
- RTF is dead. Microsoft practically abandoned it.
- And writing a conversion routine from scratch? Take a look at the function view_htm2txt to get an idea what it takes to (very insufficiently!) convert HTML.
RTF is much more difficult than that. For me a waste of time, but if anyone volunteers I will gladly incorporate the result into MMview.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#220 Post by Argolance »

Bonjour,
Thanks for this great and so useful application that was missing from Puppy's panoply! 8)
May I say that it is a pity that the GUI was not built to allow internationalization? :(

Cordialement.
Attachments
mmv.png
For those who need the icon to build a desktop file...
(1.92 KiB) Downloaded 410 times
Last edited by Argolance on Fri 10 Aug 2018, 13:22, edited 1 time in total.

Post Reply