Esempio n. 1
0
class _DownloadStatus(HBox):
    def __init__(self, queue):
        HBox.__init__(self)
        self.thread = DlWorker(queue, self.progress, self.set_url)
        self.label = Label('hello')
        self.pbar = ProgressBar()
        self.pack_start(self.label, FALSE, FALSE, 0)
        self.pack_end(self.pbar, FALSE, FALSE, 0)
        self.label.show()
        self.pbar.show()
        self.show()
        self._done = False
        self._started = False

    def progress(self, dt, dd, ut, ud):
        threads_enter()
        print 'in progress', dt, dd, ut, ud
        if dt == 0:
            self._done += 0.1
            if self._done >= 1:
                self._done = 0
        else:
            self._done = float(dd) / float(dt)
        print '_done', self._done
        self.pbar.set_fraction(self._done)
        threads_leave()

    def set_url(self, url):
        self.label.set_text(url)

    def start(self, *args):
        if not self._started:
            self.thread.start()
            self._started = True
Esempio n. 2
0
    def __init__(self):
        super(PiecesBar, self).__init__()
        # Get progress bar styles, in order to keep font consistency
        pb = ProgressBar()
        pb_style = pb.get_style()
        self.text_font = pb_style.font_desc
        self.text_font.set_weight(WEIGHT_BOLD)
        # Done with the ProgressBar styles, don't keep refs of it
        del pb, pb_style

        self.set_size_request(-1, 25)
        self.gtkui_config = ConfigManager('gtkui.conf')

        self.width = self.prev_width = 0
        self.height = self.prev_height = 0
        self.pieces = self.prev_pieces = ()
        self.num_pieces = None
        self.text = self.prev_text = ''
        self.fraction = self.prev_fraction = 0
        self.progress_overlay = self.text_overlay = self.pieces_overlay = None
        self.cr = None

        self.connect('size-allocate', self.do_size_allocate_event)
        self.set_colormap(colormap_get_system())
        self.show()
Esempio n. 3
0
class _DownloadStatus(HBox):
    def __init__(self, queue):
        HBox.__init__(self)
        self.thread = DlWorker(queue, self.progress, self.set_url)
        self.label = Label("hello")
        self.pbar = ProgressBar()
        self.pack_start(self.label, FALSE, FALSE, 0)
        self.pack_end(self.pbar, FALSE, FALSE, 0)
        self.label.show()
        self.pbar.show()
        self.show()
        self._done = False
        self._started = False

    def progress(self, dt, dd, ut, ud):
        threads_enter()
        print "in progress", dt, dd, ut, ud
        if dt == 0:
            self._done += 0.1
            if self._done >= 1:
                self._done = 0
        else:
            self._done = float(dd) / float(dt)
        print "_done", self._done
        self.pbar.set_fraction(self._done)
        threads_leave()

    def set_url(self, url):
        self.label.set_text(url)

    def start(self, *args):
        if not self._started:
            self.thread.start()
            self._started = True
Esempio n. 4
0
 def __init__(self, queue):
     HBox.__init__(self)
     self.thread = DlWorker(queue, self.progress, self.set_url)
     self.label = Label('hello')
     self.pbar = ProgressBar()
     self.pack_start(self.label, FALSE, FALSE, 0)
     self.pack_end(self.pbar, FALSE, FALSE, 0)
     self.label.show()
     self.pbar.show()
     self.show()
     self._done = False
     self._started = False
Esempio n. 5
0
 def __init__(self, url, path):
     VBox.__init__(self)
     self.label = Label(path)
     self.label.show()
     self.pack_start(self.label, FALSE, FALSE, 0)
     self.pbar = ProgressBar()
     self.pack_end(self.pbar, FALSE, FALSE, 0)
     self.pbar.show()
     self.show()
     self._done = 0
     #self.thread = DownloadThread(url, path, self.progress)
     self.thread = DownloadThread(url, path, self.progress)
     #self.button = Button('start')
     #self.button.connect('clicked', self.start)
     #self.button.show()
     #self.pack_end(self.button, FALSE, FALSE, 0)
     self._started = False
Esempio n. 6
0
 def __init__(self, queue):
     HBox.__init__(self)
     self.thread = DlWorker(queue, self.progress, self.set_url)
     self.label = Label("hello")
     self.pbar = ProgressBar()
     self.pack_start(self.label, FALSE, FALSE, 0)
     self.pack_end(self.pbar, FALSE, FALSE, 0)
     self.label.show()
     self.pbar.show()
     self.show()
     self._done = False
     self._started = False
Esempio n. 7
0
class DownloadStatus(VBox):
    def __init__(self, url, path):
        VBox.__init__(self)
        self.label = Label(path)
        self.label.show()
        self.pack_start(self.label, FALSE, FALSE, 0)
        self.pbar = ProgressBar()
        self.pack_end(self.pbar, FALSE, FALSE, 0)
        self.pbar.show()
        self.show()
        self._done = 0
        #self.thread = DownloadThread(url, path, self.progress)
        self.thread = DownloadThread(url, path, self.progress)
        #self.button = Button('start')
        #self.button.connect('clicked', self.start)
        #self.button.show()
        #self.pack_end(self.button, FALSE, FALSE, 0)
        self._started = False

    def progress(self, dt, dd, ut, ud):
        threads_enter()
        print 'in progress', dt, dd, ut, ud
        if dt == 0:
            self._done += 0.1
            if self._done >= 1:
                self._done = 0
        else:
            self._done = float(dd) / float(dt)
        print '_done', self._done
        self.pbar.set_fraction(self._done)
        threads_leave()

    def start(self, *args):
        if not self._started:
            self.thread.start()
            self._started = True
Esempio n. 8
0
class DownloadStatus(VBox):
    def __init__(self, url, path):
        VBox.__init__(self)
        self.label = Label(path)
        self.label.show()
        self.pack_start(self.label, FALSE, FALSE, 0)
        self.pbar = ProgressBar()
        self.pack_end(self.pbar, FALSE, FALSE, 0)
        self.pbar.show()
        self.show()
        self._done = 0
        # self.thread = DownloadThread(url, path, self.progress)
        self.thread = DownloadThread(url, path, self.progress)
        # self.button = Button('start')
        # self.button.connect('clicked', self.start)
        # self.button.show()
        # self.pack_end(self.button, FALSE, FALSE, 0)
        self._started = False

    def progress(self, dt, dd, ut, ud):
        threads_enter()
        print "in progress", dt, dd, ut, ud
        if dt == 0:
            self._done += 0.1
            if self._done >= 1:
                self._done = 0
        else:
            self._done = float(dd) / float(dt)
        print "_done", self._done
        self.pbar.set_fraction(self._done)
        threads_leave()

    def start(self, *args):
        if not self._started:
            self.thread.start()
            self._started = True
Esempio n. 9
0
 def __init__(self, url, path):
     VBox.__init__(self)
     self.label = Label(path)
     self.label.show()
     self.pack_start(self.label, FALSE, FALSE, 0)
     self.pbar = ProgressBar()
     self.pack_end(self.pbar, FALSE, FALSE, 0)
     self.pbar.show()
     self.show()
     self._done = 0
     # self.thread = DownloadThread(url, path, self.progress)
     self.thread = DownloadThread(url, path, self.progress)
     # self.button = Button('start')
     # self.button.connect('clicked', self.start)
     # self.button.show()
     # self.pack_end(self.button, FALSE, FALSE, 0)
     self._started = False
Esempio n. 10
0
 def __init__(self):
     ProgressBar.__init__(self)
     self.show()
Esempio n. 11
0
 def __init__(self):
     ProgressBar.__init__(self)
     self.show()