示例#1
0
 def search_internet(self, data):
     if self.last_data:
         if data.author is None:
             url = url_for_book_search(data.where, title=self.last_data['title'], author=self.last_data['authors'][0])
         else:
             url = url_for_author_search(data.where, author=data.author)
         open_url(url)
示例#2
0
文件: main.py 项目: 089git/calibre
 def link_clicked(self, url):
     path = os.path.abspath(unicode(url.toLocalFile()))
     frag = None
     if path in self.iterator.spine:
         self.update_page_number()  # Ensure page number is accurate as it is used for history
         self.history.add(self.pos.value())
         path = self.iterator.spine[self.iterator.spine.index(path)]
         if url.hasFragment():
             frag = unicode(url.fragment())
         if path != self.current_page:
             self.pending_anchor = frag
             self.load_path(path)
         else:
             oldpos = self.view.document.ypos
             if frag:
                 self.view.scroll_to(frag)
             else:
                 # Scroll to top
                 self.view.scroll_to(0)
             if self.view.document.ypos == oldpos:
                 # If we are coming from goto_next_section() call this will
                 # cause another goto next section call with the next toc
                 # entry, since this one did not cause any scrolling at all.
                 QTimer.singleShot(10, self.update_indexing_state)
     else:
         open_url(url)
示例#3
0
    def open(self, parent=None, detail_item=None, external=False):

        store_link = self.store_link % self.aff_id
        if detail_item:
            self.aff_id['asin'] = detail_item
            store_link = self.store_link_details % self.aff_id
        open_url(QUrl(store_link))
 def support_forum(self):
     '''
     Open iOSRA support thread at MobileRead
     http://www.mobileread.com/forums/showthread.php?t=241143
     '''
     support_thread = "http://www.mobileread.com/forums/showthread.php?t=241143"
     open_url(QUrl(support_thread))
示例#5
0
 def open(self, parent=None, detail_item=None, external=False):
     aff_id = {'tag': 'httpcharles07-21'}
     store_link = 'http://www.amazon.it/ebooks-kindle/b?_encoding=UTF8&node=827182031&tag=%(tag)s&ie=UTF8&linkCode=ur2&camp=3370&creative=23322' % aff_id
     if detail_item:
         aff_id['asin'] = detail_item
         store_link = 'http://www.amazon.it/gp/redirect.html?ie=UTF8&location=http://www.amazon.it/dp/%(asin)s&tag=%(tag)s&linkCode=ur2&camp=3370&creative=23322' % aff_id
     open_url(QUrl(store_link))
示例#6
0
    def accept(self):
        url = ('http://calibre-ebook.com/download_' +
            ('portable' if isportable else 'windows' if iswindows
                else 'osx' if isosx else 'linux'))
        open_url(QUrl(url))

        QDialog.accept(self)
示例#7
0
 def open(self, parent=None, detail_item=None, external=False):
     aff_id = {'tag': 'charhale09-21'}
     store_link = 'http://www.amazon.es/ebooks-kindle/b?_encoding=UTF8&node=827231031&tag=%(tag)s&ie=UTF8&linkCode=ur2&camp=3626&creative=24790' % aff_id
     if detail_item:
         aff_id['asin'] = detail_item
         store_link = 'http://www.amazon.es/gp/redirect.html?ie=UTF8&location=http://www.amazon.es/dp/%(asin)s&tag=%(tag)s&linkCode=ur2&camp=3626&creative=24790' % aff_id
     open_url(QUrl(store_link))
