[Zim-wiki] Makeshift Table plugin

2013-08-21 Thread Klaus-Dieter Bauer
Hello!

Some time ago I have written a makeshift ascii-art based table
plugin. I have now uploaded it, in case someone else wants to use it
too.

http://bazaar.launchpad.net/~k.bauer/zim-makeshift-table-plugin/trunk/

It uses fixed-width text to create an emulation of tables; While
rudimentary and not working well with HTML-printing (linebreaks inside
the rows) it might help some managing their data until someone has the
time for writing a real table module. Details are explained in the
module comment inside the source file. The main advantage compared to
using source code blocks is the (limited) ability to use links/images
inside tables.

So far I had no problems with the plugin, but I'd dearly recommend
using file versioning to prevent data loss in case of bugs.

  - Klaus

___
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] Folder structure

2013-08-20 Thread Klaus-Dieter Bauer
2013/8/20 Jaap Karssenberg jaap.karssenb...@gmail.com:
 [...]

 The suffix, or the -attachments folders solve a problem for indexing. This
 is a problem I will solve differently when refactoring the index. The idea
 is that zim will inspect the content of text files to determine whether or
 not it are pages. I don't mind allowing alternative suffix as well if that
 makes interoperability easier, but for default will stick to .txt.

 [...]

 Regards,

 Jaap

Just a quick list of issues that are raised by the ambigous file
extension and would require major (probably OS-dependent) pains to fix
without changing the extension:

  + No distinction from plain text files by icon (inconvenient e.g.
when viewing results of desktop search).
  + No double-click-to-open in file browsers / search results without
breaking the behaviour for non-zim .txt files.
  + ZIM must check .txt files for ZIM page format,
  - when indexing
  - when listing attachments
  - ... ?
  + When processing notebooks through an interactive shell,
distinguishing normal text files from zim page files is unviable
and inconvenient when processing them with shell scripts.

Is there some reason, why you want to keep the .txt extension? I
can't see much of an advantage.

  - Klaus

___
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] Next in index, on same level?

2013-08-16 Thread Klaus-Dieter Bauer
2013/8/14 Jaap Karssenberg jaap.karssenb...@gmail.com:
 Afraid currently that is hardcoded. Coul dmake it optional, or could
 make the tree fold again after going to the next page. Point is that
 by fully disabling it, you have no direct view of sub-pages for
 cases where you do use them actively.

True, subpages are often actually needed... and if I didn't favor
flat, chronologic structures (since I end up tricking myself with
overcomplicated structures otherwise) not having them show would be
annoying.

The most compatible solution would probably be binding the fold
current tree and go to next to a new hotkey
(Shift+Alt+Up/Down/PageUp/PageDown?) and make the folding an option.

I made a makeshift solution with some gotchas by using AutoHotKey,
that does just that though, so for me personally a clean
implementation would be nice, but not high priority now.

  - Klaus

___
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] Next in index, on same level?

2013-07-29 Thread Klaus-Dieter Bauer
Hello!

Is there currently some function for jumping to the next entry in the index
of the same herachy level?

I organize my pages into a flat, date-based structure but sometimes I have
e.g. technical details that logically belong to the page but are
uninteresting when browsing through the notebook. Currently when using the
next in index menu item, the detail subpage(s) will be included.

The same problem applies to the default behaviour of expanding the tree
when visiting a page.When I want to browse through the summary pages, I'd
rather leave the tree folded as much as possible unless explicitly needing
the details; Most of the time the subtree is just an unnecessary
distraction, especially since the attachment directory may contain folders
that are no pages at all (but show up in the tree).

kind regards, Klaus
___
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] A makeshift table plugin; breaks undo.

2013-07-10 Thread Klaus-Dieter Bauer
I have largely overhauled my table plugin with a new format (less boundary
cases for better stability, cleaner functions, a bit of documentation).

The problem of preserving Undo information persists.



