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
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#301 Post by rockedge »

hey MochiMoppel

really cool...and the eyeglasses changing color when mm_view is running is actually very helpful

nice!

User avatar
josejp2424
Posts: 556
Joined: Sun 01 Aug 2010, 22:35
Contact:

MMviem

#302 Post by josejp2424 »

MochiMoppel wrote:Special desktop edition
Promised to perdido and based on above update I tried to set an icon for MMview that would change according to the color of the fat guy's glasses. When he is not viewing anything glasses are light gray.
Affected are icons on the pinboard and in ROX-Filer window

This is a special edition of MMview and I'm not sure if I will ever include this gimmick into future official versions though I admit that I'm starting to like it. It may even be useful: I often have multiple instances open and it happens that I forget an instance on a different desktop. The icon color tells me if there is still an instance open somewhere.

Uncompress and make executable as usual. For most fun drag the script from ROX-Filer to the desktop. Don't add an icon manually, just click and see what happens.
Excellent work MochiMoppel thanks

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

#303 Post by MochiMoppel »

Update 2019-10-29 (see also initial post)
While hexdumps (see update 2019-04-09) can be useful for power users, this update adds a more gentle way to display "octet streams" and other binaries. Accessible from View menu or ASCII button.

Display printable ASCII strings
Uses busybox strings command to extract plain text strings (=printable characters) from binary files. Control characters and extended ASCII characters (see ASCII table) are eliminated and only text strings that are at least 4 characters long are displayed. This value can be changed. Note that the control character 09 (=tab) is treated as printable.

This function is particularly useful to
- get an idea what an unknown "octet stream" is used for
- search for specific strings in binaries (practically impossible with other tools like grep or hexdump)
- recover code from corrupted shell scripts
- find version or usage info in files unable to run with current OS
- extract body text from binary wordprocessor files (e.g. MS Word 2.0)

Set minimum length
The minimum length of displayed ASCII strings can be adjusted and will be saved.
Personally I find that the default of 4 produces too much garbage and therefore I prefer something around 8. Only in extreme cases it can be useful to set the limit to 1, e.g. when dealing with corrupted scripts.

Display decimal offsets
Prepends each string with its decimal offset. This makes it easy to find the string in MMview's hexdump, which also uses decimal offsets.

ASCII table
A little extra tool discussed here. Useful mostly for programmers.

Support for additional image formats
CURSOR: Xcursor image files; no extension, MIME image/x-xcursor. Requires xcur2png (probably present in all Puppies)
QIF/QTIF: QuickTime image files; extension ".qif" or ".qtif"
ICNS: Apple icon image files; extension ".icns")

Bugfixes
Fixed: MMview may not restart in last used folder
Fixed: Right-to-left characters (e.g Arabic) in table "CHARACTERS (Unicode codepoints and bytestrings)" result in inverted lines (not a bug but annoying)

Other changes
More color variations for the main icon.
Various performance improvements.
Attachments
ASCIIstrings.jpg
(85.77 KiB) Downloaded 830 times

dancytron
Posts: 1519
Joined: Wed 18 Jul 2012, 19:20

#304 Post by dancytron »

Just downloaded the latest version.

Once again, this is really excellent work. I've got to try to actually use it more.

Dan

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#305 Post by rockedge »

using the latest version on a Void Linux WeeDog.....works very well

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

#306 Post by MochiMoppel »

Many thanks.
For friends of the "Special desktop edition" I have updated this edition. It is now based on the newest MMview version.

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

#307 Post by perdido »

MochiMoppel wrote: For friends of the "Special desktop edition" I have updated this edition. It is now based on the newest MMview version.
Thanks for this :)

.

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#308 Post by rockedge »

"Special desktop edition"
beyond cool!! Thank you

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

#309 Post by tallboy »

MochiMoppel, I think that most of us are friends of the "Special desktop edition". Very clever, extremely cool! :D
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

#310 Post by MochiMoppel »

Tips & Tricks No.2

I'll try to explain a feature that is not exclusive to MMview. It exists in every "Open..." dialog (e.g. Geany) were it probably is never used - for good reasons. In MMview it can be extremely useful.

The built-in "Search" function
"Search" is the first item in the Places pane. When clicked it opens an entry field where the user can enter a search string. Pushing Enter then populates the list pane with all matching filenames

After some trial & error I figured out how this thing works:

