Re: [Zim-wiki] new wiki syntax: better way to implement in Zim ?

2011-01-29 Thread Thorsten Hackbarth
Hi,
I experimented with replacing zim's Parsetree with docutils.document
class.
The docutils/reStructueredText approach looks quite promising:
- the code looks well structured
- and its documented
- there are writers for different formats. (latex, odt,...)
- positive side effect: parsers/writers for new formats could expand the
docutils code base
but a lot of work: 
- I could not find a (working) rst writer !?
- for compatibility it's necessary to write a docusils parser for zim
wiki syntax
- maybe expand zim to support all rst markup features

Regards,

Thorsten
 





___
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] newbie here: info request (for import)

2010-09-23 Thread Thorsten Hackbarth
Am Mittwoch, den 22.09.2010, 08:39 +0200 schrieb Alessandro Magni:
 Hi Thosrsten,
 thanks for the input!
 
 It is great news for me that it is possible to have zim-files 
 disseminated around the filesystem...
 unfortunately I believed it impossible, so I already wrote down my 
 crawler program that puts all the files in a unique directory.
 It is still a bit rough, but I hope to have it polished in a few days - 
 if it could interest anybody I'll gladly post it here.
 What worries me about your approach is that it involves changing the Zim 
 program itself, so I fear it could result incompatible in the event of a 
 Zim upgrade - unless the developers hear our call for help and make it 
 available as an option in the program itself.
 If I may ask, are you using this trick for my same need (i.e. to have an 
 hypertext self-commenting directory structure)?
@Alessandro
as you already noticed zim places subpages in subdirectories in the form
of:
page_name.txt
page_name/subpage.txt
page_name/subpage/subsubpage.txt
other_page.txt
[...]

I prefer this form: 
page_name/README.txt
page_name/somefile.pdf
page_name/subpage/README.txt
page_name/subpage/someotherfiles.pdf
page_name/subpage/somesourcefile.tex
page_name/subpage/subsubpage/README.txt
other_page/README.txt  
[...]
for working on an existing tree.


@Japp:
I tried to create my own zim/stores/filesindirs.py with a configurable
file name, but it looks like there is no way to tell zim to use the new
storage?


regards




___
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] newbie here: info request (for import)

2010-09-20 Thread Thorsten Hackbarth
Am Montag, den 20.09.2010, 16:51 +0200 schrieb Jaap Karssenberg:
 On Mon, Sep 20, 2010 at 11:04 AM, Alessandro Magni ma...@inrim.it wrote:
  Thank you for your help!
 
  I want to ask a further question, though I fear the answer will be no:
  since the files we are mentioning should be one related to each folder, my
  ideal situation would be to have one of those positioned at each folder.
  I fear for now Zim keeps them instead positioned in one unique root folder -
  there is some workaround possible?

I had the same problem here and I simply made 3 changes in 
zim/stores/files.py

add at beginning of file:
import os

line 53:
old:
filepath = encode_filename(name)+'.txt' # FIXME hard coded extension
new:
filepath = encode_filename(name)+'.'+os.sep+'README.txt' # dirty hack

line 83:
old:
elif file.endswith('.txt'): # TODO: do not hard code extension
new:
elif file.endswith('.'+os.sep+'README.txt'): # dirty hack

Now  all my page contend is stored in the files README.txt in
directories named after the pages.

Maybe you will get Problems when renaming pages...

I tried to create my own zim/stores/filesindirs.py with a configurable
file name, but it looks like there is no way to tell zim to use the new
storage(?).
 

regards



___
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 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


[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