8
"""StatusWindow provides a graphical window into which messages are
9
added. The messages are timestamped and put on a new line."""
13
"""Set up a new status window."""
16
self.widgets = gtk.glade.XML("%s/statuswindow.glade"
17
% os.path.dirname(__file__))
18
except RuntimeError, e:
19
dlg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,
20
gtk.BUTTONS_CLOSE,_("Failed to initialise status window."))
22
self.widgets.signal_autoconnect(self)
26
"""Make the status window visible."""
28
self.widgets.get_widget('window_output_log').show()
30
def addmsg(self, msg):
32
"""Adds a timestamped message to the status window."""
34
buf = self.widgets.get_widget('output_log').get_buffer()
35
buf.insert(buf.get_end_iter(), "%s: %s\n" % (time.ctime(), msg))
39
"""Returns the text buffer of the status window."""
41
return self.widgets.get_widget('output_log').get_buffer()
45
"""Scrolls the status text box to the end."""
47
self.widgets.get_widget('output_log').scroll_to_iter(
48
self.widgets.get_widget('output_log').get_buffer().get_end_iter(), 0)
50
def on_button_output_log_close_clicked(self, widget):
52
"""Hides the status window when the close button is clicked."""
54
self.widgets.get_widget('window_output_log').hide()
56
def on_window_output_log_delete_event(self, widget, event):
58
"""Hide the status window when the x is clicked."""