Re: [Zim-wiki] Online storage

2009-11-24 Thread Jaap Karssenberg

Pedro wrote:
... 8 ..
Jaap, can you jump in the discussion and drop a quick briefing of the 
basics on zim data storage?


The storage is abstracted by the store classes. The default file 
storage does a straightforward mapping from a page name to a file name 
and saves data in one file per page.


By writing a new store class you can e.g. change the layout of the 
notebook directory or use a completely different backend like e.g. IMAP 
to store data.


The API for the store classes is pretty dump. They can get a page object 
and store it again and provide page listings per namespace. The 
'store_page' method for the backend is called every time the page is 
saved - so not only when navigating away, but also when autosaving on 
5sec intervals.


If you are mainly interested in using an online storage for 
synchronization purposes, I see the following approaches:


0) Do nothing and let the file system layer handle it. This is e.g. the 
case when you use UbuntuOne to store a zim notebook. You just put the 
notebook in the synced folder and that is all.


1) Write a store backend for a specific protocol like IMAP or . This has 
it's advantages, but one disadvantage is that you can not touch your 
notes when you are offline. Another disadvantage is that this means a 
certain amount of custom code to make zim speak a specific protocol. 
Biggest advantage from user point of view is that because the server can 
have a single state you will almost never have merging conflicts.


2) Or we can treat merging in parallel to the actual storage, only 
assuming that the storage is done on a local file system. This approach 
is similar to how versioning is handled. This means we use available 
solutions for synchronizing files. The advantage is that this way we 
re-use existing code and have to do minimal zim specific work. My 
preferred solution would be to use a versioning system like bazaar or 
subversion to do the synchronization, but we could hook up rsync in much 
the same way.


The main thing we need is a signal that triggers synchronization. Doing 
this at every auto-save is too often. But we could trigger e.g. at start 
of the application, when navigating away from a page, when closing the 
application etc. Or even apply a time-based interval when zim is running.


The synchronization would check for new versions on the server and push 
any modifications we made. Only disadvantage is that we need to take 
into account the possibility of merging conflicts. My proposal would be 
to try syncing automatically and when a conflict is found prompt the 
user to either do a manual merge or keep working (in the later case 
disable the event, till some later time, e.g. next application close / 
start and prompt again).


If we define the conditions when synchronisation should be triggered 
various plugins could handle the specific systems. E.g. the version 
control plugin could provide this functionality, but there could be a 
separate rsync plugin that does the same.


Btw. I'm working now to add version control to the python version - 
expect to release that update either thursday or sunday. So there is 
some actual working code to at least support bazaar, and this can easily 
be extended to other systems like svn, git, etc.


Hope this provides the background you were looking for.

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] 1:1 vs. piped links

2009-11-24 Thread Jaap Karssenberg

0x wrote:

I'm finding that I'm spending a lot of time going back and removing GUI-generated links 
(in Zim) - more time doing that, in fact, than I would manually entering 
links to begin with.

What I would like to have (to do, perhaps) with the Zim GUI is what was suggested regarding a checkbox or radio button that will turn the auto-linking associated with CaML case on/off.  

I am working mostly with software development documentation and notes - /everything/ is CaML case - I don't mind having to hit ^L to make some text into a link.  
  


Uhm - did you ever check the preferences menu ? There is in fact exact 
such a checkbox there to control auto-linking of camel case words...


-- 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] 1:1 vs. piped links

2009-11-24 Thread Jaap Karssenberg

Beni Cherniavsky wrote:
... 8 ...
Currently pyzim is close to the second and that's annoying - you have 
to type the same thing twice to create a link!


Let me detail how it is intended to work in the current implementation: 
if the target and label already differ than the target will stay fixed 
while the text can be freely edited. However when both are the same they 
stay linked until the user eplicitly sets a different target.


The reasoning is that it would be very counter intuitive to see an URL, 
edit it, and find the target did not update. The same goes for page names.


