Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

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.
This commit is contained in:
Einar Ryeng 2007-01-16 12:28:56 +00:00
parent ea4c0af6de
commit f612dda72f
2 changed files with 24 additions and 15 deletions

View File

@ -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()

View File

@ -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):