/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
 
        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)
62
69
        while gtk.events_pending():
63
70
            gtk.main_iteration()
64
71
 
85
92
 
86
93
    def remove(self, pb):
87
94
        self.vbox.remove(pb)
 
95
        if len(self.vbox.get_children()) == 0: # If there is nothing to show, don't leave a ghost window here
 
96
             self.destroy()
88
97
 
89
98
 
90
99
class PasswordDialog(gtk.Dialog):