Building MMview, a universal file viewer
Thank you for this new feature. The attached page is converted well, but there are some spurious '0' characters. Perhaps something odd with the version of sed?
Code: Select all
Fatdog64-710# sed --version
sed (GNU sed) 4.2.2
- Attachments
-
- 2017-06-21.png
- (6.23 KiB) Downloaded 567 times
-
- not-found.html.gz
- (877 Bytes) Downloaded 119 times
[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]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Unlikely. The sed job (adding blank line before "Page Not Found" and the following paragraph) worked well, but something must be wrong with your tr version. Mine is BusyBox v1.21.0.step wrote:Perhaps something odd with the version of sed?
Try
Code: Select all
echo -n $'Hello\nWorld' | tr -s '\r\n' '\x01'
The converted page should look like this:
- Attachments
-
- not-found.html.png
- (8.3 KiB) Downloaded 559 times
Last edited by MochiMoppel on Thu 22 Jun 2017, 02:43, edited 1 time in total.
You're correct
Code: Select all
# echo -n $'Hello\nWorld' | tr -s '\r\n' '\x01'
Hello0World# tr --version
tr (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jim Meyering.
# echo -n $'Hello\nWorld' | busybox tr -s '\r\n' '\x01'
HelloWorld#
[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]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
I added "busybox" in front of "tr" and got clean output.
I share your frustration, though not about Fatdog but instead about the inconsistencies between busybox and GNU coreutils. I often end up replacing tr/sed/cut/grep pipelines with a single call to gawk, so I don't have to remember the syntax flavors of each utility.
I share your frustration, though not about Fatdog but instead about the inconsistencies between busybox and GNU coreutils. I often end up replacing tr/sed/cut/grep pipelines with a single call to gawk, so I don't have to remember the syntax flavors of each utility.
[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]
I am remastering and playing around with Lucid 5.2.8.7, (yes, I actually consider upgrading to a newer puppy - from 5.2.8.005-1 ). I have followed the development of MMview, so I decided to give it a go.
I am very impressed with MMview, but it need further development.
I have been a user of Lynx, the hierarchical terminal browser, for many years. I never use it as a browser, but as a file manager! Incredibly quick to navigate down through the layers using he right arrow key until reaching bottom. There you can see the file contents with less or other viewers, and link to editors and other programs for working with the file, from the keyboard. I had hoped for some of the same functionality in MMview, but it is of course not hierarchical.
Some remarks:
I miss a better indication of which window having focus, Places or files. May I suggest a change in pattern or color when ones laves a location, perhaps?
I also find the use of both keys and mouse a bit distracting, I prefer keys only in a program like this one. It is a bit unfair to compare MMview to Lynx, but I really miss the hierarchy function, it's so easy to use.
Strange behaviour, intended or not?:
To get a feeling of the program, I unintentionally ended up in /root/Choises/MIME-types/ and scrolled down to application_vnd.ms-work, and used Ctrl-F5 to see the contents. The file is empty, but to my surprise Abiword opened, ready for writing, with no real address in the status line of the frame, just the word root, no slashes.
I am very impressed with MMview, but it need further development.
I have been a user of Lynx, the hierarchical terminal browser, for many years. I never use it as a browser, but as a file manager! Incredibly quick to navigate down through the layers using he right arrow key until reaching bottom. There you can see the file contents with less or other viewers, and link to editors and other programs for working with the file, from the keyboard. I had hoped for some of the same functionality in MMview, but it is of course not hierarchical.
Some remarks:
I miss a better indication of which window having focus, Places or files. May I suggest a change in pattern or color when ones laves a location, perhaps?
I also find the use of both keys and mouse a bit distracting, I prefer keys only in a program like this one. It is a bit unfair to compare MMview to Lynx, but I really miss the hierarchy function, it's so easy to use.
Strange behaviour, intended or not?:
To get a feeling of the program, I unintentionally ended up in /root/Choises/MIME-types/ and scrolled down to application_vnd.ms-work, and used Ctrl-F5 to see the contents. The file is empty, but to my surprise Abiword opened, ready for writing, with no real address in the status line of the frame, just the word root, no slashes.
True freedom is a live Puppy on a multisession CD/DVD.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
@tallboy: Thanks for playing around with MMview. I'm very impressed that you are impressed because MMview hardly works with Lucid 5.2.8.7. Most of the filetypes it is supposed to display are not recognized. Why? Lucid 5.2.8.7 uses an old version of the file command and there are probaly other factors that cause this version to often return only the mime-type of a file, but not the mime-encoding. And even the mime-type can be ambiguous. E.g. directories and symlinked scripts are reported as "application/x-not-regular-file". MMview can't work with such fuzzy information. Look at the statusbar of the screenshot in the initial post. I bet your statusbar looks different.
application_vnd.ms-work is a script and it is not empty. Ctrl-F5 does not let you "see the contents", it is supposed to run an executable. And since application_vnd.ms-work is supposed to open the defaultwordprocessor you will be greeted by Abiword when you apply Ctrl+F5. Hardly a surprise. The problem here is that you couldn't see the script contents in the viewer pane, which might have made you believe that the file is empty, but this is a result of the aforementioned problems with mime detection.
I don't understand what you mean by "hierarchical".tallboy wrote:I had hoped for some of the same functionality in MMview, but it is of course not hierarchical.
That's your job: Choose a better GTK theme. Lucid by default uses Stardust, which indeed makes is hard to detect any difference between a focussed and not focussed selection. Lucid comes with GTK theme chooser and GTK theme maker. For me I changed selected text to bright red (see my screenshots) and have no difficulty to figure out if the Places pane or the file list has focus, but this is a global change and I have no business to interfere with a user's preferred GTK theme.tallboy wrote:I miss a better indication of which window having focus, Places or files.
Then don't use a mouse. You can operate MMview only with keys.tallboy wrote:I also find the use of both keys and mouse a bit distracting
The strangeness is not intended, but the result is.tallboy wrote:Strange behaviour, intended or not?:
To get a feeling of the program, I unintentionally ended up in /root/Choises/MIME-types/ and scrolled down to application_vnd.ms-work, and used Ctrl-F5 to see the contents. The file is empty, but to my surprise Abiword opened
application_vnd.ms-work is a script and it is not empty. Ctrl-F5 does not let you "see the contents", it is supposed to run an executable. And since application_vnd.ms-work is supposed to open the defaultwordprocessor you will be greeted by Abiword when you apply Ctrl+F5. Hardly a surprise. The problem here is that you couldn't see the script contents in the viewer pane, which might have made you believe that the file is empty, but this is a result of the aforementioned problems with mime detection.
@tallboy
If I may:
You could compile the newest file utility (v. 5.31) on Lucid, could you not?
Sources: http://www.darwinsys.com/file (developer's page)
ftp://ftp.astron.com/pub/file (code)
Version 5.31 is at the bottom of the ftp page listing.
It is very easy to compile this utility.
About the lack of contrast of a particular GTK2 theme, you could leave
your general GTK2 theme alone and use a second GTK2 theme that has
the contrast you want, expressly for Mochi's MMView. This "two GTK2
themes" approach is nicely explained by urukrama here:
https://urukrama.wordpress.com/2008/07/ ... plications
My take on it is here. It's in French, and it's responding to a different
issue, but the examples may be helpful.
IHTH.
If I may:
You could compile the newest file utility (v. 5.31) on Lucid, could you not?
Sources: http://www.darwinsys.com/file (developer's page)
ftp://ftp.astron.com/pub/file (code)
Version 5.31 is at the bottom of the ftp page listing.
It is very easy to compile this utility.
About the lack of contrast of a particular GTK2 theme, you could leave
your general GTK2 theme alone and use a second GTK2 theme that has
the contrast you want, expressly for Mochi's MMView. This "two GTK2
themes" approach is nicely explained by urukrama here:
https://urukrama.wordpress.com/2008/07/ ... plications
My take on it is here. It's in French, and it's responding to a different
issue, but the examples may be helpful.
IHTH.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
File is basically just a parser - with som default resolvements -
the more specific data are in the mime-database,the magic-files.
There are ways to update the mime-database -
and for USER to apply his/her own types.
As I recall - the puppy-wiki has a paragraph about adding mime-types.
MMview depends on the mime-types MochiMoppel covers,
probably those in Slacko/Tahr.
No objections to that.
----
the more specific data are in the mime-database,the magic-files.
There are ways to update the mime-database -
and for USER to apply his/her own types.
As I recall - the puppy-wiki has a paragraph about adding mime-types.
MMview depends on the mime-types MochiMoppel covers,
probably those in Slacko/Tahr.
No objections to that.
----
Thank you for the feedback, Moppi. When I played with MMview, it slowly dawned on me that Lucid wasn't the ideal platform for MMview. But even if I wasn't so impressed with my results with MMview, because of Lucid, I am very impressed by the way you work and your dedication to the project. I bow to you.
Re hierachical: Even if I know what it means, but I could not find the words for an explanation (I'm a foreigner, you know!), so I cheated: Merriam-Webster dictionary present a definition of hierarchy as a graded or ranked series or a hierarchy of values.
A better explanation of Lynx is maybe that it see the directories and files as a tree. I once demonstrated it's use - with pictures - in this thread: http://www.murga-linux.com/puppy/viewto ... 137#839137
tallboy
Re hierachical: Even if I know what it means, but I could not find the words for an explanation (I'm a foreigner, you know!), so I cheated: Merriam-Webster dictionary present a definition of hierarchy as a graded or ranked series or a hierarchy of values.
A better explanation of Lynx is maybe that it see the directories and files as a tree. I once demonstrated it's use - with pictures - in this thread: http://www.murga-linux.com/puppy/viewto ... 137#839137
tallboy
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Some unfinished business:
mime-types
contrast
or inserting export GTK2_RC_FILES= at the beginning of the mm_view script. The result is a well balanced, no-nonsense, retro-style look from the 90s (see screenshot). I'm inclined to do that and give MMview a distinctive look, but I'm afraid users would kill me.
It is also possible to style only the leftmost "Places" pane and the main file list. Zigbert's GtkDialog - tips tread has an example how to enforce monospace text. Similar approach is possible for the chooser widget. This could be placed somewhere at the beginning of the script:
I prefer to make no changes to MMview and count on the users to use a suitable theme that suits their taste and needs.
Wrong. None of them uses gtkdialog.stemsee wrote:Pinch to zoom in/out works in geany and viewnior and browsers so teir gtkdialog source code must already be modified, right?
mime-types
For Lucid users this would be close to impossible as neither the update utility nor the database are included. And for updating the mime-types of directories and symlinks this may not even be sufficient. File must be clever enough to know what a directory is. No need for a database but maybe a recompilation as musher0 suggested? Who knows. Bottomline: this mime stuff is not trivial and I don't expect users to tinker with these files. If Lucid can't be changed, then MMview must change. I like Lucid and I'm pretty confident that I can adapt the script to Lucid's quirks, maybe not 100% but almost. If the changes don't affect overall performance I will do it. A new challengesome1 wrote:There are ways to update the mime-database -
and for USER to apply his/her own types.
contrast
The easiest solution with the best performance possible is no theme at all. Either calling MMview with a small scriptmusher0 wrote:About the lack of contrast of a particular GTK2 theme, you could leave your general GTK2 theme alone and use a second GTK2 theme that has the contrast you want, expressly for Mochi's MMView
Code: Select all
#!/bin/bash
export GTK2_RC_FILES=
/path/to/mm_view
It is also possible to style only the leftmost "Places" pane and the main file list. Zigbert's GtkDialog - tips tread has an example how to enforce monospace text. Similar approach is possible for the chooser widget. This could be placed somewhere at the beginning of the script:
Code: Select all
MMSTYLE=/tmp/mm_view/mmstyle.txt
echo '
style "MMV" {
base[SELECTED]="Navy" # background of selected and focussed item
text[SELECTED]="white" # text color of selected and focussed item
base[ACTIVE]="LightSteelBlue" # background of marked but unfocussed item
text[ACTIVE]="black" # text color of marked but unfocussed item
} class "GtkTreeView" style "MMV"
' > $MMSTYLE
export GTK2_RC_FILES=$MMSTYLE:/root/.gtkrc-2.0
- Attachments
-
- mm_view_themeless.png
- (50.67 KiB) Downloaded 834 times
possible universal 'playlist' manager
Nice project - I really like it.
I've also found something extra you might find useful to handle right-click options in any file manager. It's xhplay (by mcewanw) which in conjunction with his modified xhippo can be used as a kind of universal 'playlist' manager, with which you can select from list of files what to play or view or edit or work on generally. It's not perfect as it stands, but works quite well, and I'm using it to make playlists of Audio files/video files and/or image files (jpg, animated gif, whatever...) but with slight mod of xhplay I've discovered you can also use any kind of file in a playlist (html, pdf, rtf, doc - again whatever. mcewanw probably already knew that...).
Overall I use the combination of file manager and xhippo/modded-xhplay as a rudimentary, easy to understand document management system - just calling up previously constructed playlists whenever wanted and using xhippo to control what to play/view/edit. To load files into xhippo you just highlight them in a filemanager and drag them into xhippo window (or use file manager right-click command Open-with for those filemanagers that provide that facility). You can also load any pre-made playlists (of any mixed file types) directly using xhippo load playlist command in xhippo itself.
I've recently posted in mcewanw's xhippo thread (link below) with details in the hope that he'll improve on my rough idea and supply a dotpet (since I can't do that). Also hoping he'll modify xhippo itself (or similar program 'potamus') to allow passing new file items into an already active playlist, but I he hasn't responded to my post yet. Though I'm no programmer myself I used to manage a small programming team that mcewanw helped me with in the past, and he had a virtual network with programming resources on it, which I still login to. However I haven't been in touch with him personally for a long time cos I've not been active in computing world - hopefully he'll get back to me on this if not via the forum.
I'm sure he'd like your universal file viewer program and maybe contribute.
It's nice.
Here is the xhplay/xhippo link (to my post on mcewanw xhippo thread):
http://www.murga-linux.com/puppy/viewto ... 816#960816
wiak
I've also found something extra you might find useful to handle right-click options in any file manager. It's xhplay (by mcewanw) which in conjunction with his modified xhippo can be used as a kind of universal 'playlist' manager, with which you can select from list of files what to play or view or edit or work on generally. It's not perfect as it stands, but works quite well, and I'm using it to make playlists of Audio files/video files and/or image files (jpg, animated gif, whatever...) but with slight mod of xhplay I've discovered you can also use any kind of file in a playlist (html, pdf, rtf, doc - again whatever. mcewanw probably already knew that...).
Overall I use the combination of file manager and xhippo/modded-xhplay as a rudimentary, easy to understand document management system - just calling up previously constructed playlists whenever wanted and using xhippo to control what to play/view/edit. To load files into xhippo you just highlight them in a filemanager and drag them into xhippo window (or use file manager right-click command Open-with for those filemanagers that provide that facility). You can also load any pre-made playlists (of any mixed file types) directly using xhippo load playlist command in xhippo itself.
I've recently posted in mcewanw's xhippo thread (link below) with details in the hope that he'll improve on my rough idea and supply a dotpet (since I can't do that). Also hoping he'll modify xhippo itself (or similar program 'potamus') to allow passing new file items into an already active playlist, but I he hasn't responded to my post yet. Though I'm no programmer myself I used to manage a small programming team that mcewanw helped me with in the past, and he had a virtual network with programming resources on it, which I still login to. However I haven't been in touch with him personally for a long time cos I've not been active in computing world - hopefully he'll get back to me on this if not via the forum.
I'm sure he'd like your universal file viewer program and maybe contribute.
It's nice.
Here is the xhplay/xhippo link (to my post on mcewanw xhippo thread):
http://www.murga-linux.com/puppy/viewto ... 816#960816
wiak