Commit 2439e178 authored by Remi Perenon's avatar Remi Perenon
Browse files

Solving GUI freeze by suppressing 'Quit' button in dialog frames

parent e4e6f4fb
...@@ -35,7 +35,6 @@ class ImageSettingsDialog(wx.Dialog, UnitsSettingsDialog): ...@@ -35,7 +35,6 @@ class ImageSettingsDialog(wx.Dialog, UnitsSettingsDialog):
wx.Dialog.__init__(self, parent, wx.ID_ANY, title="Image Settings", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX) wx.Dialog.__init__(self, parent, wx.ID_ANY, title="Image Settings", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX)
self.parent = parent self.parent = parent
self.build_dialog() self.build_dialog()
self.Bind(wx.EVT_CLOSE, self.on_close)
def build_dialog(self): def build_dialog(self):
...@@ -134,9 +133,7 @@ class ImageSettingsDialog(wx.Dialog, UnitsSettingsDialog): ...@@ -134,9 +133,7 @@ class ImageSettingsDialog(wx.Dialog, UnitsSettingsDialog):
hsizer1 = wx.BoxSizer(wx.HORIZONTAL) hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
self.apply_button = wx.Button(self, wx.ID_ANY, label="Apply") self.apply_button = wx.Button(self, wx.ID_ANY, label="Apply")
self.quit_button = wx.Button(self, wx.ID_ANY, label="Quit")
hsizer1.Add(self.apply_button, 0, wx.EXPAND, 0) hsizer1.Add(self.apply_button, 0, wx.EXPAND, 0)
hsizer1.Add(self.quit_button, 0, wx.EXPAND, 0)
Sizer.Add(hsizer1, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.ALL, 5) Sizer.Add(hsizer1, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.ALL, 5)
...@@ -144,8 +141,7 @@ class ImageSettingsDialog(wx.Dialog, UnitsSettingsDialog): ...@@ -144,8 +141,7 @@ class ImageSettingsDialog(wx.Dialog, UnitsSettingsDialog):
Sizer.Fit(self) Sizer.Fit(self)
self.Layout() self.Layout()
self.Bind(wx.EVT_BUTTON, self.set_settings, self.apply_button) self.Bind(wx.EVT_BUTTON, self.set_settings, self.apply_button)
self.Bind(wx.EVT_BUTTON, self.on_close, self.quit_button)
self.get_settings() self.get_settings()
...@@ -189,17 +185,13 @@ class ImageSettingsDialog(wx.Dialog, UnitsSettingsDialog): ...@@ -189,17 +185,13 @@ class ImageSettingsDialog(wx.Dialog, UnitsSettingsDialog):
self.parent.color_bar.update_normal(self.parent.ax) self.parent.color_bar.update_normal(self.parent.ax)
self.parent.canvas.draw() self.parent.canvas.draw()
def on_close(self, event = None):
self.MakeModal(False)
self.Destroy()
class GeneralSettingsDialog(wx.Dialog): class GeneralSettingsDialog(wx.Dialog):
def __init__(self, parent=None): def __init__(self, parent=None):
wx.Dialog.__init__(self, parent, wx.ID_ANY, title="General Settings", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX) wx.Dialog.__init__(self, parent, wx.ID_ANY, title="General Settings", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX)
self.parent = parent self.parent = parent
self.build_dialog() self.build_dialog()
self.Bind(wx.EVT_CLOSE, self.on_close)
def build_dialog(self): def build_dialog(self):
self.legend_location_choice = ['best' , 'upper right' , 'upper left' ,\ self.legend_location_choice = ['best' , 'upper right' , 'upper left' ,\
...@@ -292,9 +284,7 @@ class GeneralSettingsDialog(wx.Dialog): ...@@ -292,9 +284,7 @@ class GeneralSettingsDialog(wx.Dialog):
hsizer5 = wx.BoxSizer(wx.HORIZONTAL) hsizer5 = wx.BoxSizer(wx.HORIZONTAL)
self.apply_button = wx.Button(self, wx.ID_ANY, label="Apply") self.apply_button = wx.Button(self, wx.ID_ANY, label="Apply")
self.quit_button = wx.Button(self, wx.ID_ANY, label="Quit")
hsizer5.Add(self.apply_button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALIGN_RIGHT, 0) hsizer5.Add(self.apply_button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALIGN_RIGHT, 0)
hsizer5.Add(self.quit_button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALIGN_RIGHT, 0)
Sizer.Add(sbsizer0, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) Sizer.Add(sbsizer0, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
Sizer.Add(sbsizer1, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) Sizer.Add(sbsizer1, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
...@@ -305,8 +295,7 @@ class GeneralSettingsDialog(wx.Dialog): ...@@ -305,8 +295,7 @@ class GeneralSettingsDialog(wx.Dialog):
Sizer.Fit(self) Sizer.Fit(self)
self.Layout() self.Layout()
self.Bind(wx.EVT_BUTTON, self.set_settings, self.apply_button) self.Bind(wx.EVT_BUTTON, self.set_settings, self.apply_button)
self.Bind(wx.EVT_BUTTON, self.on_close, self.quit_button)
self.get_settings() self.get_settings()
...@@ -365,9 +354,6 @@ class GeneralSettingsDialog(wx.Dialog): ...@@ -365,9 +354,6 @@ class GeneralSettingsDialog(wx.Dialog):
self.parent.canvas.draw() self.parent.canvas.draw()
def on_close(self, event = None):
self.MakeModal(False)
self.Destroy()
class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog): class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog):
...@@ -376,7 +362,6 @@ class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog): ...@@ -376,7 +362,6 @@ class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog):
wx.Dialog.__init__(self, parent, wx.ID_ANY, title="Axes Settings", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX) wx.Dialog.__init__(self, parent, wx.ID_ANY, title="Axes Settings", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX)
self.parent = parent self.parent = parent
self.build_dialog() self.build_dialog()
self.Bind(wx.EVT_CLOSE, self.on_close)
def build_dialog(self): def build_dialog(self):
...@@ -447,9 +432,7 @@ class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog): ...@@ -447,9 +432,7 @@ class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog):
hsizer1 = wx.BoxSizer(wx.HORIZONTAL) hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
self.apply_button = wx.Button(self, wx.ID_ANY, label="Apply") self.apply_button = wx.Button(self, wx.ID_ANY, label="Apply")
self.quit_button = wx.Button(self, wx.ID_ANY, label="Quit")
hsizer1.Add(self.apply_button, 0, wx.EXPAND, 0) hsizer1.Add(self.apply_button, 0, wx.EXPAND, 0)
hsizer1.Add(self.quit_button, 0, wx.EXPAND, 0)
Sizer.Add(hsizer0, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) Sizer.Add(hsizer0, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
Sizer.Add(hsizer1, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.ALL, 5) Sizer.Add(hsizer1, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.ALL, 5)
...@@ -459,8 +442,7 @@ class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog): ...@@ -459,8 +442,7 @@ class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog):
self.Layout() self.Layout()
self.Bind(wx.EVT_BUTTON, self.auto_fit, self.auto_fit_button) self.Bind(wx.EVT_BUTTON, self.auto_fit, self.auto_fit_button)
self.Bind(wx.EVT_BUTTON, self.set_settings, self.apply_button) self.Bind(wx.EVT_BUTTON, self.set_settings, self.apply_button)
self.Bind(wx.EVT_BUTTON, self.on_close, self.quit_button)
self.get_settings() self.get_settings()
...@@ -516,9 +498,6 @@ class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog): ...@@ -516,9 +498,6 @@ class AxesSettingsDialog(wx.Dialog, UnitsSettingsDialog):
self.Xmax.SetValue(str(self.parent.Xmax)) self.Xmax.SetValue(str(self.parent.Xmax))
self.Ymax.SetValue(str(self.parent.Ymax)) self.Ymax.SetValue(str(self.parent.Ymax))
def on_close(self, event = None):
self.MakeModal(False)
self.Destroy()
class LinesSettingsDialog(wx.Dialog): class LinesSettingsDialog(wx.Dialog):
...@@ -527,7 +506,6 @@ class LinesSettingsDialog(wx.Dialog): ...@@ -527,7 +506,6 @@ class LinesSettingsDialog(wx.Dialog):
self.parent = parent self.parent = parent
self.current_line = None self.current_line = None
self.build_dialog() self.build_dialog()
self.Bind(wx.EVT_CLOSE, self.on_close)
def build_dialog(self): def build_dialog(self):
...@@ -574,9 +552,7 @@ class LinesSettingsDialog(wx.Dialog): ...@@ -574,9 +552,7 @@ class LinesSettingsDialog(wx.Dialog):
hsizer1 = wx.BoxSizer(wx.HORIZONTAL) hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
self.apply_button = wx.Button(self, wx.ID_ANY, label="Apply") self.apply_button = wx.Button(self, wx.ID_ANY, label="Apply")
self.quit_button = wx.Button(self, wx.ID_ANY, label="Quit")
hsizer1.Add(self.apply_button, 0, wx.EXPAND, 0) hsizer1.Add(self.apply_button, 0, wx.EXPAND, 0)
hsizer1.Add(self.quit_button, 0, wx.EXPAND, 0)
Sizer.Add(bagSizer, 0, wx.EXPAND|wx.ALL, 5) Sizer.Add(bagSizer, 0, wx.EXPAND|wx.ALL, 5)
Sizer.Add(hsizer1, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.ALL, 5) Sizer.Add(hsizer1, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.ALL, 5)
...@@ -585,9 +561,8 @@ class LinesSettingsDialog(wx.Dialog): ...@@ -585,9 +561,8 @@ class LinesSettingsDialog(wx.Dialog):
Sizer.Fit(self) Sizer.Fit(self)
self.Layout() self.Layout()
self.Bind(wx.EVT_BUTTON, self.delete_line, self.del_button) self.Bind(wx.EVT_BUTTON, self.delete_line, self.del_button)
self.Bind(wx.EVT_BUTTON, self.set_settings, self.apply_button) self.Bind(wx.EVT_BUTTON, self.set_settings, self.apply_button)
self.Bind(wx.EVT_BUTTON, self.on_close, self.quit_button)
self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_select_item, self.lines) self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_select_item, self.lines)
self.set_lines() self.set_lines()
...@@ -673,12 +648,3 @@ class LinesSettingsDialog(wx.Dialog): ...@@ -673,12 +648,3 @@ class LinesSettingsDialog(wx.Dialog):
return return
self.parent.delete_line(self.current_line) self.parent.delete_line(self.current_line)
self.set_lines() self.set_lines()
def on_close(self, event = None):
self.MakeModal(False)
# unselect selection
if self.parent.selectedLine is not None:
self.parent.selectedLine.set_alpha(1.0)
self.parent.selectedLine.figure.canvas.draw()
self.parent.selectedLine = None
self.Destroy()
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