2013/7/8 Klaus-Dieter Bauer bauer.klaus.die...@gmail.com

 Hello!

 I have written a make-shift table plugin, that just helps managing tables
 made from verbatim text (though images and links are possible, but
 currently break the formatting). Basically it looks for a line starting
 with {{| and the earliest line afterwards ending with ||} and realigns
 table contents in between.

 However, I found this extremely difficult to do on the level of the
 parsetree and instead extract the source code through
 page.dump(zim.formats.wiki), modify the source and write it back with
 page.parse(...).

 Sadly though, afterwards Undo is not possible.

 Is there some way that I can modify the contents of a page without
 breaking Undo?

 I have attached the experimental source and a file with example tables for
 reference. (Note: High risk of data loss, it's still pretty buggy).

 kind regards, Klaus

Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2013-07-10T16:21:28+02:00

== Table ==
Created Wednesday 10 July 2013

''{| --  -  --  -''
''Value  Error  Source   ''
''   ==  =  ==  =''
''   Volume  35 Å³  0.3 Å³  ''[[CopyEquations]]
''   Lattice Const.  30 Å0.1 Å  ''[[Home]]
''  r  r ''
''   --  -  --  - |}''

''{| | Value   Error  Source  ''
''   | ==  =  ==  =  =''
''   | Volume  35 Å³  0.3 Å³  ''[[CopyEquations]]   
''   | Lattice Const.  30 Å   0.1 Å   ''[[Home]]   
''   | savemode   1   2  3 |}''

''{| | Value   Error  Source   ''
''   | ==  =  ==  =''
''   | Volume  35 Å³  0.3 Å³  ''[[CopyEquations]]
''   | Lattice Const.  30 Å   0.1 Å   ''[[Home]]'' |}''

''{| -- | -  --  -''
''   Value  | Error  Source   ''
''   == | =  ==  =''
''   Volume | 35 Å³  0.3 Å³  ''[[CopyEquations]]
''   Lattice Const. | 30 Å   0.1 Å   ''[[Home]]
''   -- | -  --  - |}''


''{| l  | rrl   | Value   Error  Source''
''   == | = | ==  =  ==''
''   Volume | 35 Å³ | 0.3 Å³  ''[[CopyEquations]]
''   Lattice Const. | 30 Å  | 0.1 Å   ''[[Home]]'' |}''


tabletrix.py
Description: Binary data
___
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] Zim 0.60 released

2013-05-08 Thread Klaus-Dieter Bauer
2013/5/2 Jaap Karssenberg jaap.karssenb...@gmail.com

 On Wed, May 1, 2013 at 10:59 PM, Syv Ritch s...@foto-biz.com wrote:
  Thanks for the new version. I just upgraded to 0.60. I just have some
  questions. I use Zim 0.60 on an xUbuntu 12.04.
 
  * Up to 0.59 (including 0.59), every time that I would stop typing,
Zim would save the notebook after a few seconds. It doesn't do it
anymore, Zim only saves the notebook on exit. I preferred the older
way of auto-saving. Is there a way for changing it back to the
continuous auto-save?
 
  * The new 0.60 is much slower on startup than 0.59. I did a: zim
--index -V notebooks/(notebook name). It helped (a lot) with the
speed of the startup but definitely not as fast as 0.59 which was
almost instantaneous. After the startup I do not see much of
difference in the speed. Am I the only one and doing something
wrong or...

 Afraid I don't recognize either of those two items.

 Auto-save code has not changed at all in this release. Checking on my
 system is saves about every 10 seconds or when leaving a page. If this
 does not work on your system, please open a bug report.

 First time startup may indeed be slower due to the index being
 rebuild. After that there should be no delta. In fact on my system the
 new version is faster than the old one. Might help to run zim with
 debug logging and see at what debug output the time is spent. Also
 something that should go in a bug report.

 Regards,

 Jaap


I can confirm the startup speed problem. I created a bugreport for it with
some detail analysis.

https://bugs.launchpad.net/zim/+bug/1177718

If I understand it right, zim queries for an existing server on startup
before starting a new one and has a ≈10 second timeout waiting for a
response that will never come.

kind regards, Klaus
___
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 styles and index pain

2013-05-07 Thread Klaus-Dieter Bauer
2013/5/7 Niels-Oliver Walkowski walkow...@nowalkowski.de

  Dear folks,

 I am testing the possibility to move with my  PhD project from Scrivener
 to Zim. I really love Scrivener, but does not really support Linux is
 brings a lot of problems. So a more native solution would be great. At the
 moment I have two questions where I couldn't help myself on m own. The
 first on is: it is possible to define new styles in zim apart from just
 changing existing styles in  styles.conf. Just adding it there has no
 effect as I experienced, what would be the effort to add new styles ( I am
 capable of doing some Python)

 When you write a text, the best writing experience for me is to write in
 between wiki and hirarchical structes and to use them both to rearrange
 text block. At the moment the index pane list the wiki pages
 alphabetically, what would be awsome and really needed for the
 rearrangement process is to influence the order of the pages within the
 index. I noticed that drag and drop is generally possible in that widget
 but what was dropped doesn't stay there. So, also the question, is this
 possible to change somewhere and if not, can anyone guess, what would be
 the effort enable it.

 thanks a lot in advance
 Niels


Hello!

Given that you are just migrating right now, there IS a possibility to get
an arbitrary order:

Instead of creating new pages the normal way, create new pages by creating
a link to a target +PAGENAME in the parent page and follow the link. This
way you have an order-able (cut/paste) list of subpages *in addition* to
the alphabetical index pane.

Obviously though this approach is sort of limited. It doesn't provide a
full custom-sorted tree view and requires extra work when moving a page,
but as a work-around it might suffice.

kind regards, Klaus
___
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] Searching for check boxes

