1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """generic dialogs such as progress, error and about"""
24
25 import gettext
26 import os
27
28 import gobject
29 import gtk
30
31 from flumotion.configure import configure
32 from flumotion.common.errors import AlreadyConnectedError, \
33 AlreadyConnectingError, ConnectionFailedError, \
34 ConnectionRefusedError
35
36 __version__ = "$Rev: 8173 $"
37 _ = gettext.gettext
38
39
68
69
71
72 - def __init__(self, title, message, parent = None):
73 gtk.Dialog.__init__(self, title, parent,
74 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
75
76
77 self.label = gtk.Label(message)
78 self.vbox.pack_start(self.label, True, True, 6)
79 self.label.show()
80 self.bar = gtk.ProgressBar()
81 self.bar.show()
82 self.vbox.pack_end(self.bar, True, True, 6)
83 self.active = False
84 self._timeout_id = None
85
86 self.connect('destroy', self._destroy_cb)
87
89 "Show the dialog and start pulsating."
90 self.active = True
91 self.show()
92 self.bar.pulse()
93 self._timeout_id = gobject.timeout_add(200, self._pulse)
94
101
103 "Set the message on the dialog."
104 self.label.set_text(message)
105
107 if not self.active:
108
109 return False
110 self.bar.pulse()
111 return True
112
115
116
118
119 - def __init__(self, message, parent=None, close_on_response=True,
120 secondary_text=None):
121 gtk.MessageDialog.__init__(self, parent, gtk.DIALOG_MODAL,
122 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message)
123 b = self.action_area.get_children()[0]
124 b.set_name('ok_button')
125 self.message = message
126 if close_on_response:
127 self.connect("response", lambda self, response: self.hide())
128
129
130 if not hasattr(self, 'format_secondary_text'):
131 self.format_secondary_text = self._format_secondary_text_backport
132
133 if secondary_text:
134 self.format_secondary_text(secondary_text)
135
137 self.set_markup('<span weight="bold" size="larger">%s</span>'
138 '\n\n%s' % (self.message, secondary_text))
139
149 self.connect('response', callback, deferred)
150 self.show()
151 return deferred
152
153
155
157 gtk.Dialog.__init__(self, _('About Flumotion'), parent,
158 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
159 (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
160 self.set_has_separator(False)
161 self.set_resizable(False)
162 self.set_border_width(12)
163 self.vbox.set_spacing(6)
164
165 image = gtk.Image()
166 self.vbox.pack_start(image)
167 image.set_from_file(os.path.join(configure.imagedir, 'flumotion.png'))
168 image.show()
169
170 version = gtk.Label(
171 '<span size="xx-large"><b>Flumotion %s</b></span>' %
172 configure.version)
173 version.set_selectable(True)
174 self.vbox.pack_start(version)
175 version.set_use_markup(True)
176 version.show()
177
178 text = _('Flumotion is a streaming media server.\n\n'
179 '© 2004, 2005, 2006, 2007, 2008 Fluendo S.L.')
180 authors = (
181 'Johan Dahlin',
182 'Alvin Delagon',
183 'Pedro Gracia Fajardo',
184 'Arek Korbik',
185 'Julien Le Goff',
186 'Marc-André Lureau',
187 'Xavier Martinez',
188 'Jordi Massaguer Pla',
189 'Zaheer Abbas Merali',
190 'Sébastien Merle',
191 'Xavier Queralt Mateu',
192 'Josep Joan "Pepe" Ribas',
193 'Mike Smith',
194 'Wim Taymans',
195 'Jan Urbański',
196 'Thomas Vander Stichele',
197 'Andy Wingo',
198 )
199 text += '\n\n<small>' + _('Authors') + ':\n'
200 for author in authors:
201 text += ' %s\n' % author
202 text += '</small>'
203 info = gtk.Label(text)
204 self.vbox.pack_start(info)
205 info.set_use_markup(True)
206 info.set_selectable(True)
207 info.set_justify(gtk.JUSTIFY_FILL)
208 info.set_line_wrap(True)
209 info.show()
210
211
233