Re: [Zim-wiki] new plugin: fileview

2010-09-16 Thread Thorsten Hackbarth
Hi,
I put a new version in the wiki and maybe will update the page from time
to time.
I removed some of the rough edges and made some new.
If you also like it rough go here:
http://zim-wiki.org/wiki/doku.php?id=attachment_browser
It now generates thumbs in the backgrund and shares it with other
application (see freedesktop.org thumbnail spec) 
Dont forget to delete the old fileview.py and fileview.pyc.



Am Mittwoch, den 07.07.2010, 15:58 +0200 schrieb Svenn Are Bjerkem:
 Jaap,
 I use this plugin on a daily base and the only rough edges I see is
 the lack of resizing the window.
 Why not put it in trunk to boost development? There are other plugins
 which have had rougher edges over the time than this, and still they
 were allowed in trunk.
 This plugin is extremely useful for us users who store additional data
 in the zim tree, the previews are just fantastic help to find
 referenced material by visual inspection.
 
 I give this plugin a thumb up for trunk.
 



___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] new plugin: fileview

2010-09-16 Thread Jaap Karssenberg
On Thu, Sep 16, 2010 at 6:45 PM, Thorsten Hackbarth
thorsten.hackba...@gmx.de wrote:
 I put a new version in the wiki and maybe will update the page from time
 to time.
 I removed some of the rough edges and made some new.
 If you also like it rough go here:
 http://zim-wiki.org/wiki/doku.php?id=attachment_browser
 It now generates thumbs in the backgrund and shares it with other
 application (see freedesktop.org thumbnail spec)
 Dont forget to delete the old fileview.py and fileview.pyc.

Thanks for sharing. Still plan to include this plugin in the next
release (0.49).

If I have the time I'll do the work to add an interface to easier add
widgets to the main window, as you proposed in earlier mails.

Regards,

Jaap

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] new plugin: fileview

2010-07-07 Thread Jaap Karssenberg
On Tue, Jun 29, 2010 at 6:09 PM, Thorsten Hackbarth
thorsten.hackba...@gmx.de wrote:
 Am Dienstag, den 25.05.2010, 12:21 +0200 schrieb Jaap Karssenberg:
 I'm really interested in the plugin to preview / browse attachments.
 This is something I wanted to create myself, but didn't find time for
 yet. Might even want this as core functionality instead of as a
 plugin.

 Sorry for the even later reply.

 Here is a very basic version of the plugin.
 Still a lot to do, but works for me. I use it to browse collections of
 pdf files (technical documentation, data sheets, etc).

Basic functionality looks quite good although there are a lot of rough
edges that will need polishing before including it in trunk. Still I
think this is very useful for various users. I suggest putting it in
the wiki at http://zim-wiki.org/wiki and use a page there to track
improvements. Alternatively you could check in a bazaar tree for this
plugin in launchpad.

Some suggestions:
* Use gtk.pixbuf to generate thumbnails instead of imagemagick
* Follow the freedesktop.org spec for storing thumbnails
* Use the open_file method in zim to allow opening files on double click
* Maybe use a small pane for image preview instead of the tooltip ?

 For more flexibility I suggest changing the zim layout to something like
 this:
 +-+
 |menu                         |
 +-++--+
 |     |  top pane      |      |
 |     |                |      |
 | s   ++  s   |
 | i   | wiki editor    |  i   |
 | d   |                |  d   |
 | e   |                |  e   |
 | b   ++  b   |
 | a   |tabs|           |  a   |
 | r   | bottom pane    |  r   |
 |     |                |      |
 +--+--+

I'll keep this in mind when refactoring the interface.

Regards,

Jaap

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] new plugin: fileview

2010-07-07 Thread Svenn Are Bjerkem
Jaap,
I use this plugin on a daily base and the only rough edges I see is
the lack of resizing the window.
Why not put it in trunk to boost development? There are other plugins
which have had rougher edges over the time than this, and still they
were allowed in trunk.
This plugin is extremely useful for us users who store additional data
in the zim tree, the previews are just fantastic help to find
referenced material by visual inspection.

I give this plugin a thumb up for trunk.

-- 
Svenn

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] new plugin: fileview

2010-07-07 Thread Vlastimil Ott
Dne St 7. července 2010 15:58:20 Svenn Are Bjerkem napsal(a):

 I give this plugin a thumb up for trunk.

+1 

-- 

Vlastimil Ott
www.e-ott.info

Stahujte časopis o softwaru. Zdarma.
 http://www.openmagazin.cz

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


[Zim-wiki] new plugin: fileview

2010-06-29 Thread Thorsten Hackbarth
Am Dienstag, den 25.05.2010, 12:21 +0200 schrieb Jaap Karssenberg:
 I'm really interested in the plugin to preview / browse attachments.
 This is something I wanted to create myself, but didn't find time for
 yet. Might even want this as core functionality instead of as a
 plugin.

Sorry for the even later reply. 

Here is a very basic version of the plugin. 
Still a lot to do, but works for me. I use it to browse collections of
pdf files (technical documentation, data sheets, etc).