1) "Search" only finds files/directories in the directory listed after "Search" and "Recently Used". For most Puppy users this will "root".
2) Hidden files/directories are ignored. For example no files in /root/.config will be found.
3) Symlinks are not followed , which means that the search scope can not be expanded by symlinking "non root" directories, e.g /usr, to /root .
4) Wildcards are not allowed. Search strings are taken literally.
5) Search is not case sensitive


Despite all these restrictions "Search" can be pretty useful in MMview for users who keep their personal files in directories like /root/my-documents and /root/my-applications.
A possible use case: User stores mp3 albums in /root/my-music, each album in its own directory. Some song titles are covered by different artists and therefore appear in different mp3 albums (directories). Searching for the title (or parts of it) would list all matching mp3 files. MMview makes it possible to play and compare them and even would find duplicates. And now the best part:

6) The search string and the resulting matches will not be erased after closing the "Search" entry box.

This means that the user can continue to operate MMview as usual and can always go back to the previous search results by clicking "Search".

Searching external directories
Above functionality may be great for people using a pupsave file, but for me who doesn't use one and keeps all personal files outside of Puppy there is not much to search under /root (see screenshot). Frankly, "Search" is completely useless.

There is however a way to include external directories or even whole filesystems in the search:

7) Mountpoints under /root are searched as well

This will give real power to "Search".
Example: I start Puppy from a USB stick, which appears as sdb1. All personal files, photos,scripts etc are stored on this stick outside of Puppy in /mnt/home, which is a symlink to /mnt/sdb1.
If I create a new directory under root, say /root/MP, I can mount the whole stick to this directory with the command
mount /dev/sdb1 /root/MP
Now "Search" will search all files/directories in /root and on the stick and present the result in a nice flat list, ideal for browsing with MMview.
I also tried to mount /dev/sda1, which happens to be the harddisk partition where I keep all my photos in hundreds of directories. Searching for "jpg" took a while but eventually produced a huge list of all my photos. It's like having them all in one big directory, ready to be sorted and "mmviewed". I'm not aware of any other tool that would be able to do that.
Attachments
GTK-Search.png
(58.09 KiB) Downloaded 441 times

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

#311 Post by MochiMoppel »

Update 2020-02-13 ( version 0.28 ) (see also initial post)
This update adds the ability to select a specific file and window location at startup. It also combines various settings in a new config file and fixes some bugs.

Config file $HOME/.config/mm_view/config
This file is a bucket for all settings that should survive a reboot. Some preferences can be changed by directly editing this file. Future versions will include more preference settings.

Start with a specific file
Requires xdotools. Depending on the value of RESTORE_LAST_SELECTION in the config file this feature can be enabled, disabled or - as default - enabled only when using MMview's new menu item "Restart". For details about limits and caveats of using xdotools see here.

Start with the last saved window position
Requires wmctrl. Depending on the value of RESTORE_LAST_WINPOSITION in the config file this feature can be enabled, disabled or enabled only when using Menu File -> Restart (which is the default). Enabling this feature for *every* start can be a bit annoying as the window is always positioned by the window manager , after which wmctrl corrects the position to the last saved value. I don't like this visible relocation and therefore didn't make it the default.

"Restart" menu item
This function can be useful for testing aforementioned 2 new feature. After selecting "Restart" and if all goes well, MMview will restart with exactly the same dimensions, postion and file selection as the just closed window. Internally this function is used whenever a new setting requires a restart (e.g the vertical layout switch).

"New Window" menu item
This function can be accessed from Menu File -> New Window and allows to open another MMview window with the same selection as the already existing window - almost a clone (position is not retained to avoid covering the old window completely by the new window).

Bug fixes
Fixed: "Open With" middle-click dialog does not open selected program
Fixed: Rename/Delete dialog does not work for filenames starting with '-'
Fixed: Content of gzipped shellscripts not displayed when pressing F1

Other changes
- MMview now comes with a version number, displayed in the title bar.
- /proc and /sys and all their subfolders now reported as virtual file system, which can speed up scrolling
- "Quit" behavior changed back to original. A new tooltip for "Quit" button and menu explains the behavior.
- Apart from completely empty directories now directories containing only empty subdirectories, files or symlinks are also labeled as EMPTY. This "EMPTY" is hard to overlook and prevents accidental opening of directories with no viewable content.

Have fun!

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#312 Post by step »

Thank you for this update.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#313 Post by rockedge »

excellent! I am using it as a main feature in EasyPup.
The program is very helpful

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