示例#8
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_id = {
            'lid': '41000000033185143',
            'pubid': '21000000000352219',
            'ganpub': 'k352219',
            'ganclk': 'GOOG_1335334761',
        }
        # Use Kovid's affiliate id 30% of the time.
        if random.randint(1, 10) in (1, 2, 3):
            aff_id = {
                'lid': '41000000031855266',
                'pubid': '21000000000352583',
                'ganpub': 'k352583',
                'ganclk': 'GOOG_1335335464',
            }
            
        url = 'http://gan.doubleclick.net/gan_click?lid=%(lid)s&pubid=%(pubid)s' % aff_id
        if detail_item:
            detail_item += '&ganpub=%(ganpub)s&ganclk=%(ganclk)s' % aff_id

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#9
0
 def show_help(self):
     '''
     Display strftime help file
     '''
     from calibre.gui2 import open_url
     path = os.path.join(self.parent.resources_path, 'help/timestamp_formats.html')
     open_url(QUrl.fromLocalFile(path))
 def link_clicked(self, url):
     '''
     Open clicked link in regular browser
     '''
     open_url(url)
     if url.toString() == self._finalize():
         self.td.a['href'] = self.oh
         self.html_wv.setHtml(self.styled_soup.renderContents())
示例#11
0
    def open(self, parent=None, detail_item=None, external=False):
        aff_id = {'tag': 'calcharles-21'}
        store_link = 'http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&location=http://www.amazon.co.uk/Kindle-eBooks/b?ie=UTF8&node=341689031&ref_=sa_menu_kbo2&tag=%(tag)s&linkCode=ur2&camp=1634&creative=19450' % aff_id

        if detail_item:
            aff_id['asin'] = detail_item
            store_link = 'http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&location=http://www.amazon.co.uk/dp/%(asin)s&tag=%(tag)s&linkCode=ur2&camp=1634&creative=6738' % aff_id
        open_url(QUrl(store_link))
示例#12
0
 def open(self, parent=None, detail_item=None, external=False):
     if detail_item:
         if external or self.config.get('open_external', False):
             open_url(QUrl(url_slash_cleaner(detail_item)))
         else:
             d = WebStoreDialog(self.gui, 'http://ebookstore.sony.com', parent, detail_item)
             d.setWindowTitle(self.name)
             d.set_tags(self.config.get('tags', ''))
             d.exec_()
示例#13
0
 def test_server(self):
     prefix = self.advanced_tab.get('url_prefix') or ''
     protocol = 'https' if self.advanced_tab.has_ssl else 'http'
     lo = self.advanced_tab.get('listen_on') or '0.0.0.0'
     lo = {'0.0.0.0': '127.0.0.1', '::':'::1'}.get(lo)
     url = '{protocol}://{interface}:{port}{prefix}'.format(
         protocol=protocol, interface=lo,
         port=self.main_tab.opt_port.value(), prefix=prefix)
     open_url(QUrl(url))
示例#14
0
 def open(self, parent=None, detail_item=None, external=False):
     url = detail_item or shop_url
     if external or self.config.get('open_external', False):
         open_url(QUrl(url_slash_cleaner(url)))
     else:
         d = WebStoreDialog(self.gui, shop_url, parent, url)
         d.setWindowTitle(self.name)
         d.set_tags(self.config.get('tags', ''))
         d.exec_()
示例#15
0
 def open(self, parent=None, detail_item=None, external=False):
     url = 'http://www.baenebooks.com/'
     if external or self.config.get('open_external', False):
         open_url(QUrl(detail_item or url))
     else:
         d = WebStoreDialog(self.gui, url, parent, detail_item or url)
         d.setWindowTitle(self.name)
         d.set_tags(self.config.get('tags', ''))
         d.exec_()
示例#16
0
 def open(self, parent=None, detail_item=None, external=False):
     url = 'https://books.google.com/books'
     if external or self.config.get('open_external', False):
         open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
     else:
         d = WebStoreDialog(self.gui, url, parent, detail_item)
         d.setWindowTitle(self.name)
         d.set_tags(self.config.get('tags', ''))
         d.exec_()
