/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: Szilveszter Farkas (Phanatic)
  • Date: 2007-04-06 17:48:23 UTC
  • mto: (188.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 190.
  • Revision ID: szilveszter.farkas@gmail.com-20070406174823-bclt7vsgn2nkcas2
Implemented init functionality.

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>
3
2
 
4
3
# This program is free software; you can redistribute it and/or modify
5
4
# it under the terms of the GNU General Public License as published by
36
35
        
37
36
        self.vbox.show_all()
38
37
 
39
 
        self.add_buttons(gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, 
40
 
                         gtk.RESPONSE_NO)
 
38
        self.add_buttons(gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO)
41
39
 
42
40
 
43
41
class GtkProgressBar(gtk.ProgressBar):
58
56
    def update(self, msg=None, current=None, total=None):
59
57
        if msg is not None:
60
58
            self.set_text(msg)
61
 
        if None not in (current, total) and total > 0:
62
 
            self.set_fraction(1.0 * current / total)
 
59
        self.set_fraction(1.0 * current / total)
63
60
        while gtk.events_pending():
64
61
            gtk.main_iteration()
65
62
 
86
83
 
87
84
    def remove(self, pb):
88
85
        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()
91
86
 
92
87
 
93
88
class PasswordDialog(gtk.Dialog):
122
117
 
123
118
        """
124
119
        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
125
128
        self._progress_bar_stack = None
126
129
 
127
130
    def get_boolean(self, prompt):