#314 Post by MochiMoppel »

Thanks for the encouragement to continue this project. There is still work to do. Probably by the next update you will see an improved Find function with a very fast text search across directories. To my knowledge this doesn't yet exist in any Puppy. There is one in zigbert's pFind but there the focus is on finding files while mine will focus on finding (and of course displaying) text. If there is any other program I missed, please let me know.

The "Special desktop edition" got its obligatory update.

Beware that colored glasses are not a reliable indicator for a running instance nor are they an indicator for increased intelligence . Glasses stay colored if MMview is killed or run from a console that has been killed. A restart will fix that.

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

#315 Post by perdido »

MochiMoppel wrote: The "Special desktop edition" got its obligatory update.
Still using MMview every day. I may have collected the whole set!
Beware that colored glasses are not a reliable indicator for a running instance nor are they an indicator for increased intelligence.Image
Keep on keeping-on MochiMoppel, thanks & rest assured you are appreciated :!:

.

dancytron
Posts: 1519
Joined: Wed 18 Jul 2012, 19:20

#316 Post by dancytron »

MochiMoppel wrote:Thanks for the encouragement to continue this project. There is still work to do. Probably by the next update you will see an improved Find function with a very fast text search across directories. To my knowledge this doesn't yet exist in any Puppy. There is one in zigbert's pFind but there the focus is on finding files while mine will focus on finding (and of course displaying) text. If there is any other program I missed, please let me know.

The "Special desktop edition" got its obligatory update.

Beware that colored glasses are not a reliable indicator for a running instance nor are they an indicator for increased intelligence . Glasses stay colored if MMview is killed or run from a console that has been killed. A restart will fix that.
Please continue it. It is a great piece of work.

I wish I used it more...

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

#317 Post by MochiMoppel »

dancytron wrote:I wish I used it more...
Who or what keeps you from using it ? :lol:

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

#318 Post by MochiMoppel »

Update 2020-04-10 ( version 0.29 ) (see also initial post)
This update adds the ability to search for text in (multiple) files. It is one of the features that I couldn't find in any Puppy, so I decided to build and include it. It is very fast and - may I say this? - very useful (e.g. see here )

Search text in files
Included in the Find dialog (Ctrl+F). Which files will be searched I tried to explain in the tooltip.
Several options allow fine-tuning. Search will be fastes without any option selected. "Use inline markers" has practical no effect on speed while "Match any case" can slow down search considerably if the search string is long (grep has to try all possible case combinations!).

Though generally very fast some sophisticated (regex) searches may take longer than a minute to produce results. That's why MMview will - after 1-2 seconds - show a panic button ("Abort") which allows to end the search prematurely. Any results that were already found until this point appear in the viewer pane.

If matches were found, the count is displayed in the statusbar. The statusbar will also include the grep command that was used to achieve the result. This command can be copied to a console and executed. It should produce the same result, though not the same format.

Searches can be repeated for different directories via the "Find again" function (F3). No need to bring up the Find dialog again. Entries and option choices are saved and will survive a shutdown of MMview but not a reboot.

Location box
A text search normally produces matches in multiple files. The output is formatted so that file paths are listed on separate lines. How to access these files quickly? An easy way is to copy the filepath into the "Location" box and then choose any of MMview's functions, e.g. push the "Open text file" button to load the file into an editor. This Location box has precedence over any file that may currently be selected in MMview's file list, provided that the Location box has focus (= text cursor is in box).

Other changes
Fixed: "Text to hex" function fails to convert '*' character
Fixed: Menu item 'Run Command' (shortcut F4) may not be enabled despite visible command box
Changed: Dialogs for Find, Rename, Delete etc. do not require wmctrl anymore for their "always-on-top" status
Attachments
mmview_find_text.jpg
(140.83 KiB) Downloaded 431 times

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#319 Post by rockedge »

Hello MochiMoppel!!

Totally agree!!! this search function is super useful! So pleased you added this function I am going to bake a pie later today.

A minor request...can this be added into mm_viewme as well?

excellent progress on this powerful tool.

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

#320 Post by MochiMoppel »

rockedge wrote:A minor request...can this be added into mm_viewme as well?
You can do it yourself. Open your mm_viewme with an editor and find all comments containing the character ☗ . There are 4 of them and they mark the line(s) that need to be added to the official mm_view to turn it into an unofficial mm_viewme. I know you can do it because you are reading programming posts :lol:
Let me know if it works.

Post Reply