/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 19:18:34 UTC
  • mto: This revision was merged to the branch mainline in revision 515.
  • Revision ID: jelmer@samba.org-20080629191834-ha2ecpv5szt96nge
Make sure signed testament matches repository data.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2006 Szilveszter Farkas <szilveszter.farkas@gmail.com>
 
2
# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
2
3
 
3
4
# This program is free software; you can redistribute it and/or modify
4
5
# it under the terms of the GNU General Public License as published by
35
36
        
36
37
        self.vbox.show_all()
37
38
 
38
 
        self.add_buttons(gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO)
 
39
        self.add_buttons(gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, 
 
40
                         gtk.RESPONSE_NO)
39
41
 
40
42
 
41
43
class GtkProgressBar(gtk.ProgressBar):
56
58
    def update(self, msg=None, current=None, total=None):
57
59
        if msg is not None:
58
60
            self.set_text(msg)
59
 
        self.set_fraction(1.0 * current / total)
 
61
        if None not in (current, total) and total > 0:
 
62
            self.set_fraction(1.0 * current / total)
60
63
        while gtk.events_pending():
61
64
            gtk.main_iteration()
62
65
 
83
86
 
84
87
    def remove(self, pb):
85
88
        self.vbox.remove(pb)
 
89
        if len(self.vbox.get_children()) == 0: # If there is nothing to show, don't leave a ghost window here
 
90
             self.destroy()
86
91
 
87
92
 
88
93
class PasswordDialog(gtk.Dialog):
117
122
 
118
123
        """
119
124
        super(GtkUIFactory, self).__init__()
120
 
        if stdout is None:
121
 
            self.stdout = sys.stdout
122
 
        else:
123
 
            self.stdout = stdout
124
 
        if stderr is None:
125
 
            self.stderr = sys.stderr
126
 
        else:
127
 
            self.stderr = stderr
128
125
        self._progress_bar_stack = None
129
126
 
130
127
    def get_boolean(self, prompt):