Beispiel #1
0
def basic_interface_data(ctx, rd):
    ans = {
        'username':
        rd.username,
        'output_format':
        prefs['output_format'].upper(),
        'input_formats': {x.upper(): True
                          for x in available_input_formats()},
        'gui_pubdate_display_format':
        tweaks['gui_pubdate_display_format'],
        'gui_timestamp_display_format':
        tweaks['gui_timestamp_display_format'],
        'gui_last_modified_display_format':
        tweaks['gui_last_modified_display_format'],
        'completion_mode':
        tweaks['completion_mode'],
        'use_roman_numerals_for_series_number':
        get_use_roman(),
        'translations':
        get_translations(),
        'icon_map':
        icon_map(),
        'icon_path':
        ctx.url_for('/icon', which=''),
        'custom_list_template':
        getattr(ctx, 'custom_list_template', None) or custom_list_template(),
        'search_the_net_urls':
        getattr(ctx, 'search_the_net_urls', None) or [],
        'num_per_page':
        rd.opts.num_per_page,
        'donate_link':
        localize_website_link('https://calibre-ebook.com/donate')
    }
    ans['library_map'], ans['default_library_id'] = ctx.library_info(rd)
    return ans
Beispiel #2
0
 def __init__(self, parent=None, title=None):
     QDialog.__init__(self, parent)
     self.setupUi(self)
     msg = _('<p>This book is locked by <b>DRM</b>. To learn more about DRM'
             ' and why you cannot read or convert this book in calibre,'
             ' <a href="{0}">click here</a>.'
             ' </p>').format(
                 localize_website_link(
                     'https://manual.calibre-ebook.com/drm.html'))
     if title is not None:
         msg = '<h2>%s</h2>%s' % (title, msg)
     self.msg.setText(msg)
     self.resize(self.sizeHint())
Beispiel #3
0
 def get_open_popup_message(cls):
     from calibre.utils.localization import localize_website_link
     return OpenPopupMessage(
         title=_('WARNING: E-book covers'),
         message=
         _('Amazon has <b>broken display of covers</b> for books sent to the Kindle by USB cable. To workaround it,'
           ' you have to either keep your Kindle in Airplane mode, or:'
           '<ol><li>Send the books to the Kindle</li><li>Disconnect the Kindle and wait for the covers to be deleted'
           ' by Amazon</li><li>Reconnect the Kindle and calibre will restore the covers.</li></ol> After this the'
           ' covers for those books should stay put. <a href="{}">Click here</a> for details.'
           ).
         format(
             localize_website_link(
                 'https://manual.calibre-ebook.com/faq.html#covers-for-books-i'
                 '-send-to-my-e-ink-kindle-show-up-momentarily-and-then-are-replaced-by-a-generic-cover'
             )))
Beispiel #4
0
 def __init__(self, calibre_version, plugin_updates, parent=None):
     QDialog.__init__(self, parent)
     self.setAttribute(Qt.WidgetAttribute.WA_QuitOnClose, False)
     self.resize(400, 250)
     self.l = QGridLayout()
     self.setLayout(self.l)
     self.logo = QLabel()
     self.logo.setMaximumWidth(110)
     self.logo.setPixmap(QIcon(I('lt.png')).pixmap(100, 100))
     ver = calibre_version
     if ver.endswith('.0'):
         ver = ver[:-2]
     self.label = QLabel(
         '<p>' +
         _('New version <b>{ver}</b> of {app} is available for download. '
           'See the <a href="{url}">new features</a>.').format(
               url=localize_website_link(
                   'https://calibre-ebook.com/whats-new'),
               app=__appname__,
               ver=ver))
     self.label.setOpenExternalLinks(True)
     self.label.setWordWrap(True)
     self.setWindowTitle(_('Update available!'))
     self.setWindowIcon(QIcon(I('lt.png')))
     self.l.addWidget(self.logo, 0, 0)
     self.l.addWidget(self.label, 0, 1)
     self.cb = QCheckBox(_('Show this notification for future updates'),
                         self)
     self.l.addWidget(self.cb, 1, 0, 1, -1)
     self.cb.setChecked(config.get('new_version_notification'))
     self.cb.stateChanged.connect(self.show_future)
     self.bb = QDialogButtonBox(self)
     b = self.bb.addButton(_('&Get update'),
                           QDialogButtonBox.ButtonRole.AcceptRole)
     b.setDefault(True)
     b.setIcon(QIcon(I('arrow-down.png')))
     if plugin_updates > 0:
         b = self.bb.addButton(_('Update &plugins'),
                               QDialogButtonBox.ButtonRole.ActionRole)
         b.setIcon(QIcon(I('plugins/plugin_updater.png')))
         b.clicked.connect(self.get_plugins,
                           type=Qt.ConnectionType.QueuedConnection)
     self.bb.addButton(QDialogButtonBox.StandardButton.Cancel)
     self.l.addWidget(self.bb, 2, 0, 1, -1)
     self.bb.accepted.connect(self.accept)
     self.bb.rejected.connect(self.reject)
     save_version_notified(calibre_version)
