From f612dda72fdd8e1e9c0e5b6f3569de0bc389e40e Mon Sep 17 00:00:00 2001 From: einarr Date: Tue, 16 Jan 2007 12:28:56 +0000 Subject: [PATCH] Fixed bug in ftsv save and open dialogs. The save dialog now looks as intended. Added the possibility to load several datasets at once. Error handling should still be improved. --- fluents/navigator.py | 34 +++++++++++++++++++--------------- workflows/go_workflow.py | 5 +++++ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/fluents/navigator.py b/fluents/navigator.py index 0b4e13a..a3e092e 100644 --- a/fluents/navigator.py +++ b/fluents/navigator.py @@ -205,38 +205,42 @@ class NavigatorMenu(gtk.Menu): def on_load_dataset(self, item, navigator): dialog = gtk.FileChooserDialog('Load dataset') + dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) dialog.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK) + dialog.set_select_multiple(True) retval = dialog.run() if retval in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: pass elif retval == gtk.RESPONSE_OK: - fd = open(dialog.get_filename()) - ds = dataset.read_ftsv(fd) - fd.close() + for filename in dialog.get_filenames(): + fd = open(filename) + ds = dataset.read_ftsv(fd) + fd.close() - if isinstance(ds, dataset.GraphDataset): - icon = fluents.icon_factory.get("graph_dataset") - elif isinstance(ds, dataset.CategoryDataset): - icon = fluents.icon_factory.get("category_dataset") - else: - icon = fluents.icon_factory.get("dataset") + if isinstance(ds, dataset.GraphDataset): + icon = fluents.icon_factory.get("graph_dataset") + elif isinstance(ds, dataset.CategoryDataset): + icon = fluents.icon_factory.get("category_dataset") + else: + icon = fluents.icon_factory.get("dataset") - project = navigator.project - project.add_dataset(ds) - project.data_tree_insert(None, ds.get_name(), ds, None, "black", icon) + project = navigator.project + project.add_dataset(ds) + project.data_tree_insert(None, ds.get_name(), ds, None, "black", icon) else: print "unknown; ", retval dialog.destroy() def on_save_dataset(self, item, navigator): dialog = gtk.FileChooserDialog('Save dataset') + dialog.set_action(gtk.FILE_CHOOSER_ACTION_SAVE) dialog.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK) + dialog.set_current_name("%s.ftsv" % self.dataset.get_name()) retval = dialog.run() if retval in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: - print "Cancelled" + logger.log("debug", "Cancelled save dataset") elif retval == gtk.RESPONSE_OK: - print "OK" - print dialog.get_filename() + logger.log("debug", "Saving dataset as: %s" % dialog.get_filename()) fd = open(dialog.get_filename(), 'w') dataset.write_ftsv(fd, self.dataset) fd.close() diff --git a/workflows/go_workflow.py b/workflows/go_workflow.py index 2b19553..00615ea 100644 --- a/workflows/go_workflow.py +++ b/workflows/go_workflow.py @@ -1,5 +1,6 @@ import gtk from fluents import dataset, logger, plots, workflow, fluents +from fluents.lib import blmfuncs import geneontology #import gostat from scipy import array, randn, log, ones, zeros @@ -123,6 +124,10 @@ class GoWorkflow (workflow.Workflow): go.add_function(SaveDistancesFunction()) self.add_stage(go) + blm = workflow.Stage('blm', 'Bilinear Analysis') + blm.add_function(blmfuncs.PCA()) + self.add_stage(blm) + class LoadGOFunction(workflow.Function): def __init__(self):