2013-02-17 Thread Klaus-Dieter Bauer
Unchecked boxes are recognized as (nestable) TODO items by the task-list
plugin.

As for [*] and [x], I don't know any method short of full-text search with
external tools (e.g. `grep [x] *.txt */*.txt */*/*.txt ...`).

kind regards, Klaus

2013/2/17 Chris Habasinski cjh...@gmail.com

  I have seen this question asked before but could not find an answer:
 How can I search for checkboxes - open, checked and x-ed. I have tried
 everything I can think of in the search pane but no joy.

 Thanks

 ___
 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


___
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] c:\Program Files\zim-0.58\zim.pyw fails for 0.58

2012-12-18 Thread Klaus-Dieter Bauer
2012/12/18 Jaap Karssenberg jaap.karssenb...@gmail.com

 On Tue, Dec 18, 2012 at 11:13 AM, JP Vossen j...@jpsdomain.org wrote:
  On 12/18/2012 02:57 AM, Jaap Karssenberg wrote:
 
  Probably you have to use the --standalone switch in this case. This
  was also reported for version 0.57.
 
 
  Yup, that worked.  And now that you mention it, I vaguely remember that.
 
  So either of these work in a shortcut:
  C:\Program Files\zim\zim.pyw --standalone
  --or--
  C:\Python26\pythonw.exe c:\Program Files\zim\zim.pyw --standalone
 
  (Anyone who gets here via search engine, note my previous message
 detailing
  where zim.pyw came from.)

 Just tested on my own system, but for me running pythonw *without*
 --standalone works just fine. Executed with a shortcut terminal pops
 up briefly but closes automatically when zim window pops up. (Which
 makes sense as the initial process quits ones the background process
 is started.)

 Using python 2.7 on windows 7.

 Regards,

 Jaap


Some observations from my side (Windows 7 64bit, Python 2.7 (Enthought
Distribution), zim 0.58).

If run as python zim.py, I get the notebook-selection dialogue and can
open other notebooks with Ctrl-O. But If I press F1, the manual doesn't
appear.

When adding either --debug or --verbose, the console says on F1-press:

C:\Python27\python.exe: can't open file 'zim': [Errno 2] No such file
or directory

If I run zim as pythonw zim.py I get the notebook-selection dialogue, but
after selecting a notebook the notebook dialogue disappears, pythonw.exe
keeps running in the background but nothing happens.