For more flexibility I suggest changing the zim layout to something like
this:
+-+
|menu |
+-++--+
| |  top pane  |  |
| ||  |
| s   ++  s   |
| i   | wiki editor|  i   |
| d   ||  d   |
| e   ||  e   |
| b   ++  b   |
| a   |tabs|   |  a   |
| r   | bottom pane|  r   |
| ||  |
+--+--+



# -*- coding: utf-8 -*-
#
# Copyright 2010 Thorsten Hackbarth thorsten.hackba...@gmx.de
# License:  same as zim (gpl)
#
# 2010-06-29
#
# TODO:
# * integer plugin_preferences do not to work as expected (zim bug?)
# * toggle:  hide/show = disconect/update
# * toggle: toolbar button state wrong  
# * toggle-btn icon
# * where to store thumbnails?
# in current dir: .thumb_filename.jpg  (hide on windows?)
# ~/.thumbnails/  (gnome/nautilus)
# .zim/cache/
# Thumbs.db
# let the user decide
# * thumbnail all images?
# * dont start all thumbnailing processes at a time, and make them nice 10
# * small and lagre thumbs 
# * textrendering: syntay-hl 
# * use mimtype not extension
# * rethumb: thmub-size==0 or broken (e.g. shutdown while thumbnailing)
# * option to remove all thumbnails
# * update view when thumb-cration finished
# * code cleanup
# * new gui concept for zim : sidepane r/l,bottom- and top pane both with tabs (see gedit)
# * show file infos in tooltip (which?)
# * update icon when thumbnail is ready
# * mimi-type specific icons
# * evaluate imagemagick python libs 
#
#
# tooltip example
#  http://nullege.com/codes/show/s...@pygtk-2.14.1@examp...@pygtk-demo@de...@tooltip.py/160/gtk.gdk.Color
# file info example
#  http://ubuntuforums.org/showthread.php?t=880967
#

'''Zim plugin to display files in atachments folder.'''

import gobject
import gtk

import pango

import os
import stat
import time

import re
import logging
from datetime import date as dateclass

from zim.plugins import PluginClass
from zim.gui import Dialog
from zim.gui.widgets import Button
from zim.notebook import Path
from zim.stores import encode_filename
from zim.fs import *
from zim.errors import Error
logger = logging.getLogger('zim.plugins.fileview')
from zim.applications import Application
from zim.gui.applications import OpenWithMenu


ui_toggle_actions = (
	# name, stock id, label, accelerator, tooltip, readonly
	('toggle_fileview', gtk.STOCK_MISSING_IMAGE, _('Fileview'),  '', 'Show Fileview',False, True), # T: menu item
)


#Menubar and toolbar
ui_xml = '''
ui
	menubar name='menubar'
		menu action='view_menu'
			placeholder name=plugin_items
menuitem action=toggle_fileview /
			/placeholder
		/menu
	/menubar
	toolbar name='toolbar'
		placeholder name='tools'
			toolitem action='toggle_fileview'/
		/placeholder
	/toolbar
/ui
'''



ICON_SIZE_MIN=16
ICON_SIZE_MAX=256
THUMB_SIZE_MIN=16
THUMB_SIZE_MAX=1024


# TODO: chaneg size
pdftopng_cmd = ('convert','-size', '480x480', '-trim','+repage','-resize','480x480','-quality','50')
#pdftopng_cmd = ('convert','-trim')
#txttopng_cmd = ('dvipng', '-q', '-bg', 'Transparent', '-T', 'tight', '-o')
#txttopng_cmd = ('convert', '-size', '480x480'  'caption:')
pdftojpg_cmd = ('convert','-size', '480x480', '-trim','+repage','-resize','480x480','-quality','50')


class FileviewPlugin(PluginClass):

	plugin_info = {
		'name': _('Fileview'), # T: plugin name
		'description': _('''\
This shows the storage directory of the current page as icon view at bottom pane.
ImageMagick dependencies: 
	html-preview: html2ps
'''), # T: plugin description
		'author': 'Thorsten Hackbarth thorsten.hackba...@gmx.de',
		'help': 'Plugins:Fileview',
	}

	plugin_preferences = (
		# key, type, label, default
		('icon_size', 'int', _('Icon size [px]'), [ICON_SIZE_MIN,128,ICON_SIZE_MAX]), # T: preferences option
		('preview_size', 'int', _('Tooltip preview size [px]'), (THUMB_SIZE_MIN,480,THUMB_SIZE_MAX)), # T: input label
		('thumb_quality', 'int', _('Preview jpeg Quality [0..100]'), (0,50,100)), # T: input label
	)
	
	@classmethod
	def check_dependencies(klass):
		return [(ImageMagick,Application(pdftojpg_cmd).tryexec())]

	def __init__(self, ui):
		PluginClass.__init__(self, ui)
		self.bottompane_widget = None
		self.scrollpane = None		
		if self.ui.ui_type == 'gtk':
			self.ui.add_toggle_actions(ui_toggle_actions, self)
			#self.ui.add_actions(ui_actions, self)
			self.ui.add_ui(ui_xml, self)