Skip to content

Commit

Permalink
add DJVU sub-menu item to book context and document menu configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kfix committed Oct 19, 2014
1 parent 2a91985 commit 876bbbc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ Files can be converted through a GUI menu and optionally as FileType hook for au
![GUI menu](/screenshot_menu.png?raw=true)
![Job log](/screenshot_job.png?raw=true)

DjVU files are best for rendering large image-based documents (100+ pg. black-and-white-scaned archive-books) on markup-ebook readers with sub-300MiB memory and sub-2GiB storage capacities.
The community-made Kindle readers kindlepdfviewer & koreader support DjVu files and can deliver noticable speed increase over PDF originals of such documents.
Some massive 1000+ page books can only be read unsplit on these devices in DjVu format.
DjVU format is ideal for reading large black & white scanned Google Books on E-Readers with >300MB RAM and >2GB flash.
Big 100+ page books scanned into PDF format usually slow these devices' built-in software to a halt.

To read DJVU files on the Kindle, I suggest koreader/koreader.

PDF is still better for vector/markup based "ebooks" so this plugin will not try to convert documents it detects having less than 1 raster image per page.

Expand All @@ -26,6 +27,8 @@ Installation
```calibre-debug -R djvumaker install_deps```
3. (Re)start Calibre and start converting your PDF books!

4. [Optional] go to Preferences -> Interface::Toolbars so you can place the DJVU menu where you see fit.

Under the Hood
---
There are a few implementations of DjVU tools in the wild, but the fastest and most robust free one is the DjVuLibre suite and its Ghostscript plugin "GsDjvu".
Expand Down
11 changes: 7 additions & 4 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ConvertToDJVUAction(InterfaceAction):
action_spec = (_('Convert to DJVU'), 'mimetypes/djvu.png', _('engage the djvumaker plugin on this book'), None)
# (label, icon_path, tooltip, keyboard shortcut)

action_type = 'current'
action_type = 'global'

#don't auto-add the button to any menus' top-level
dont_add_to = frozenset(['toolbar', 'toolbar-device', 'context-menu',
Expand All @@ -27,12 +27,15 @@ class ConvertToDJVUAction(InterfaceAction):
def genesis(self):
self.qaction.triggered.connect(self.convert_book)

def gui_layout_complete(self):
#append my top-level DJVU action to the built-in conversion menus
#https://github.com/kovidgoyal/calibre/blob/master/src/calibre/gui2/actions/convert.py
#def gui_layout_complete(self):
def initialization_complete(self):
# append my top-level DJVU action to the built-in conversion menus
# https://github.com/kovidgoyal/calibre/blob/master/src/calibre/gui2/actions/convert.py
# https://github.com/kovidgoyal/calibre/blob/master/src/calibre/gui2/__init__.py#L26
cb = self.gui.iactions['Convert Books']
cm = partial(cb.create_menu_action, cb.qaction.menu())
cm('convert-djvu-cvtm', _('Convert to DJVU'), icon=self.qaction.icon(), triggered=self.convert_book)
cb.qaction.setMenu(cb.qaction.menu())

def location_selected(self, loc):
# Currently values for loc are: ``library, main, card and cardb``.
Expand Down

0 comments on commit 876bbbc

Please sign in to comment.