Removed data information as function in workflow and added as default action on datasets double-clicked in navigator.
This commit is contained in:
		@@ -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 = """<span weight="bold">Data:</span> %s
 | 
			
		||||
 | 
			
		||||
<span weight="bold">Dimensions:</span> %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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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 = """<span weight="bold">Data:</span> %s
 | 
			
		||||
 | 
			
		||||
<span weight="bold">Dimensions:</span> %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 []
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user