Commit 1ca4667d authored by eric pellegrini's avatar eric pellegrini
Browse files

Removed the cancel button from Preferences settings and JobPlugin

Bug fix in PreferencesSettins dialog
parent 573cf921
...@@ -67,14 +67,12 @@ class JobPlugin(ComponentPlugin): ...@@ -67,14 +67,12 @@ class JobPlugin(ComponentPlugin):
sb = wx.StaticBox(self._main, wx.ID_ANY) sb = wx.StaticBox(self._main, wx.ID_ANY)
sbSizer = wx.StaticBoxSizer(sb, wx.HORIZONTAL) sbSizer = wx.StaticBoxSizer(sb, wx.HORIZONTAL)
cancelButton = wx.Button(self._main, label = "Cancel")
helpButton = wx.Button(self._main, label = "Help") helpButton = wx.Button(self._main, label = "Help")
saveButton = wx.Button(self._main, label = "Save") saveButton = wx.Button(self._main, label = "Save")
runButton = wx.Button(self._main, label = "Run") runButton = wx.Button(self._main, label = "Run")
sbSizer.Add(cancelButton, 0, wx.ALL|wx.EXPAND, 5)
sbSizer.Add((-1,-1), 1, wx.ALL|wx.EXPAND, 5)
sbSizer.Add(helpButton, 0, wx.ALL|wx.EXPAND, 5) sbSizer.Add(helpButton, 0, wx.ALL|wx.EXPAND, 5)
sbSizer.Add((-1,-1), 1, wx.ALL|wx.EXPAND, 5)
sbSizer.Add(saveButton, 0, wx.ALL|wx.EXPAND, 5) sbSizer.Add(saveButton, 0, wx.ALL|wx.EXPAND, 5)
sbSizer.Add(runButton, 0, wx.ALL|wx.EXPAND, 5) sbSizer.Add(runButton, 0, wx.ALL|wx.EXPAND, 5)
...@@ -89,7 +87,6 @@ class JobPlugin(ComponentPlugin): ...@@ -89,7 +87,6 @@ class JobPlugin(ComponentPlugin):
self._mgr.Update() self._mgr.Update()
self.Bind(wx.EVT_BUTTON, self.on_close, cancelButton)
self.Bind(wx.EVT_BUTTON, self.on_help, helpButton) self.Bind(wx.EVT_BUTTON, self.on_help, helpButton)
self.Bind(wx.EVT_BUTTON, self.on_save, saveButton) self.Bind(wx.EVT_BUTTON, self.on_save, saveButton)
self.Bind(wx.EVT_BUTTON, self.on_run, runButton) self.Bind(wx.EVT_BUTTON, self.on_run, runButton)
...@@ -182,20 +179,12 @@ class JobFrame(wx.Frame): ...@@ -182,20 +179,12 @@ class JobFrame(wx.Frame):
plugin = REGISTRY['plugin'][self._jobType](self) plugin = REGISTRY['plugin'][self._jobType](self)
pub.sendMessage("msg_set_data", plugin=plugin) pub.sendMessage("msg_set_data", plugin=plugin)
self.Bind(wx.EVT_CLOSE, self.on_quit)
def on_quit(self, event):
d = wx.MessageDialog(None,'Do you really want to quit ?','Question',wx.YES_NO|wx.YES_DEFAULT|wx.ICON_QUESTION)
if d.ShowModal() == wx.ID_YES:
self.Destroy()
if __name__ == "__main__": if __name__ == "__main__":
filename = os.path.join(os.path.dirname(PLATFORM.package_directory()),'Data','Trajectories','MMTK','protein_in_periodic_universe.nc') filename = os.path.join(os.path.dirname(PLATFORM.package_directory()),'Data','Trajectories','MMTK','protein_in_periodic_universe.nc')
app = wx.App(False) app = wx.App(False)
f = JobFrame(None,'ac',filename) f = JobFrame(None,'msd',filename)
f.Show() f.Show()
app.MainLoop() app.MainLoop()
\ No newline at end of file
...@@ -119,7 +119,7 @@ class InputDirectoryWidget(PreferencesItemWidget): ...@@ -119,7 +119,7 @@ class InputDirectoryWidget(PreferencesItemWidget):
WIDGETS = dict([(v.type,v) for v in PreferencesItemWidget.__subclasses__()]) WIDGETS = dict([(v.type,v) for v in PreferencesItemWidget.__subclasses__()])
class PreferencesSettingsDialog(wx.Dialog): class PreferencesSettings(wx.Dialog):
def __init__(self, parent=None): def __init__(self, parent=None):
...@@ -156,14 +156,12 @@ class PreferencesSettingsDialog(wx.Dialog): ...@@ -156,14 +156,12 @@ class PreferencesSettingsDialog(wx.Dialog):
sb = wx.StaticBox(self, wx.ID_ANY) sb = wx.StaticBox(self, wx.ID_ANY)
sbSizer = wx.StaticBoxSizer(sb, wx.HORIZONTAL) sbSizer = wx.StaticBoxSizer(sb, wx.HORIZONTAL)
cancelButton = wx.Button(self, wx.ID_ANY, label="Cancel")
defaultButton = wx.Button(self, wx.ID_ANY, label="Default") defaultButton = wx.Button(self, wx.ID_ANY, label="Default")
applyButton = wx.Button(self, wx.ID_ANY, label="Apply") applyButton = wx.Button(self, wx.ID_ANY, label="Apply")
okButton = wx.Button(self, wx.ID_ANY, label="OK") okButton = wx.Button(self, wx.ID_ANY, label="OK")
sbSizer.Add(cancelButton, 0, wx.ALL, 5)
sbSizer.Add((-1,-1), 1, wx.ALL|wx.EXPAND, 5)
sbSizer.Add(defaultButton, 0, wx.ALL, 5) sbSizer.Add(defaultButton, 0, wx.ALL, 5)
sbSizer.Add((-1,-1), 1, wx.ALL|wx.EXPAND, 5)
sbSizer.Add(applyButton, 0, wx.ALL, 5) sbSizer.Add(applyButton, 0, wx.ALL, 5)
sbSizer.Add(okButton, 0, wx.ALL, 5) sbSizer.Add(okButton, 0, wx.ALL, 5)
...@@ -176,7 +174,6 @@ class PreferencesSettingsDialog(wx.Dialog): ...@@ -176,7 +174,6 @@ class PreferencesSettingsDialog(wx.Dialog):
self.SetSizer(self._sizer) self.SetSizer(self._sizer)
self.Bind(wx.EVT_CLOSE, self.on_cancel) self.Bind(wx.EVT_CLOSE, self.on_cancel)
self.Bind(wx.EVT_BUTTON, self.on_cancel, cancelButton)
self.Bind(wx.EVT_BUTTON, self.on_default, defaultButton) self.Bind(wx.EVT_BUTTON, self.on_default, defaultButton)
self.Bind(wx.EVT_BUTTON, self.on_apply, applyButton) self.Bind(wx.EVT_BUTTON, self.on_apply, applyButton)
self.Bind(wx.EVT_BUTTON, self.on_ok, okButton) self.Bind(wx.EVT_BUTTON, self.on_ok, okButton)
...@@ -223,7 +220,7 @@ if __name__ == "__main__": ...@@ -223,7 +220,7 @@ if __name__ == "__main__":
app = wx.App(False) app = wx.App(False)
d = PreferencesSettingsDialog(None) d = PreferencesSettings(None)
d.ShowModal() d.ShowModal()
......
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