示例#17
0
文件: main.py 项目: Solertis/calibre
 def lookup(self, word):
     from urllib import quote
     word = quote(word.encode('utf-8'))
     try:
         url = lookup_website(canonicalize_lang(self.view.current_language) or 'en').format(word=word)
     except Exception:
         traceback.print_exc()
         url = default_lookup_website(canonicalize_lang(self.view.current_language) or 'en').format(word=word)
     open_url(url)
示例#18
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://www.bewrite.net/mm5/merchant.mvc?Screen=SFNT'

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#19
0
 def help_link_activated(self, url):
     def get_help_file_resource():
         # Copy the HTML helpfile to the plugin directory each time the
         # link is clicked in case the helpfile is updated in newer plugins.
         file_path = os.path.join(config_dir, u"plugins", u"DeDRM", u"help", help_file_name)
         with open(file_path,'w') as f:
             f.write(self.load_resource(help_file_name))
         return file_path
     url = 'file:///' + get_help_file_resource()
     open_url(QUrl(url))
示例#20
0
    def open(self, parent=None, detail_item=None, external=False):
        print("open")
        url = 'http://www.haodoo.net'

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#21
0
    def open(self, parent=None, detail_item=None, external=False):
        google_analytics = "?utm_source=tdcalibre&utm_medium=calibre"
        url = "http://www.publio.pl/e-booki.html" + google_analytics

        if external or self.config.get("open_external", False):
            open_url(QUrl(url_slash_cleaner((detail_item + google_analytics) if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get("tags", ""))
            d.exec_()
示例#22
0
 def open(self, parent=None, detail_item=None, external=False):
     aff_id = {'tag': 'charhale0a-21'}
     store_link = ('http://www.amazon.de/gp/redirect.html?ie=UTF8&site-redirect=de'
                  '&tag=%(tag)s&linkCode=ur2&camp=1638&creative=19454'
                  '&location=http://www.amazon.de/ebooks-kindle/b?node=530886031') % aff_id
     if detail_item:
         aff_id['asin'] = detail_item
         store_link = ('http://www.amazon.de/gp/redirect.html?ie=UTF8'
                       '&location=http://www.amazon.de/dp/%(asin)s&site-redirect=de'
                       '&tag=%(tag)s&linkCode=ur2&camp=1638&creative=6742') % aff_id
     open_url(QUrl(store_link))
示例#23
0
    def open(self, parent=None, detail_item=None, external=False):
        google_analytics = '?utm_source=tdcalibre&utm_medium=calibre'
        url = 'http://www.publio.pl/' + google_analytics

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner((detail_item + google_analytics) if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item if detail_item else url)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#24
0
    def open(self, parent=None, detail_item=None, external=False):
        if not hasattr(self, 'web_url'):
            return

        if external or self.config.get('open_external', False):
            open_url(QUrl(detail_item if detail_item else self.web_url))
        else:
            d = WebStoreDialog(self.gui, self.web_url, parent, detail_item, create_browser=self.create_browser)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#25
0
文件: main.py 项目: kba/calibre
 def lookup(self, word):
     from calibre.utils.localization import canonicalize_lang, lang_as_iso639_1
     from urllib import quote
     lang = lang_as_iso639_1(self.view.current_language)
     if not lang:
         lang = canonicalize_lang(lang) or 'en'
     word = quote(word.encode('utf-8'))
     if lang == 'en':
         prefix = 'https://www.wordnik.com/words/'
     else:
         prefix = 'http://%s.wiktionary.org/wiki/' % lang
     open_url(prefix + word)
示例#26
0
    def help_link_activated(self, url):
        def get_help_file_resource():
            # Copy the HTML helpfile to the plugin directory each time the
            # link is clicked in case the helpfile is updated in newer plugins.
            help_file_name = u"{0}_{1}_Help.htm".format(PLUGIN_NAME, self.key_type_name)
            file_path = os.path.join(config_dir, u"plugins", u"DeDRM", u"help", help_file_name)
            with open(file_path, "w") as f:
                f.write(self.parent.load_resource(help_file_name))
            return file_path

        url = "file:///" + get_help_file_resource()
        open_url(QUrl(url))
示例#27
0
    def open(self, parent=None, detail_item=None, external=False):
        pid = '12'
        url = 'http://virtualo.pl/ebook/c2/?pr=' + pid
        detail_url = detail_item + '&pr=' + pid if detail_item else url

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#28
0
    def open(self, parent=None, detail_item=None, external=False):
        pid = '44010'

        url = 'http://www.escapemagazine.pl/s/' + pid

        if external or self.config.get('open_external', False):
            open_url(QUrl(url_slash_cleaner(detail_item + '/s/' + pid if detail_item else url)))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#29
0
 def open(self, parent=None, detail_item=None, external=False):
     #aff_id = {'tag': ''}
     # Use Kovid's affiliate id 30% of the time.
     #if random.randint(1, 10) in (1, 2, 3):
     #    aff_id['tag'] = 'calibrebs-20'
     # store_link = 'http://www.amazon.ca/Kindle-eBooks/b/?ie=UTF&node=1286228011&ref_=%(tag)s&ref=%(tag)s&tag=%(tag)s&linkCode=ur2&camp=1789&creative=390957' % aff_id
     store_link = 'http://www.amazon.ca/ebooks-kindle/b/ref=sa_menu_kbo?ie=UTF8&node=2980423011'
     if detail_item:
         # aff_id['asin'] = detail_item
         # store_link = 'http://www.amazon.ca/dp/%(asin)s/?tag=%(tag)s' % aff_id
         store_link = 'http://www.amazon.ca/dp/' + detail_item + '/'
     open_url(QUrl(store_link))
示例#30
0
    def open(self, parent=None, detail_item=None, external=False):
        url = 'http://gutenberg.org/'

        if detail_item:
            detail_item = url_slash_cleaner(url + detail_item)

        if external or self.config.get('open_external', False):
            open_url(QUrl(detail_item if detail_item else url))
        else:
            d = WebStoreDialog(self.gui, url, parent, detail_item)
            d.setWindowTitle(self.name)
            d.set_tags(self.config.get('tags', ''))
            d.exec_()
示例#31
0
文件: ui.py 项目: oheil/calibre
 def donate(self, *args):
     open_url(QUrl('http://calibre-ebook.com/donate'))
示例#32
0
 def link_activated(self, link):
     self._link_clicked = True
     if unicode(link.scheme()) in ('http', 'https'):
         return open_url(link)
     link = unicode(link.toString())
     self.link_clicked.emit(link)
示例#33
0
def open_donate():
    open_url(QUrl(localize_website_link('https://calibre-ebook.com/donate')))
示例#34
0
文件: init.py 项目: rlanger/calibre
 def mouseReleaseEvent(self, ev):
     open_url(localize_website_link('https://calibre-ebook.com/whats-new'))
     ev.accept()
     return QLabel.mouseReleaseEvent(self, ev)
示例#35
0
    def create_actions(self):
        group = _('Global Actions')

        def reg(icon, text, target, sid, keys, description, toolbar_allowed=False):
            if not isinstance(icon, QIcon):
                icon = QIcon(I(icon))
            ac = actions[sid] = QAction(icon, text, self) if icon else QAction(text, self)
            ac.setObjectName('action-' + sid)
            if toolbar_allowed:
                toolbar_actions[sid] = ac
            if target is not None:
                ac.triggered.connect(target)
            if isinstance(keys, type('')):
                keys = (keys,)
            self.keyboard.register_shortcut(
                sid, unicode(ac.text()).replace('&', ''), default_keys=keys, description=description, action=ac, group=group)
            self.addAction(ac)
            return ac

        def treg(icon, text, target, sid, keys, description):
            return reg(icon, text, target, sid, keys, description, toolbar_allowed=icon is not None)

        self.action_new_file = treg('document-new.png', _('&New file (images/fonts/HTML/etc.)'), self.boss.add_file,
                                   'new-file', (), _('Create a new file in the current book'))
        self.action_import_files = treg('document-import.png', _('&Import files into book'), self.boss.add_files, 'new-files', (), _('Import files into book'))
        self.action_open_book = treg('document_open.png', _('Open &book'), self.boss.open_book, 'open-book', 'Ctrl+O', _('Open a new book'))
        self.action_open_book_folder = treg('mimetypes/dir.png', _('Open &folder (unzipped EPUB) as book'), partial(self.boss.open_book, open_folder=True),
                                            'open-folder-as-book', (), _('Open a folder (unzipped EPUB) as a book'))
        # Qt does not generate shortcut overrides for cmd+arrow on os x which
        # means these shortcuts interfere with editing
        self.action_global_undo = treg('back.png', _('&Revert to before'), self.boss.do_global_undo, 'global-undo', () if isosx else 'Ctrl+Left',
                                      _('Revert book to before the last action (Undo)'))
        self.action_global_redo = treg('forward.png', _('&Revert to after'), self.boss.do_global_redo, 'global-redo', () if isosx else 'Ctrl+Right',
                                      _('Revert book state to after the next action (Redo)'))
        self.action_save = treg('save.png', _('&Save'), self.boss.save_book, 'save-book', 'Ctrl+S', _('Save book'))
        self.action_save.setEnabled(False)
        self.action_save_copy = treg('save.png', _('Save a &copy'), self.boss.save_copy, 'save-copy', 'Ctrl+Alt+S', _('Save a copy of the book'))
        self.action_quit = treg('window-close.png', _('&Quit'), self.boss.quit, 'quit', 'Ctrl+Q', _('Quit'))
        self.action_preferences = treg('config.png', _('&Preferences'), self.boss.preferences, 'preferences', 'Ctrl+P', _('Preferences'))
        self.action_new_book = treg('plus.png', _('Create &new, empty book'), self.boss.new_book, 'new-book', (), _('Create a new, empty book'))
        self.action_import_book = treg('add_book.png', _('&Import an HTML or DOCX file as a new book'),
                                      self.boss.import_book, 'import-book', (), _('Import an HTML or DOCX file as a new book'))
        self.action_quick_edit = treg('modified.png', _('&Quick open a file to edit'), self.boss.quick_open, 'quick-open', ('Ctrl+T'), _(
            'Quickly open a file from the book to edit it'))

        # Editor actions
        group = _('Editor actions')
        self.action_editor_undo = reg('edit-undo.png', _('&Undo'), self.boss.do_editor_undo, 'editor-undo', 'Ctrl+Z',
                                      _('Undo typing'))
        self.action_editor_redo = reg('edit-redo.png', _('&Redo'), self.boss.do_editor_redo, 'editor-redo', 'Ctrl+Y',
                                      _('Redo typing'))
        self.action_editor_cut = reg('edit-cut.png', _('C&ut text'), self.boss.do_editor_cut, 'editor-cut', ('Ctrl+X', 'Shift+Delete', ),
                                      _('Cut text'))
        self.action_editor_copy = reg('edit-copy.png', _('&Copy to clipboard'), self.boss.do_editor_copy, 'editor-copy', ('Ctrl+C', 'Ctrl+Insert'),
                                      _('Copy to clipboard'))
        self.action_editor_paste = reg('edit-paste.png', _('&Paste from clipboard'), self.boss.do_editor_paste, 'editor-paste', ('Ctrl+V', 'Shift+Insert', ),
                                      _('Paste from clipboard'))
        self.action_editor_cut.setEnabled(False)
        self.action_editor_copy.setEnabled(False)
        self.action_editor_undo.setEnabled(False)
        self.action_editor_redo.setEnabled(False)

        # Tool actions
        group = _('Tools')
        self.action_toc = treg('toc.png', _('&Edit Table of Contents'), self.boss.edit_toc, 'edit-toc', (), _('Edit Table of Contents'))
        self.action_inline_toc = treg('chapters.png', _('&Insert inline Table of Contents'),
                                     self.boss.insert_inline_toc, 'insert-inline-toc', (), _('Insert inline Table of Contents'))
        self.action_fix_html_current = reg('html-fix.png', _('&Fix HTML'), partial(self.boss.fix_html, True), 'fix-html-current', (),
                                           _('Fix HTML in the current file'))
        self.action_fix_html_all = treg('html-fix.png', _('&Fix HTML - all files'), partial(self.boss.fix_html, False), 'fix-html-all', (),
                                       _('Fix HTML in all files'))
        self.action_pretty_current = reg('beautify.png', _('&Beautify current file'), partial(self.boss.pretty_print, True), 'pretty-current', (),
                                           _('Beautify current file'))
        self.action_pretty_all = treg('beautify.png', _('&Beautify all files'), partial(self.boss.pretty_print, False), 'pretty-all', (),
                                       _('Beautify all files'))
        self.action_insert_char = treg('character-set.png', _('&Insert special character'), self.boss.insert_character, 'insert-character', (),
                                      _('Insert special character'))
        self.action_rationalize_folders = treg('mimetypes/dir.png', _('&Arrange into folders'), self.boss.rationalize_folders, 'rationalize-folders', (),
                                      _('Arrange into folders'))
        self.action_set_semantics = treg('tags.png', _('Set &Semantics'), self.boss.set_semantics, 'set-semantics', (),
                                        _('Set Semantics'))
        self.action_filter_css = treg('filter.png', _('&Filter style information'), self.boss.filter_css, 'filter-css', (),
                                     _('Filter style information'))
        self.action_manage_fonts = treg('font.png', _('Manage &fonts'), self.boss.manage_fonts, 'manage-fonts', (), _('Manage fonts in the book'))
        self.action_add_cover = treg('default_cover.png', _('Add &cover'), self.boss.add_cover, 'add-cover', (), _('Add a cover to the book'))
        self.action_reports = treg(
            'reports.png', _('&Reports'), self.boss.show_reports, 'show-reports', ('Ctrl+Shift+R',), _('Show a report on various aspects of the book'))
        self.action_check_external_links = treg('insert-link.png', _('Check &external links'), self.boss.check_external_links, 'check-external-links', (), _(
            'Check external links in the book'))
        self.action_compress_images = treg('compress-image.png', _('Compress &images losslessly'), self.boss.compress_images, 'compress-images', (), _(
            'Compress images losslessly'))
        self.action_transform_styles = treg('wizard.png', _('Transform &styles'), self.boss.transform_styles, 'transform-styles', (), _(
            'Transform styles used in the book'))
        self.action_get_ext_resources = treg('download-metadata.png', _('Download external &resources'),
                                             self.boss.get_external_resources, 'get-external-resources', (), _(
            'Download external resources in the book (images/stylesheets/etc/ that are not included in the book)'))

        def ereg(icon, text, target, sid, keys, description):
            return reg(icon, text, partial(self.boss.editor_action, target), sid, keys, description)
        register_text_editor_actions(ereg, self.palette())

        # Polish actions
        group = _('Polish Book')
        self.action_subset_fonts = treg(
            'subset-fonts.png', _('&Subset embedded fonts'), partial(
                self.boss.polish, 'subset', _('Subset fonts')), 'subset-fonts', (), _('Subset embedded fonts'))
        self.action_embed_fonts = treg(
            'embed-fonts.png', _('&Embed referenced fonts'), partial(
                self.boss.polish, 'embed', _('Embed fonts')), 'embed-fonts', (), _('Embed referenced fonts'))
        self.action_smarten_punctuation = treg(
            'smarten-punctuation.png', _('&Smarten punctuation'), partial(
                self.boss.polish, 'smarten_punctuation', _('Smarten punctuation')), 'smarten-punctuation', (), _('Smarten punctuation'))
        self.action_remove_unused_css = treg(
            'edit-clear.png', _('Remove &unused CSS rules'), partial(
                self.boss.polish, 'remove_unused_css', _('Remove unused CSS rules')), 'remove-unused-css', (), _('Remove unused CSS rules'))

        # Preview actions
        group = _('Preview')
        self.action_auto_reload_preview = reg('auto-reload.png', _('Auto reload preview'), None, 'auto-reload-preview', (), _('Auto reload preview'))
        self.action_auto_sync_preview = reg('sync-right.png', _('Sync preview position to editor position'), None, 'sync-preview-to-editor', (), _(
            'Sync preview position to editor position'))
        self.action_reload_preview = reg('view-refresh.png', _('Refresh preview'), None, 'reload-preview', ('F5',), _('Refresh preview'))
        self.action_split_in_preview = reg('auto_author_sort.png', _('Split this file'), None, 'split-in-preview', (), _(
            'Split file in the preview panel'))
        self.action_find_next_preview = reg('arrow-down.png', _('Find Next'), None, 'find-next-preview', (), _('Find next in preview'))
        self.action_find_prev_preview = reg('arrow-up.png', _('Find Previous'), None, 'find-prev-preview', (), _('Find previous in preview'))

        # Search actions
        group = _('Search')
        self.action_find = treg('search.png', _('&Find/Replace'), self.boss.show_find, 'find-replace', ('Ctrl+F',), _('Show the Find/Replace panel'))

        def sreg(name, text, action, overrides={}, keys=(), description=None, icon=None):
            return reg(icon, text, partial(self.boss.search_action_triggered, action, overrides), name, keys, description or text.replace('&', ''))
        self.action_find_next = sreg('find-next', _('Find &Next'),
                                     'find', {'direction':'down'}, ('F3', 'Ctrl+G'), _('Find next match'))
        self.action_find_previous = sreg('find-previous', _('Find &Previous'),
                                         'find', {'direction':'up'}, ('Shift+F3', 'Shift+Ctrl+G'), _('Find previous match'))
        self.action_replace = sreg('replace', _('Replace'),
                                   'replace', keys=('Ctrl+R'), description=_('Replace current match'))
        self.action_replace_next = sreg('replace-next', _('&Replace and find next'),
                                        'replace-find', {'direction':'down'}, ('Ctrl+]'), _('Replace current match and find next'))
        self.action_replace_previous = sreg('replace-previous', _('R&eplace and find previous'),
                                        'replace-find', {'direction':'up'}, ('Ctrl+['), _('Replace current match and find previous'))
        self.action_replace_all = sreg('replace-all', _('Replace &all'),
                                   'replace-all', keys=('Ctrl+A'), description=_('Replace all matches'))
        self.action_count = sreg('count-matches', _('&Count all'),
                                   'count', keys=('Ctrl+N'), description=_('Count number of matches'))
        self.action_mark = reg(None, _('&Mark selected text'), self.boss.mark_selected_text, 'mark-selected-text', ('Ctrl+Shift+M',),
                               _('Mark selected text or unmark already marked text'))
        self.action_mark.default_text = self.action_mark.text()
        self.action_go_to_line = reg(None, _('Go to &line'), self.boss.go_to_line_number, 'go-to-line-number', ('Ctrl+.',), _('Go to line number'))
        self.action_saved_searches = treg('folder_saved_search.png', _('Sa&ved searches'),
                                          self.boss.saved_searches, 'saved-searches', (), _('Show the saved searches dialog'))
        self.action_text_search = treg('view.png', _('Search ignoring HTML markup'),
                                          self.boss.show_text_search, 'text-search', (), _('Show the text search panel'))

        # Check Book actions
        group = _('Check Book')
        self.action_check_book = treg('debug.png', _('&Check Book'), self.boss.check_requested, 'check-book', ('F7'), _('Check book for errors'))
        self.action_spell_check_book = treg('spell-check.png', _('Check &spelling'), self.boss.spell_check_requested, 'spell-check-book', ('Alt+F7'), _(
            'Check book for spelling errors'))
        self.action_check_book_next = reg('forward.png', _('&Next error'), partial(
            self.check_book.next_error, delta=1), 'check-book-next', ('Ctrl+F7'), _('Show next error'))
        self.action_check_book_previous = reg('back.png', _('&Previous error'), partial(
            self.check_book.next_error, delta=-1), 'check-book-previous', ('Ctrl+Shift+F7'), _('Show previous error'))
        self.action_spell_check_next = reg('forward.png', _('&Next spelling mistake'),
            self.boss.next_spell_error, 'spell-next', ('F8'), _('Go to next spelling mistake'))

        # Miscellaneous actions
        group = _('Miscellaneous')
        self.action_create_checkpoint = treg(
            'marked.png', _('&Create checkpoint'), self.boss.create_checkpoint, 'create-checkpoint', (), _(
                'Create a checkpoint with the current state of the book'))
        self.action_close_current_tab = reg(
            'window-close.png', _('&Close current tab'), self.central.close_current_editor, 'close-current-tab', 'Ctrl+W', _(
                'Close the currently open tab'))
        self.action_close_all_but_current_tab = reg(
            'edit-clear.png', _('&Close other tabs'), self.central.close_all_but_current_editor, 'close-all-but-current-tab', 'Ctrl+Alt+W', _(
                'Close all tabs except the current tab'))
        self.action_help = treg(
            'help.png', _('User &Manual'), lambda : open_url(QUrl(localize_user_manual_link(
                'https://manual.calibre-ebook.com/edit.html'))), 'user-manual', 'F1', _(
                'Show User Manual'))
        self.action_browse_images = treg(
            'view-image.png', _('&Browse images in book'), self.boss.browse_images, 'browse-images', (), _(
                'Browse images in the books visually'))
        self.action_multiple_split = treg(
            'auto_author_sort.png', _('&Split at multiple locations'), self.boss.multisplit, 'multisplit', (), _(
                'Split HTML file at multiple locations'))
        self.action_compare_book = treg('diff.png', _('&Compare to another book'), self.boss.compare_book, 'compare-book', (), _(
            'Compare to another book'))
        self.action_manage_snippets = treg(
            'snippets.png', _('Manage &Snippets'), self.boss.manage_snippets, 'manage-snippets', (), _(
                'Manage user created snippets'))

        self.plugin_menu_actions = []

        create_plugin_actions(actions, toolbar_actions, self.plugin_menu_actions)
示例#36
0
 def _forum_label_activated(self):
     if self.forum_link:
         open_url(QUrl(self.forum_link))
示例#37
0
 def open(self, parent=None, detail_item=None, external=False):
     store_link = (DETAILS_URL + detail_item) if detail_item else STORE_LINK
     open_url(QUrl(store_link))
示例#38
0
 def show_help(self, *args):
     open_url(
         QUrl(localize_user_manual_link('http://manual.calibre-ebook.com')))
示例#39
0
 def mouseReleaseEvent(self, ev):
     open_url('https://calibre-ebook.com/whats-new')
     ev.accept()
     return QLabel.mouseReleaseEvent(self, ev)
示例#40
0
def open_donate():
    open_url(QUrl('https://calibre-ebook.com/donate'))
示例#41
0
 def link_activated(self, url):
     from calibre.gui2 import open_url
     if url.scheme() in {'http', 'https'}:
         open_url(url)
示例#42
0
 def _donate_clicked(self):
     plugin = self._selected_display_plugin()
     if plugin and plugin.donation_link:
         open_url(QUrl(plugin.donation_link))