Beispiel #5
0
 def __init__(self, calibre_version, plugin_updates, parent=None):
     QDialog.__init__(self, parent)
     self.setAttribute(Qt.WA_QuitOnClose, False)
     self.resize(400, 250)
     self.l = QGridLayout()
     self.setLayout(self.l)
     self.logo = QLabel()
     self.logo.setMaximumWidth(110)
     self.logo.setPixmap(QIcon(I('lt.png')).pixmap(100, 100))
     ver = calibre_version
     if ver.endswith('.0'):
         ver = ver[:-2]
     self.label = QLabel(('<p>'+ _(
         'New version <b>{ver}</b> of {app} is available for download. '
         'See the <a href="{url}">new features</a>.').format(
             url=localize_website_link('https://calibre-ebook.com/whats-new'),
             app=__appname__, ver=ver)))
     self.label.setOpenExternalLinks(True)
     self.label.setWordWrap(True)
     self.setWindowTitle(_('Update available!'))
     self.setWindowIcon(QIcon(I('lt.png')))
     self.l.addWidget(self.logo, 0, 0)
     self.l.addWidget(self.label, 0, 1)
     self.cb = QCheckBox(
         _('Show this notification for future updates'), self)
     self.l.addWidget(self.cb, 1, 0, 1, -1)
     self.cb.setChecked(config.get('new_version_notification'))
     self.cb.stateChanged.connect(self.show_future)
     self.bb = QDialogButtonBox(self)
     b = self.bb.addButton(_('&Get update'), self.bb.AcceptRole)
     b.setDefault(True)
     b.setIcon(QIcon(I('arrow-down.png')))
     if plugin_updates > 0:
         b = self.bb.addButton(_('Update &plugins'), self.bb.ActionRole)
         b.setIcon(QIcon(I('plugins/plugin_updater.png')))
         b.clicked.connect(self.get_plugins, type=Qt.QueuedConnection)
     self.bb.addButton(self.bb.Cancel)
     self.l.addWidget(self.bb, 2, 0, 1, -1)
     self.bb.accepted.connect(self.accept)
     self.bb.rejected.connect(self.reject)
     dynamic.set(version_key(calibre_version), False)
Beispiel #6
0
def basic_interface_data(ctx, rd):
    ans = {
        'username': rd.username,
        'output_format': prefs['output_format'].upper(),
        'input_formats': {x.upper(): True
                          for x in available_input_formats()},
        'gui_pubdate_display_format': tweaks['gui_pubdate_display_format'],
        'gui_timestamp_display_format': tweaks['gui_timestamp_display_format'],
        'gui_last_modified_display_format': tweaks['gui_last_modified_display_format'],
        'completion_mode': tweaks['completion_mode'],
        'use_roman_numerals_for_series_number': get_use_roman(),
        'translations': get_translations(),
        'icon_map': icon_map(),
        'icon_path': ctx.url_for('/icon', which=''),
        'custom_list_template': getattr(ctx, 'custom_list_template', None) or custom_list_template(),
        'search_the_net_urls': getattr(ctx, 'search_the_net_urls', None) or [],
        'num_per_page': rd.opts.num_per_page,
        'default_book_list_mode': rd.opts.book_list_mode,
        'donate_link': localize_website_link('https://calibre-ebook.com/donate')
    }
    ans['library_map'], ans['default_library_id'] = ctx.library_info(rd)
    return ans
Beispiel #7
0
 def mouseReleaseEvent(self, ev):
     open_url(localize_website_link('https://calibre-ebook.com/whats-new'))
     ev.accept()
     return QLabel.mouseReleaseEvent(self, ev)
Beispiel #8
0
def open_donate():
    open_url(QUrl(localize_website_link('https://calibre-ebook.com/donate')))
Beispiel #9
0
def get_download_url():
    which = ('portable' if isportable else
             'windows' if iswindows else 'osx' if isosx else 'linux')
    if which == 'windows' and is64bit:
        which += '64'
    return localize_website_link('https://calibre-ebook.com/download_' + which)
Beispiel #10
0
def get_download_url():
    which = ('portable' if isportable else 'windows' if iswindows
            else 'osx' if isosx else 'linux')
    if which == 'windows' and is64bit:
        which += '64'
    return localize_website_link('https://calibre-ebook.com/download_' + which)
Beispiel #11
0
 def donate(self, *args):
     from calibre.utils.localization import localize_website_link
     open_url(QUrl(localize_website_link('https://calibre-ebook.com/donate')))
Beispiel #12
0
def sort_languages(x):
    from calibre.utils.icu import sort_key
    lc, name = x
    if lc == language:
        return ''
    return sort_key(type(u'')(name))


website = 'https://calibre-ebook.com'
html_context['other_languages'].sort(key=sort_languages)
html_context['support_text'] = _('Support calibre')
html_context['support_tooltip'] = _('Contribute to support calibre development')
html_context['homepage_url'] = website
if needs_localization:
    html_context['homepage_url'] = localize_website_link(html_context['homepage_url'])
extlinks = {
    'website_base': (website, None),
    'website': (html_context['homepage_url'] + '/%s', None),
    'download_file': (f'{website}/downloads/%s', '%s'),
}
del sort_languages, get_language

epub_author      = u'Kovid Goyal'
epub_publisher   = u'Kovid Goyal'
epub_copyright   = u'© {} Kovid Goyal'.format(date.today().year)
epub_description = u'Comprehensive documentation for calibre'
epub_identifier  = u'https://manual.calibre-ebook.com'
epub_scheme      = u'url'
epub_uid         = u'S54a88f8e9d42455e9c6db000e989225f'
epub_tocdepth    = 4
Beispiel #13
0
def open_donate():
    open_url(QUrl(localize_website_link('https://calibre-ebook.com/donate')))
Beispiel #14
0
 def donate(self, *args):
     from calibre.utils.localization import localize_website_link
     open_url(QUrl(localize_website_link('https://calibre-ebook.com/donate')))
Beispiel #15
0
 def mouseReleaseEvent(self, ev):
     open_url(localize_website_link('https://calibre-ebook.com/whats-new'))
     ev.accept()
     return QLabel.mouseReleaseEvent(self, ev)