/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-07-18 20:12:54 UTC
  • mto: This revision was merged to the branch mainline in revision 555.
  • Revision ID: jelmer@samba.org-20080718201254-phkice8vdvr2svvm
Fix license path finding.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        pass
59
59
 
60
60
    def update(self, msg=None, current_cnt=None, total_cnt=None):
61
 
        if current_cnt:
 
61
        if current_cnt is not None:
62
62
            self.current = current_cnt
63
 
        if total_cnt:
 
63
        if total_cnt is not None:
64
64
            self.total = total_cnt
65
65
        if msg is not None:
66
66
            self.set_text(msg)
67
67
        if None not in (self.current, self.total):
68
68
            self.fraction = float(self.current) / self.total
 
69
            if self.fraction < 0.0 or self.fraction > 1.0:
 
70
                raise AssertionError
69
71
            self.set_fraction(self.fraction)
70
72
        while gtk.events_pending():
71
73
            gtk.main_iteration()
72
74
 
73
75
 
74
76
class ProgressBarWindow(gtk.Window):
75
 
    def __init__(self):
 
77
    def __init__(self, to_file=None, show_pct=None, show_spinner=None, show_eta=None, 
 
78
                 show_bar=None, show_count=None, to_messages_file=None, _stack=None):
76
79
        super(ProgressBarWindow, self).__init__(type=gtk.WINDOW_TOPLEVEL)
 
80
        self._stack = _stack
77
81
        self.set_border_width(0)
78
82
        self.set_title("Progress")
79
83
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
83
87
        self.set_resizable(False)
84
88
        self.show_all()
85
89
 
 
90
    def return_pb(self, pb):
 
91
        self._stack.return_pb(self)
 
92
    
 
93
    def update(self, *args, **kwargs):
 
94
        self.pb.update(*args, **kwargs)
 
95
 
 
96
    def finished(self):
 
97
        self.pb.finished()
 
98
        self.hide_all()
 
99
 
86
100
    def clear(self):
87
101
        self.pb.clear()
88
102
        self.destroy()
89
103
 
 
104
    def child_progress(self, *args, **kwargs):
 
105
        return self.pb.child_progress(*args, **kwargs)
 
106
 
 
107
    def child_update(self, *args, **kwargs):
 
108
        return self.pb.child_update(*args, **kwargs)
 
109
 
 
110
    def get_progress_bar(self):
 
111
        self.show_all()
 
112
        return self
 
113
 
90
114
 
91
115
class ProgressPanel(gtk.HBox):
92
116
    def __init__(self):