In order to get debug output I modified zim.py (saved as
zim-customstart.py) to write zim.log also when run with pythonw.exe ( see
also https://bugs.launchpad.net/zim/+bug/1091606 ). I ran pythonw
zim-customstart.py --verbose --debug, tried to open a notebook and then
killed the pythonw-processes to gain access to zim.log, which reads:

Traceback (most recent call last):
  File string, line 1, in module
  File C:\Python27\lib\multiprocessing\forking.py, line 373, in main
prepare(preparation_data)
  File C:\Python27\lib\multiprocessing\forking.py, line 488, in prepare
'__parents_main__', file, path_name, etc
  File E:\portable\zim-0.58\zim-customstart.py, line 79, in module
zim.main(argv)
  File E:\portable\zim-0.58\zim\__init__.py, line 294, in main
zim.ipc.handle_argv()
  File E:\portable\zim-0.58\zim\ipc.py, line 117, in handle_argv
servermain()
  File E:\portable\zim-0.58\zim\ipc.py, line 296, in servermain
os.dup2(si.fileno(), sys.stdin.fileno())
OSError: [Errno 0] Error

Just for reference from ipc.py the relevant code part:
def servermain():
'''Main function for the servr process'''
 # Decouple from parent environment
# and redirect standard file descriptors
 os.chdir(/)

si = file(os.devnull, 'r')
os.dup2(si.fileno(), sys.stdin.fileno())  # Here the Error occurs.

I.e. setting STDIN to devnull fails. Interestingly though, when run from
an interactive console (both ipython and python -i) the code works (but
renders the console unusable).

The maimed python processes kept running after closing the host window
(cmd.exe) and caused some single-core CPU load. Per running maimed python
process, there was 4% cpu load by python.exe and an additional 4% in
csrss.exe (Client/Server Run-Time Subsystem according to neuter.com), i.e.
totalling half a core on my hyperthreaded quadcore. The spike in heat and
fan noise of the device suggest that turbo-boost was active too.

It seems windows doesn't like STDIN being connected to NUL for whatever
reason. Interestingly, when running a script-file

import os
import sys
nul = file(os.devnull,'r')
os.dup2(nul.fileno(), sys.stdin.fileno())
print test

the script terminated without any issues, so the weird behaviour of
interactive sessions probably is causes by the interactive processing of
input.

Sadly, Errno 0 isn't exactly helping either. Assuming this is a forwarded
C-error-code, 0 should normally mean, that there is NO error. Anyway, among
the possbile error reasons for the C-function dup2, I found only one
plausible reason: One of the file descriptors may be invalid.

-- Addition --
In further test-runs I produced a yet more-confusing zim.log. In addition
to the OSError it contains a region of binary zeros (for whatever reason)
and some EOFError:

Traceback (most recent call last):
  File zim-customstart.py, line 79, in module
zim.main(argv)
  File E:\portable\zim-0.58\zim\__init__.py, line 445, in main
gui = server.get_notebook(notebook)
  File E:\portable\zim-0.58\zim\ipc.py, line 757, in get_notebook
return self.get_proxy(RemoteObject(self._notebookklass, uri), open)
  File E:\portable\zim-0.58\zim\ipc.py, line 739, in get_proxy
self.init_object(remoteobject)
  File E:\portable\zim-0.58\zim\ipc.py, line 705, in call
re = conn.recv()
EOFError

The full log file is sent as attachment.


regards, Klaus


zim.log
Description: Binary data

Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-17 Thread Klaus-Dieter Bauer
In previous discussions, has Windows been taken into account? From what I
could find, even Microsoft software uses stub-program if a specific version
of a program should be launched. So it seems safe to assume that there is
no good mechanism to make the destinction work in windows.

An advantage of a likely non-conflicting file-extension like .zimwiki
would be easy cross-platform mime-type handling. Seeing how the mime-type
issue seems to make a lot of work, isn't it actually a good point to
re-discuss the extension issue?

regards, Klaus


2012/12/16 Jaap Karssenberg jaap.karssenb...@gmail.com

 On Sat, Dec 15, 2012 at 10:41 PM, Svenn Are Bjerkem
 svenn.bjer...@googlemail.com wrote:
  Isn't it more wise to use a different extension than .txt for the zim
  markup files? I guess this has been pointed out some times in the
  past? Use .zxt or .zml or .zimwiki so that .txt is reserved for pure
  text files and no need to use processing overhead on file headers to
  decide if it is a zim markup file or a pure text file attachment. .txt
  has been around longer than zim, and I have always thought it to be a
  bit 'egoistic' to grab this for a special purpose for one particular
  application.

 Yes, this has been discussed more than once on this list before. I
 personally don't think re-opening the discussion at this time will
 bring any new ideas to the table.

 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

___
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