Commit bd94dad6 authored by VIGNET Pierre's avatar VIGNET Pierre

Filechooser option: Open window instead of alawys a save window...

parent dabab353
......@@ -453,7 +453,8 @@ class ImportPIDParam(object):
"""
lauch import
"""
fch = FileChooser("Import from PID xml", "xml files", "*.xml")
fch = FileChooser("Import from PID xml", "xml files", "*.xml",
save_window=False)
fch.do_action(self.import_from_pid_file)
def import_from_pid_file(self, file):
......@@ -577,7 +578,8 @@ class ImportBioPAXParams(object):
"""
Choose blacklist file of entities
"""
fch = FileChooser("Choose the blacklist file", "txt files", "*.txt")
fch = FileChooser("Choose the blacklist file", "txt files", "*.txt",
save_window=False)
fch.do_action(self.set_blacklist_file)
......
......@@ -235,7 +235,7 @@ class ChartSimulControler(object):
"""
chose an input file
"""
fch = FileChooser("Input file", "", "*")
fch = FileChooser("Input file", "", "*", save_window=False)
fch.do_action(self.set_input_file)
def set_input_file(self, filename):
......
......@@ -584,7 +584,8 @@ class Charter(object):
"""
open a window to search xml file
"""
fch = FileChooser("Import Cadbiom model", "bcx files", "*.bcx")
fch = FileChooser("Import Cadbiom model", "bcx files", "*.bcx",
save_window=False)
fch.do_action(self.import_from_xml_file)
def import_from_xml_file(self, ffile):
......@@ -611,8 +612,8 @@ class Charter(object):
"""
open a window to search xml file
"""
fch = FileChooser("Import from Cadbiom-chart lang",
"cadbiom-l", "*.cal")
fch = FileChooser("Import from Cadbiom-chart lang", "cadbiom-l", "*.cal",
save_window=False)
fch.do_action(self.import_from_cl_file)
def import_from_cl_file(self, ffile):
......
......@@ -43,17 +43,32 @@
## Contributor(s): Geoffroy Andrieux
##
from gtk import FileChooserDialog, FileFilter, FILE_CHOOSER_ACTION_SAVE, \
STOCK_CANCEL, RESPONSE_CANCEL, STOCK_SAVE, RESPONSE_OK
from gtk import FileChooserDialog, FileFilter, \
STOCK_CANCEL, RESPONSE_CANCEL, RESPONSE_OK, \
FILE_CHOOSER_ACTION_SAVE, STOCK_SAVE, \
FILE_CHOOSER_ACTION_OPEN, STOCK_OPEN
class FileChooser(FileChooserDialog):
"""
Create a customed file chooser
"""
def __init__(self, title, filter_name, filter_pattern):
FileChooserDialog.__init__(self, title, None, FILE_CHOOSER_ACTION_SAVE,
(STOCK_CANCEL, RESPONSE_CANCEL, STOCK_SAVE,
RESPONSE_OK))
def __init__(self, title, filter_name, filter_pattern, save_window=True):
"""Open a custom file chooser.
if save_window is False, an open window will be initialized
"""
if save_window:
FileChooserDialog.__init__(
self, title, None, FILE_CHOOSER_ACTION_SAVE,
(STOCK_CANCEL, RESPONSE_CANCEL, STOCK_SAVE, RESPONSE_OK)
)
else:
FileChooserDialog.__init__(
self, title, None, FILE_CHOOSER_ACTION_OPEN,
(STOCK_CANCEL, RESPONSE_CANCEL, STOCK_OPEN, RESPONSE_OK)
)
self.set_default_response(RESPONSE_OK)
#add a filter to see only files for BioSignal (*.sig)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment