From 07ac5646686bb7de1c4efbdd8c98db680f6ff182 Mon Sep 17 00:00:00 2001 From: tangstad Date: Fri, 21 Apr 2006 14:12:18 +0000 Subject: [PATCH] Changed info function to show dialog instead of returning a view. --- workflows/go_workflow.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/workflows/go_workflow.py b/workflows/go_workflow.py index 3c9987a..571f1f8 100644 --- a/workflows/go_workflow.py +++ b/workflows/go_workflow.py @@ -106,31 +106,30 @@ class DatasetInfoFunction(Function): Function.__init__(self, 'data_info', 'Show information') def run(self, data): - if data: - logger.log('notice', 'Generating view for %s.' % data.get_name()) - return [DatasetInfoView(data)] - else: - logger.log('notice', 'Not generating view... no data.') + if not data: return [] - - -class DatasetInfoView(plots.Plot): - def __init__(self, data): - plots.Plot.__init__(self, None) buf = gtk.TextBuffer() buf_iter = buf.get_start_iter() buf.insert(buf_iter, "Data: %s\n\n" % data.get_name()) + buf.insert(buf_iter, "Dimensions: ") dims = [] for name in data.get_dim_names(): dims.append((name, data.dims[data._dim_num[name]])) - buf.insert(buf_iter, ", ".join(["%s (%d)" % dim for dim in dims])) + dim_text = ", ".join(["%s (%d)" % dim for dim in dims]) - area = gtk.TextView(buf) - area.connect('button_press_event', self.on_button_press) - area.set_editable(False) - self.add(area) - area.show() + text = """Data: %s + +Dimensions: %s""" % (data.get_name(), dim_text) + + d = gtk.MessageDialog(flags=(gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT), + buttons=gtk.BUTTONS_OK) + d.set_markup(text) + d.set_default_response(gtk.BUTTONS_OK) + d.run() + d.destroy() + + return []