当前位置: 首页>>代码示例>>Python>>正文


Python dnd.DownloadDialog类代码示例

本文整理汇总了Python中calibre.gui2.dnd.DownloadDialog的典型用法代码示例。如果您正苦于以下问题:Python DownloadDialog类的具体用法?Python DownloadDialog怎么用?Python DownloadDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DownloadDialog类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: remote_file_dropped_on_book

 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,代码行数:12,代码来源:add.py

示例2: dropEvent

    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,代码行数:18,代码来源:widgets.py

示例3: dropEvent

    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,代码行数:22,代码来源:canvas.py


注:本文中的calibre.gui2.dnd.DownloadDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。