Ejemplo n.º 1
0
 def start_download(self, file_uri, dest_file, callback=None, data=None):
     self.clean_widgets()
     logger.debug("Downloading %s to %s", file_uri, dest_file)
     self.download_progress = DownloadProgressBox(
         {'url': file_uri, 'dest': dest_file}, cancelable=True
     )
     callback_function = callback or self.download_complete
     self.download_progress.connect('complete', callback_function, data)
     self.widget_box.pack_start(self.download_progress, False, False, 10)
     self.download_progress.show()
     self.download_progress.start()
Ejemplo n.º 2
0
 def start_download(self, file_uri, dest_file, callback=None, data=None):
     self.clean_widgets()
     logger.debug("Downloading %s to %s", file_uri, dest_file)
     self.download_progress = DownloadProgressBox(
         {'url': file_uri, 'dest': dest_file}, cancelable=True
     )
     self.download_progress.cancel_button.hide()
     callback = callback or self.on_download_complete
     self.download_progress.connect('complete', callback, data)
     self.widget_box.pack_start(self.download_progress, False, False, 10)
     self.download_progress.show()
     self.download_progress.start()
     self.interpreter.abort_current_task = self.download_progress.cancel
Ejemplo n.º 3
0
 def __init__(self, url, dest):
     super(DownloadDialog, self).__init__("Downloading file")
     self.set_size_request(560, 100)
     params = {'url': url, 'dest': dest}
     self.download_progress_box = DownloadProgressBox(params)
     self.download_progress_box.connect('complete',
                                        self.download_complete)
     self.download_progress_box.connect('cancelrequested',
                                        self.download_cancelled)
     label = Gtk.Label(label='Downloading %s' % url)
     label.set_selectable(True)
     label.set_padding(0, 0)
     label.set_alignment(0.0, 1.0)
     self.vbox.pack_start(label, True, True, 0)
     self.vbox.pack_start(self.download_progress_box, True, False, 0)
     self.show_all()
     self.download_progress_box.start()
Ejemplo n.º 4
0
    def __init__(self,
                 url=None,
                 dest=None,
                 title=None,
                 label=None,
                 downloader=None):
        Gtk.Dialog.__init__(self, title or "Downloading file")
        self.set_size_request(485, 104)
        self.set_border_width(12)
        params = {
            'url': url,
            'dest': dest,
            'title': label or "Downloading %s" % url
        }
        self.download_box = DownloadProgressBox(params, downloader=downloader)

        self.download_box.connect('complete', self.download_complete)
        self.download_box.connect('cancel', self.download_cancelled)
        self.connect('response', self.on_response)

        self.get_content_area().add(self.download_box)
        self.show_all()
        self.download_box.start()