當前位置: 首頁>>代碼示例>>Python>>正文


Python DownloadDialog.start_download方法代碼示例

本文整理匯總了Python中calibre.gui2.dnd.DownloadDialog.start_download方法的典型用法代碼示例。如果您正苦於以下問題:Python DownloadDialog.start_download方法的具體用法?Python DownloadDialog.start_download怎麽用?Python DownloadDialog.start_download使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在calibre.gui2.dnd.DownloadDialog的用法示例。


在下文中一共展示了DownloadDialog.start_download方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: remote_file_dropped_on_book

# 需要導入模塊: from calibre.gui2.dnd import DownloadDialog [as 別名]
# 或者: from calibre.gui2.dnd.DownloadDialog import start_download [as 別名]
 def remote_file_dropped_on_book(self, url, fname):
     if self.gui.current_view() is not self.gui.library_view:
         return
     db = self.gui.library_view.model().db
     current_idx = self.gui.library_view.currentIndex()
     if not current_idx.isValid(): return
     cid = db.id(current_idx.row())
     from calibre.gui2.dnd import DownloadDialog
     d = DownloadDialog(url, fname, self.gui)
     d.start_download()
     if d.err is None:
         self.files_dropped_on_book(None, [d.fpath], cid=cid)
開發者ID:yeyanchao,項目名稱:calibre,代碼行數:14,代碼來源:add.py

示例2: dropEvent

# 需要導入模塊: from calibre.gui2.dnd import DownloadDialog [as 別名]
# 或者: from calibre.gui2.dnd.DownloadDialog import start_download [as 別名]
    def dropEvent(self, event):
        event.setDropAction(Qt.CopyAction)
        md = event.mimeData()
        # Now look for ebook files
        urls, filenames = dnd_get_files(md, self.DROPABBLE_EXTENSIONS)
        if not urls:
            # Nothing found
            return

        if not filenames:
            # Local files
            self.formats_dropped.emit(event, urls)
        else:
            # Remote files, use the first file
            d = DownloadDialog(urls[0], filenames[0], self)
            d.start_download()
            if d.err is None:
                self.formats_dropped.emit(event, [d.fpath])
開發者ID:Hainish,項目名稱:calibre,代碼行數:20,代碼來源:widgets.py

示例3: dropEvent

# 需要導入模塊: from calibre.gui2.dnd import DownloadDialog [as 別名]
# 或者: from calibre.gui2.dnd.DownloadDialog import start_download [as 別名]
    def dropEvent(self, event):
        event.setDropAction(Qt.CopyAction)
        md = event.mimeData()

        x, y = dnd_get_image(md)
        if x is not None:
            # We have an image, set cover
            event.accept()
            if y is None:
                # Local image
                self.undo_stack.push(Replace(x.toImage(), _('Drop image'), self))
            else:
                d = DownloadDialog(x, y, self.gui)
                d.start_download()
                if d.err is None:
                    with open(d.fpath, 'rb') as f:
                        img = QImage()
                        img.loadFromData(f.read())
                    if not img.isNull():
                        self.undo_stack.push(Replace(img, _('Drop image'), self))

        event.accept()
開發者ID:HaraldGustafsson,項目名稱:calibre,代碼行數:24,代碼來源:canvas.py


注:本文中的calibre.gui2.dnd.DownloadDialog.start_download方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。