Commit 045cd743 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

Try to fix windows crashes without parent...

parent a20c82d5
......@@ -361,7 +361,7 @@ class ImportPIDParam(object):
"""
Widget for model importing
"""
def __init__(self, chart, parent):
def __init__(self, chart, parent=None):
self.charter = chart
# window creation
......@@ -380,7 +380,8 @@ class ImportPIDParam(object):
# Set modal mode for the window (above all windows & block inputs)
self.main_window.set_modal(True)
self.main_window.set_transient_for(parent)
if parent:
self.main_window.set_transient_for(parent)
if self.main_window:
self.main_window.connect("destroy", self.on_destroy)
......@@ -496,7 +497,7 @@ class ImportBioPAXParams(object):
.. note:: requires biopax2cadbiom module
"""
def __init__(self, chart, parent):
def __init__(self, chart, parent=None):
self.charter = chart
try:
......@@ -534,7 +535,8 @@ class ImportBioPAXParams(object):
# Set modal mode for the window (above all windows & block inputs)
self.main_window.set_modal(True)
self.main_window.set_transient_for(parent)
if parent:
self.main_window.set_transient_for(parent)
if self.main_window:
self.main_window.connect("destroy", self.on_destroy)
......
......@@ -350,7 +350,7 @@ class SCCWindow(object):
"""
Class used for displaying frontier isolated components
"""
def __init__(self, l_fsol, emvc, reporter, parent):
def __init__(self, l_fsol, emvc, reporter, parent=None):
"""
@param l_fsol: list<list<string>>
@param emvc: edit_mvc
......@@ -383,7 +383,11 @@ class SCCWindow(object):
self.window.set_size_request(700, height)
# Set window above all windows
self.window.set_transient_for(parent.main_window)
self.parent = parent
if parent:
self.window.set_transient_for(parent.main_window)
# register
parent.win_register(self.window)
# Event on_escape key pressed
self.window.connect('key_press_event', self.on_escape)
......@@ -406,10 +410,6 @@ class SCCWindow(object):
vbox = self.wtree.get_widget("vbox1")
vbox.remove(hbbox)
# register
parent.win_register(self.window)
self.parent = parent
# display
self.window.show_all()
#gtk.main()
......@@ -582,15 +582,16 @@ class SCCWindow(object):
# sub windows management
def win_register(self, win):
"""
sub windows management
sub windows management => useless, no subwin
"""
print "register subsubwin"
if win.__class__ == ChartSimulControler:
self.simul = win
self.aux_win.append(win)
def win_remove(self, win):
"""
sub windows management
sub windows management => useless, no subwin
"""
if win in self.aux_win:
self.aux_win.remove(win)
......@@ -599,7 +600,7 @@ class SCCWindow(object):
def clean_subwin(self):
"""
sub windows management
sub windows management => useless, no subwin
"""
for win in self.aux_win:
win.destroy()
......@@ -607,7 +608,7 @@ class SCCWindow(object):
class BAGWindow(SCCWindow):
def __init__(self, l_fsol, emvc, reporter, parent):
def __init__(self, l_fsol, emvc, reporter, parent=None):
"""
@param l_fsol: list<list<string>>
@param emvc: edit_mvc
......@@ -750,7 +751,7 @@ class STATWindow(BAGWindow):
"""
Class for displaying statistics
"""
def __init__(self, stat, emvc, reporter, parent):
def __init__(self, stat, emvc, reporter, parent=None):
"""
@param l_fsol: list<list<string>>
@param emvc: edit_mvc
......
......@@ -926,7 +926,11 @@ class Charter(object):
used by: STATWindow, SCCWindow, BAGWindow, LegendWindow
"""
self.subwindows.remove(window)
try:
self.subwindows.remove(window)
except KeyError:
pass
window.destroy()
# Solve model
......
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