mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Add entries to the welcome wizard for using the Kindle reader app on an Android device
This commit is contained in:
parent
7e03588bad
commit
b65b295dd9
@ -447,10 +447,10 @@ def plugin_for_catalog_format(fmt):
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def device_plugins(): # {{{
|
def device_plugins(include_disabled=False): # {{{
|
||||||
for plugin in _initialized_plugins:
|
for plugin in _initialized_plugins:
|
||||||
if isinstance(plugin, DevicePlugin):
|
if isinstance(plugin, DevicePlugin):
|
||||||
if not is_disabled(plugin):
|
if include_disabled or not is_disabled(plugin):
|
||||||
if platform in plugin.supported_platforms:
|
if platform in plugin.supported_platforms:
|
||||||
yield plugin
|
yield plugin
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -221,6 +221,20 @@ class ANDROID(USBMS):
|
|||||||
drives['main'] = letter_a
|
drives['main'] = letter_a
|
||||||
return drives
|
return drives
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def configure_for_kindle_app(cls):
|
||||||
|
proxy = cls._configProxy()
|
||||||
|
proxy['format_map'] = ['mobi', 'azw', 'azw1', 'azw4', 'pdf']
|
||||||
|
proxy['use_subdirs'] = False
|
||||||
|
proxy['extra_customization'] = ','.join(['kindle']+cls.EBOOK_DIR_MAIN)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def configure_for_generic_epub_app(cls):
|
||||||
|
proxy = cls._configProxy()
|
||||||
|
del proxy['format_map']
|
||||||
|
del proxy['use_subdirs']
|
||||||
|
del proxy['extra_customization']
|
||||||
|
|
||||||
class S60(USBMS):
|
class S60(USBMS):
|
||||||
|
|
||||||
name = 'S60 driver'
|
name = 'S60 driver'
|
||||||
|
@ -28,6 +28,7 @@ from calibre.gui2 import min_available_height, available_width
|
|||||||
from calibre.utils.config import dynamic, prefs
|
from calibre.utils.config import dynamic, prefs
|
||||||
from calibre.gui2 import NONE, choose_dir, error_dialog
|
from calibre.gui2 import NONE, choose_dir, error_dialog
|
||||||
from calibre.gui2.dialogs.progress import ProgressDialog
|
from calibre.gui2.dialogs.progress import ProgressDialog
|
||||||
|
from calibre.customize.ui import device_plugins
|
||||||
|
|
||||||
# Devices {{{
|
# Devices {{{
|
||||||
|
|
||||||
@ -251,15 +252,39 @@ class Android(Device):
|
|||||||
id = 'android'
|
id = 'android'
|
||||||
supports_color = True
|
supports_color = True
|
||||||
|
|
||||||
class AndroidTablet(Device):
|
@classmethod
|
||||||
|
def commit(cls):
|
||||||
|
super(Android, cls).commit()
|
||||||
|
for plugin in device_plugins(include_disabled=True):
|
||||||
|
if plugin.name == 'Android driver':
|
||||||
|
plugin.configure_for_generic_epub_app()
|
||||||
|
|
||||||
|
class AndroidTablet(Android):
|
||||||
|
|
||||||
name = 'Android tablet'
|
name = 'Android tablet'
|
||||||
output_format = 'EPUB'
|
|
||||||
manufacturer = 'Android'
|
|
||||||
id = 'android_tablet'
|
id = 'android_tablet'
|
||||||
supports_color = True
|
|
||||||
output_profile = 'tablet'
|
output_profile = 'tablet'
|
||||||
|
|
||||||
|
class AndroidPhoneWithKindle(Android):
|
||||||
|
|
||||||
|
name = 'Android phone with Kindle reader'
|
||||||
|
output_format = 'MOBI'
|
||||||
|
id = 'android_phone_with_kindle'
|
||||||
|
output_profile = 'kindle'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def commit(cls):
|
||||||
|
super(Android, cls).commit()
|
||||||
|
for plugin in device_plugins(include_disabled=True):
|
||||||
|
if plugin.name == 'Android driver':
|
||||||
|
plugin.configure_for_kindle_app()
|
||||||
|
|
||||||
|
class AndroidTabletWithKindle(AndroidPhoneWithKindle):
|
||||||
|
|
||||||
|
name = 'Android tablet with Kindle reader'
|
||||||
|
id = 'android_tablet_with_kindle'
|
||||||
|
output_profile = 'kindle_fire'
|
||||||
|
|
||||||
class HanlinV3(Device):
|
class HanlinV3(Device):
|
||||||
|
|
||||||
name = 'Hanlin V3'
|
name = 'Hanlin V3'
|
||||||
|
@ -351,6 +351,9 @@ class ConfigProxy(object):
|
|||||||
def __setitem__(self, key, val):
|
def __setitem__(self, key, val):
|
||||||
return self.set(key, val)
|
return self.set(key, val)
|
||||||
|
|
||||||
|
def __delitem__(self, key):
|
||||||
|
self.set(key, self.defaults[key])
|
||||||
|
|
||||||
def get(self, key):
|
def get(self, key):
|
||||||
if self.__opts is None:
|
if self.__opts is None:
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user