The current dialog in pyzim allows you to specify both text an target, 
but this is not mandatory. If you enter the target, hit Enter twice 
(leaving the text empty) it will just use the target as the text. If you 
select text and open the dialog hitting Enter twice will turn it into 
a link.


I myself find that links become better behaved by treating them like 
objects that need to be edited with a dialog instead of a formatting 
style. But obviously there are corner cases.


The auto-linking of urls, camelcase, etc. should further reduce the 
numer of times that you actually need to use the dialog. Auto-linking 
behavior should be controllable from preferences because it can be very 
annoying when it gets things wrong. Also the undo action should properly 
undo autolinking as a separate editing step.


... 8 ...
I'm not sure how all this should be blended, but here are some 
tricks/ideas:


* Show broken links in red: this makes it obvious when you are 
breaking/retargetting links.


This is something I would really like - at least for internal links - an 
url checker is something else. I did not implement this in the perl 
version because of the cost of resolving links. In the python version we 
have the SQLLite driven index which make looking up page links much 
cheaper.


Should also set a style property for broken links in html export while 
we are at it.



* Don't even show text field in Link dialog, only target.
  This makes it clear that text is edited by directly editing the page.


Disadvantage is that when auto-formatting does not pick up the link you 
first type text, then go back select it and add the target. While now I 
hit the dialog, enter the target, hit Enter, and continue typing. Maybe 
very personal preference, but I don't like going back while typing in a 
flow.


* Have checkbox or radiobox in Link dialog to toggle 1:1 mode (default 
on).


How would that work ?? Once you have both a label and a target, how 
would you display it after switching back ? In general I would like to 
avoid switchable behavior for this.


* Show the 2 link modes in different colors.  E.g. blue/red for 1:1 
links, green for other links.


This could very well be done. Maybe keep the same color, but use e.g. a 
subtle underline to distinguish. Anyway the style would be controllable 
from the config file - so you cold make the colors more obvious if you 
want to.


* While the editing cursor is on a link, it expands to also show the 
target, e.g. [link|target].
  When the cursor leaves the link, it collapses and you see just the 
text in blue.


This is difficult to get right when it is inline in the textview. Also 
makes the page look unstable because text starts moving around when 
you move the cursor over the page.


Please note that the signals for mouse over are there already. Link 
target is displayed in the status bar on mouse over. Probably would more 
obvious when using tooltips for this. Should not be too hard to make.


* While the editing cursor is on a link, a tooltip-like mini-dialog 
hovers beneath it.

  This is more discoverable and friendly, though less keyboard-friendly.
  Gmail does this.


See above. At least statusbar display could be linked to cursor as well. 
Tooltip linked to cursor might be a bit annoying.



* Consider Tomboy autolinking for creating links of the simple 1:1 kind?


You mean turning words that match page names into links ? This has been 
implemented in some zim version already as a hidden option, but never 
worked very well. Goes back to the same discussion about the cost of 
resolving a link. Can now be done much easier due to the new page index.


Would not use this myself, but I would welcome a patch for this as long 
as it is packaged as a plugin. Plugins can already hook into 
auto-formatting behavior, so while typing auto-linking can be done. And 
a plugin could check the page when loading.



Please let me know your thoughts on these topics, and where you see room 
for improvement.


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] Online storage

2009-11-24 Thread Jaap Karssenberg

0x wrote:

Given what I know about Perl's ability to transparently access remote files and 
file systems, I was just getting ready to start looking at the Zim sources, but 
figured I should catch up on the FAQs and mailing list, first...
  


Be aware that I'm pretty far with porting zim to python. So you might 
want to take a look at the python sources instead.


As I mentioned in the other part of this thread the storage classes are 
where you want to go poking around when you want remote connectivity. As 
long as you have a way to get and put files and to list directories it 
should be pretty straight forward. Python comes with a number of 
standard classes that allow web connectivity.


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