/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

Add options to viz treeview to not show the line graph, and to only show the main line.
Set the revision browser to use these options.

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
50
48
 
51
49
    def finished(self):
52
50
        self._stack.remove(self)
58
56
        self.pulse()
59
57
 
60
58
    def update(self, msg=None, current=None, total=None):
61
 
        if current:
62
 
            self.current = current
63
 
        if total:
64
 
            self.total = total
65
59
        if msg is not None:
66
60
            self.set_text(msg)
67
 
        if None not in (self.current, self.total):
68
 
            self.set_fraction(1.0 * self.current / self.total)
 
61
        self.set_fraction(1.0 * current / total)
69
62
        while gtk.events_pending():
70
63
            gtk.main_iteration()
71
64
 
72
65
 
73
 
class GtkWindowProgressBarStack(gtk.Window):
 
66
class GtkProgressBarStack(gtk.Window):
74
67
    def __init__(self):
75
 
        super(GtkWindowProgressBarStack, self).__init__(type=gtk.WINDOW_TOPLEVEL)
 
68
        super(GtkProgressBarStack, self).__init__(type=gtk.WINDOW_TOPLEVEL)
76
69
        self.set_border_width(0)
77
70
        self.set_title("Progress")
78
71
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
92
85
 
93
86
    def remove(self, pb):
94
87
        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()
97
88
 
98
89
 
99
90
class PasswordDialog(gtk.Dialog):
160
151
        """Return a nested progress bar.
161
152
        """
162
153
        if self._progress_bar_stack is None:
163
 
            self._progress_bar_stack = GtkWindowProgressBarStack()
 
154
            self._progress_bar_stack = GtkProgressBarStack()
164
155
        return self._progress_bar_stack.get_nested()
165
156
 
166
157
    def set_progress_bar_vbox(self, vbox):