diff --git a/system/navigator.py b/system/navigator.py index bff4d31..d6abe38 100644 --- a/system/navigator.py +++ b/system/navigator.py @@ -36,6 +36,24 @@ class NavigatorView (gtk.TreeView): t = type(obj) logger.log('debug', 'Selected datatype was %s. Don\'t know what to do.' % t) + def display_data_info(self, data): + dims = [] + for name in data.get_dim_names(): + dims.append((name, data.dims[data._dim_num[name]])) + + dim_text = ", ".join(["%s (%d)" % dim for dim in dims]) + + 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() + def row_activated_handler(self, widget, path, column): tree_iter = self.data_tree.get_iter(path) obj = self.data_tree.get_value(tree_iter, 2) @@ -44,8 +62,7 @@ class NavigatorView (gtk.TreeView): logger.log('debug', 'Activating plot') self.app.change_plot(obj) elif isinstance(obj, dataset.Dataset): - # do nothing - pass + self.display_data_info(obj) else: t = type(obj) logger.log('debug', 'Activated datatype was %s. Don\'t know what to do.' % t) diff --git a/workflows/go_workflow.py b/workflows/go_workflow.py index 10734b0..287e8c5 100644 --- a/workflows/go_workflow.py +++ b/workflows/go_workflow.py @@ -17,7 +17,6 @@ class EinarsWorkflow (Workflow): load = Stage('load', 'Load Data') load.add_function(Function('load', 'Load Microarrays')) load.add_function(TestDataFunction()) - load.add_function(DatasetInfoFunction()) self.add_stage(load) preproc = Stage('preprocess', 'Preprocessing') @@ -99,31 +98,3 @@ class TestDataFunction(Function): axis_1 = ['cols',[]] X = dataset.Dataset(x,[axis_0,axis_1]) return [X, plots.SinePlot(None)] - - -class DatasetInfoFunction(Function): - def __init__(self): - Function.__init__(self, 'data_info', 'Show information') - - def run(self, data): - if not data: - return [] - - dims = [] - for name in data.get_dim_names(): - dims.append((name, data.dims[data._dim_num[name]])) - - dim_text = ", ".join(["%s (%d)" % dim for dim in dims]) - - 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 []