[kupfer: 14/20] zim: selecting notebooks by path (not by name).
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer: 14/20] zim: selecting notebooks by path (not by name).
- Date: Wed, 7 Oct 2009 11:34:00 +0000 (UTC)
commit d07efa333a1ab5cb26c2e712c1c1b406adfb189f
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date: Tue Oct 6 18:56:22 2009 +0200
zim: selecting notebooks by path (not by name).
kupfer/plugin/zim.py | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/kupfer/plugin/zim.py b/kupfer/plugin/zim.py
index 6fd873e..0ffc055 100644
--- a/kupfer/plugin/zim.py
+++ b/kupfer/plugin/zim.py
@@ -38,16 +38,15 @@ TODO:
def _start_zim(notebook, page):
''' Start zim and open given notebook and page. '''
cli = "zim '%s' '%s'" % (notebook, page.replace("'", "_"))
- print cli
utils.launch_commandline(cli)
class ZimPage(Leaf):
""" Represent single Zim page """
- def __init__(self, page_id, page_name, notebook_id, notebook_name):
+ def __init__(self, page_id, page_name, notebook_path, notebook_name):
Leaf.__init__(self, page_id, page_name)
self.page = page_name
- self.notebook = notebook_id
+ self.notebook = notebook_path
self.notebook_name = notebook_name
def get_actions(self):
@@ -106,7 +105,7 @@ class OpenZimPage(Action):
Action.__init__(self, _('Open Zim Page'))
def activate(self, leaf):
- _start_zim(leaf.notebook_name, leaf.page)
+ _start_zim(leaf.notebook, leaf.page)
def get_icon_name(self):
return 'document-open'
@@ -121,7 +120,7 @@ class CreateZimSubPage(Action):
Action.__init__(self, _('Create Subpage...'))
def activate(self, leaf, iobj):
- _start_zim(leaf.notebook_name, leaf.page + ":" + iobj.object.strip(':'))
+ _start_zim(leaf.notebook, leaf.page + ":" + iobj.object.strip(':'))
def get_icon_name(self):
return 'document-new'
@@ -188,7 +187,6 @@ class ZimPagesSource(AppLeafContentMixin, Source):
def get_items(self):
strip_name_first_colon = not __kupfer_settings__["page_name_starts_colon"]
for notebook_name, notebook_path in _get_zim_notebooks():
- notebook_file = os.path.join(notebook_path, "notebook.zim")
for root, dirs, files in os.walk(notebook_path):
# find pages in notebook
for filename in files:
@@ -205,7 +203,7 @@ class ZimPagesSource(AppLeafContentMixin, Source):
page_name = (page_name
.replace(os.path.sep, u":")
.replace(u"_", u" "))
- yield ZimPage(file_path, page_name, notebook_file,
+ yield ZimPage(file_path, page_name, notebook_path,
notebook_name)
def get_description(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]