/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: Chad MILLER
  • Date: 2008-05-01 12:06:26 UTC
  • mto: (511.5.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: chad@mysql.com-20080501120626-8k0ay6jee6tfz1sz
Make "vizualize" use the GUI progress bar defined in the parent 'ui' module.

Update the progress bar so that one need not specify both the total steps and 
the current step with every update.

Remove extraneous signaling and put related progress-bar element close to its
use.

TODO:  Given a nested-progress-bar object, one should be able to use it as a
factory of sub-bars.

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):
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