Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 23 Nov 2017, 07:31
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Building a universal file viewer
Post new topic   Reply to topic View previous topic :: View next topic
Page 11 of 12 [172 Posts]   Goto page: Previous 1, 2, 3, ..., 9, 10, 11, 12 Next
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Thu 29 Jun 2017, 21:21    Post subject:  

stemsee wrote:
When previewing images/text/pdf etc what would it take to implement pinch to zoom in the preview window?..
1) Installing at least GTK 3.14 (introduced the GtkGesture object)
2) Modifying the gtkdialog source code to support it. Good luck! Laughing
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2000
Location: In The Way

PostPosted: Fri 30 Jun 2017, 08:31    Post subject:  

MochiMoppel wrote:
1) Installing at least GTK 3.14 (introduced the GtkGesture object)
2) Modifying the gtkdialog source code to support it. Good luck! Laughing


Pinch to zoom in/out works in geany and viewnior and browsers so teir gtkdialog source code must already be modified, right?
Back to top
View user's profile Send private message MSN Messenger 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Fri 07 Jul 2017, 11:09    Post subject:  

Some unfinished business:

stemsee wrote:
Pinch to zoom in/out works in geany and viewnior and browsers so teir gtkdialog source code must already be modified, right?
Wrong. None of them uses gtkdialog.

mime-types

some1 wrote:
There are ways to update the mime-database -
and for USER to apply his/her own 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 challenge Laughing

contrast

musher0 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
The easiest solution with the best performance possible is no theme at all. Either calling MMview with a small script
Code:
#!/bin/bash
export GTK2_RC_FILES=
/path/to/mm_view

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:
Code:
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

I prefer to make no changes to MMview and count on the users to use a suitable theme that suits their taste and needs.
mm_view_themeless.png
 Description   
 Filesize   50.67 KB
 Viewed   684 Time(s)

mm_view_themeless.png

Back to top
View user's profile Send private message 
dancytron

Joined: 18 Jul 2012
Posts: 942

PostPosted: Fri 07 Jul 2017, 18:21    Post subject:  

Nothing worthwhile to add, other than I just tried this out and it is really good.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 372
Location: not Bulgaria

PostPosted: Sun 16 Jul 2017, 20:04    Post subject: possible universal 'playlist' manager
Subject description: that works with most file-managers
 

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/viewtopic.php?p=960816#960816

wiak
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Sat 22 Jul 2017, 22:56    Post subject:  

@dancytron, wiak: Thanks for your feedback. Good to know that some people find this endeavour useful.

@wiak: xhippo and MMview follow different concepts and have not much in common. One interesting aspect is the concept of "playlists". In case of documents there should be a better word ("project files"?). The closest you can get in MMview would be a set of files/folders in the bookmarks area. I assume that many people haven't yet discovered how useful GTK bookmarks can be. From a programming point of view they are easy to maintain and - that's their beauty - they can be changed on-the-fly, so you could have different, predefined bookmark sets (call them "playlists") and display them in the bookmarks area as needed. I've experimented with this feature to automatically display the last used directories as a kind of view history. I'm undecided if anything of this is really needed. I suggest that for the time being you make good use of bookmarks. The area is already prepared and it's a waste of space not to use it.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Sun 06 Aug 2017, 23:57    Post subject:  

Update 2017-08-07 (see also initial post)

MMview now supports Lucid 5.2.8 and provides basic file management functions rename/move/duplicate/delete.

Though in theory with the versatile Commandbox/Terminal combo all file management operations can be performed, I often wished simpler access to basic functions. And then there are many users with an anaemic, VTE-less gtkdialog for whom the Commandbox is not an option.

Speaking of VTE: I will remove the Terminal from MMview. Works great, but few Puppies support it. Scheduled for next update.

MIME type recognition
Strange MIME type definitions were the root cause of MMview's poor performance under Lucid 5.2.8.
I reduced the dependence on the file command and rewrote the fill_statusbar function. Newly defined patterns in other functions are designed to make file type detection more robust.

Rename (move)
Menu File > Rename displays a Rename dialog similar to ROX-Filer. Unlike ROX-Filer it does not display the full path but only the basename, which I hope makes renaming a bit easier. Moving the file by adding the full path of its target location is still supported though.

Duplicate (copy)
This does basically the same as the irritating ROX-Filer "Copy" command - hopefully a bit better.
The Ctrl+C shortcut is normally associated with the "copy to holding space" kind of copy, the one that always comes in tandem with the "Paste" command. What ROX means is the "copy source file to target file" kind of copy. I prefer to call it "Duplicate". In its simplest form it creates a duplicate of the selected file in the same folder (requires a different name). When adding a full (absolute or relative) path the file can be copied to a different directory. Calling it "Duplicate" is also a good excuse for assigning the Ctrl+D shortcut, thus leaving the Ctrl+C shortcut intact for clipboard copies.

Delete
Does pretty much what one would expect, with an important extra feature: Wildcard characters are supported. As MMview does not support multiple selections, deleting multiple files could become tedious. WIldcard can make this job easier, e.g. '*.mp3' would wipe all mp3 files of the current directory. Be careful.

Other changes
- added support for .mpg videos
- added support for wmctrl (if installed will cause dialogs Find/Rename/Duplicate/Delete to stay on top)


Issues
An unresolved issue in Lucid 5.2.8: Viewing size of subfolders (F1 pressed after selecting folder) does not work due to an outdated sort command used in Lucid. I consider this feature (and Lucid) unimportant enough not to search for a fix.

