/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to ui.py

  • Committer: Jelmer Vernooij
  • Date: 2008-06-29 16:11:12 UTC
  • mfrom: (475.2.2 gtk)
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629161112-3j4zp0r0e7cv6cds
Merge Chad's progress bar in viz patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        super(GtkProgressBar, self).__init__()
46
46
        self.set_fraction(0.0)
47
47
        self._stack = stack
 
48
        self.current = None
 
49
        self.total = None
48
50
 
49
51
    def finished(self):
50
52
        self._stack.remove(self)
56
58
        self.pulse()
57
59
 
58
60
    def update(self, msg=None, current=None, total=None):
 
61
        if current:
 
62
            self.current = current
 
63
        if total:
 
64
            self.total = total
59
65
        if msg is not None:
60
66
            self.set_text(msg)
61
 
        if None not in (current, total) and total > 0:
62
 
            self.set_fraction(1.0 * current / total)
 
67
        if None not in (self.current, self.total):
 
68
            self.set_fraction(1.0 * self.current / self.total)
63
69
        while gtk.events_pending():
64
70
            gtk.main_iteration()
65
71