General Gtk-filechooser issue: Chooser permanently scans the displayed file list and immediately updates the display when a file/folder is renamed or removed. This is not true for files/folders at the root level '/'. It's a bit irritating when nothing seems to have changed after a rename/delete operation but maybe this behavior is intentional (root level practically newer changes => no scan?).
mmview_new_menuitems.png
 Description   
 Filesize   58.8 KB
 Viewed   386 Time(s)

mmview_new_menuitems.png

Back to top
View user's profile Send private message 
smokey01


Joined: 30 Dec 2006
Posts: 2657
Location: South Australia

PostPosted: Mon 07 Aug 2017, 01:53    Post subject:  

Nice.

The new functions Copy, Rename and Delete would be nice on a right click.

Thanks

_________________
Software <-> Distros <-> Tips <-> Newsletters
Back to top
View user's profile Send private message Visit poster's website 
perdido


Joined: 09 Dec 2013
Posts: 696
Location: Altair IV , Just north of Eeyore Junction.

PostPosted: Mon 07 Aug 2017, 03:29    Post subject:  

I have seven different versions of MMview on my desktop Smile

When I open two different versions at same time there is no way to tell them apart except by looking at the MMview icon eyes that have changed color.
I am having a staring contest with icon eyes Shocked

Maybe an "About" on menu task bar somewhere with version number and author name could keep me from wondering which version I have open Smile

Thank You Mochimoppel!

.
Back to top
View user's profile Send private message 
misko_2083


Joined: 08 Nov 2016
Posts: 19

PostPosted: Mon 07 Aug 2017, 22:08    Post subject:  

Mochi have you considered displaying file and folder metadata?
You can format the output of the stat command to be more human readable. Here's an example

If it's too slow maybe it could show up with F1.
mm_view_example.gz
Description 
gz

 Download 
Filename  mm_view_example.gz 
Filesize  40.3 KB 
Downloaded  28 Time(s) 
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4756
Location: Kingwood, TX

PostPosted: Tue 08 Aug 2017, 16:07    Post subject:  

misko_2083 wrote:
Mochi have you considered displaying file and folder metadata?
You can format the output of the stat command to be more human readable. Here's an example

If it's too slow maybe it could show up with F1.

If you use stat, (or other core utils), please use the busybox compatible variants ... usually short options vs. long options

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
tallboy


Joined: 21 Sep 2010
Posts: 813
Location: Oslo, Norway

PostPosted: Sun 13 Aug 2017, 14:24    Post subject:  

MMview now supports Lucid 5.2.8 and provides basic file management functions rename/move/duplicate/delete.

Very nice, Mochi!

Code:
### Universal file viewer
### MochiMoppel 2017-08-07
{ ###HEADER
TEMPDIR=/tmp/mm_view            # For temp files
CNFGDIR=$HOME/tmp/mm_view         # For user settings. ($HOME/tmp not saved to savefile. Eventually should be $HOME/.config/<appname>
[[ -d $TEMPDIR ]] || mkdir -p $TEMPDIR
[[ -d $CNFGDIR ]] || mkdir -p $CNFGDIR


I would presume that $HOME is for those who run a frugal Puppy, and use a savefile. I run live Puppys only, no savefiles. Can you please suggest a modification to your code to be used without a savefile? I know I can set it to whatever I prefer, but I would be more comfortable if I could follow your advice. My choice in Lucid 5.2.8.7 would be /root/.config/mm_view.

tallboy

_________________
True freedom is a live Puppy on a multisession CD/DVD.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Mon 14 Aug 2017, 03:44    Post subject:  

@smokey01: Maybe it would be nice, but the existing built-in right-click menu can't be altered.

@perdido: Laughing A collector? Be happy and use only the latest. And if you can't tell them apart anyway, what does it matter if you don't see the version number...or the author name? BTW: I never thought that someone would take my fashion glasses for eyes. I wish I had such impressive eyes Laughing

@misko_2083:Thanks. I have contemplated already many times to use stat in some form, but I always come to the same conclusion: The basic info like filename, date, size is already viewable and most of the remaining info like blocks and inode is too geeky for a normal user. Those who need it can always use the codebox, type stat $@, and enjoy the output for any file. This is why I find the codebox so useful. But your remark reminds me that we might need a "Properties" view (Ctrl+P ?), which could be a clone of the properties menu in ROX-Filer. I'll add it to my to-do-list but I can't promise anything.

@technosaurus:I've checked misko_2083's and my code and don't find anything that might have sparked your comment, so I file it under "General coding advice". Thanks.

@tallboy: Normally $HOME refers to /root. When you use no save file and save config settings to /root/.config/mm_view, those settings will be lost when you exit Puppy. If you want to keep them you should save them outside of Puppy, somewhere in /mnt/home or /mnt/sda1 or whatever your drive is named.

.

Last edited by MochiMoppel on Tue 15 Aug 2017, 09:28; edited 1 time in total
Back to top
View user's profile Send private message 
tallboy


Joined: 21 Sep 2010
Posts: 813
Location: Oslo, Norway

PostPosted: Mon 14 Aug 2017, 04:24    Post subject:  

Thank you, mochi. I run my CD as multisession, so I can save the session and keep the setup.

tallboy

_________________
True freedom is a live Puppy on a multisession CD/DVD.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Wed 13 Sep 2017, 08:54    Post subject:  

- double post removed -
Last edited by MochiMoppel on Wed 13 Sep 2017, 09:04; edited 1 time in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 11 of 12 [172 Posts]   Goto page: Previous 1, 2, 3, ..., 9, 10, 11, 12 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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
[ Time: 0.0719s ][ Queries: 15 (0.0091s) ][ GZIP on ]