Commit 7cb5b317 authored by eric pellegrini's avatar eric pellegrini

bug fix when saving user definition

bug fix with the initial size of the user definitions plugins
parent f2ab7711
...@@ -166,11 +166,11 @@ class AtomSelectionPlugin(UserDefinitionPlugin): ...@@ -166,11 +166,11 @@ class AtomSelectionPlugin(UserDefinitionPlugin):
PUBLISHER.subscribe(self.msg_select_atoms_from_viewer, 'msg_select_atoms_from_viewer') PUBLISHER.subscribe(self.msg_select_atoms_from_viewer, 'msg_select_atoms_from_viewer')
UserDefinitionPlugin.__init__(self,parent,size=(800,500)) UserDefinitionPlugin.__init__(self,parent,size=(600,600))
def build_panel(self): def build_panel(self):
self._mainPanel = wx.ScrolledWindow(self, wx.ID_ANY, size=self.GetSize()) self._mainPanel = wx.ScrolledWindow(self, wx.ID_ANY)
self._mainPanel.SetScrollbars(20,20,50,50) self._mainPanel.SetScrollbars(20,20,50,50)
sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL)
...@@ -251,10 +251,7 @@ class AtomSelectionPlugin(UserDefinitionPlugin): ...@@ -251,10 +251,7 @@ class AtomSelectionPlugin(UserDefinitionPlugin):
self._mainSizer = wx.BoxSizer(wx.VERTICAL) self._mainSizer = wx.BoxSizer(wx.VERTICAL)
self._mainSizer.Add(self._mainPanel, 1, wx.EXPAND|wx.ALL, 5) self._mainSizer.Add(self._mainPanel, 1, wx.EXPAND|wx.ALL, 5)
self.SetSizer(self._mainSizer) self.SetSizer(self._mainSizer)
self._mgr.AddPane(self._mainPanel, wxaui.AuiPaneInfo().DestroyOnClose().Center().Dock().CaptionVisible(False).CloseButton(False).BestSize(self.GetSize()))
self._mgr.Update()
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.on_display_keyword_values, self.filterTree) self.Bind(wx.EVT_TREE_SEL_CHANGED, self.on_display_keyword_values, self.filterTree)
self.Bind(wx.EVT_LISTBOX, self.on_insert_keyword_values, self.values) self.Bind(wx.EVT_LISTBOX, self.on_insert_keyword_values, self.values)
...@@ -268,9 +265,9 @@ class AtomSelectionPlugin(UserDefinitionPlugin): ...@@ -268,9 +265,9 @@ class AtomSelectionPlugin(UserDefinitionPlugin):
def plug(self): def plug(self):
self.parent.mgr.GetPane(self).Float().Dockable(False).CloseButton(True).BestSize((600,600)) self._parent._mgr.GetPane(self).Float().Floatable(True).Dockable(True).CloseButton(True)
self.parent.mgr.Update() self._parent._mgr.Update()
self.set_trajectory(self.dataproxy.data) self.set_trajectory(self.dataproxy.data)
......
...@@ -33,7 +33,6 @@ Created on Jun 30, 2015 ...@@ -33,7 +33,6 @@ Created on Jun 30, 2015
import os import os
import wx import wx
import wx.aui as wxaui
from MDANSE import LOGGER, REGISTRY from MDANSE import LOGGER, REGISTRY
from MDANSE.GUI.Plugins.UserDefinitionPlugin import UserDefinitionPlugin from MDANSE.GUI.Plugins.UserDefinitionPlugin import UserDefinitionPlugin
...@@ -85,7 +84,7 @@ class AtomsListPlugin(UserDefinitionPlugin): ...@@ -85,7 +84,7 @@ class AtomsListPlugin(UserDefinitionPlugin):
self._selection = [] self._selection = []
UserDefinitionPlugin.__init__(self,parent,size=(800,500)) UserDefinitionPlugin.__init__(self,parent,size=(600,600))
def build_panel(self): def build_panel(self):
...@@ -139,9 +138,6 @@ class AtomsListPlugin(UserDefinitionPlugin): ...@@ -139,9 +138,6 @@ class AtomsListPlugin(UserDefinitionPlugin):
self._mainSizer.Add(self._mainPanel, 1, wx.EXPAND|wx.ALL, 5) self._mainSizer.Add(self._mainPanel, 1, wx.EXPAND|wx.ALL, 5)
self.SetSizer(self._mainSizer) self.SetSizer(self._mainSizer)
self._mgr.AddPane(self._mainPanel, wxaui.AuiPaneInfo().DestroyOnClose().Center().Dock().CaptionVisible(False).CloseButton(False).BestSize(self.GetSize()))
self._mgr.Update()
self.Bind(wx.EVT_SPINCTRL,self.on_define_list_size,self._nAtomsSpinCtrl) self.Bind(wx.EVT_SPINCTRL,self.on_define_list_size,self._nAtomsSpinCtrl)
self.Bind(wx.EVT_TREE_BEGIN_DRAG,self.on_add_atom,self._molecules) self.Bind(wx.EVT_TREE_BEGIN_DRAG,self.on_add_atom,self._molecules)
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.on_add_atom) self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.on_add_atom)
......
...@@ -54,7 +54,7 @@ class JobPlugin(ComponentPlugin): ...@@ -54,7 +54,7 @@ class JobPlugin(ComponentPlugin):
self._job = REGISTRY["job"][self._type]() self._job = REGISTRY["job"][self._type]()
ComponentPlugin.__init__(self, parent, size=wx.Size(800,400), *args, **kwargs) ComponentPlugin.__init__(self, parent, size=wx.Size(800,600), *args, **kwargs)
def build_panel(self): def build_panel(self):
...@@ -148,9 +148,9 @@ class JobPlugin(ComponentPlugin): ...@@ -148,9 +148,9 @@ class JobPlugin(ComponentPlugin):
def plug(self): def plug(self):
self._parent._mgr.GetPane(self).Float().Center().Floatable(True).Dockable(True).CloseButton(True).BestSize((800,600)) self._parent._mgr.GetPane(self).Float().Center().Floatable(True).Dockable(True).CloseButton(True)
self._parent.mgr.Update() self._parent._mgr.Update()
PUBLISHER.sendMessage("msg_set_data", message=self) PUBLISHER.sendMessage("msg_set_data", message=self)
...@@ -162,14 +162,14 @@ class JobFrame(wx.Frame): ...@@ -162,14 +162,14 @@ class JobFrame(wx.Frame):
def __init__(self, parent, jobType, datakey=None): def __init__(self, parent, jobType, datakey=None):
wx.Frame.__init__(self, parent, wx.ID_ANY, size = (800,800), style=wx.DEFAULT_DIALOG_STYLE|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER) wx.Frame.__init__(self, parent, wx.ID_ANY, style=wx.DEFAULT_DIALOG_STYLE|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER)
self._jobType = jobType self._jobType = jobType
job = REGISTRY['job'][self._jobType] job = REGISTRY['job'][self._jobType]
self.SetTitle(job.label) self.SetTitle(job.label)
data = REGISTRY['input_data'][job.ancestor[0]](datakey,True) data = REGISTRY['input_data'][job.ancestor[0]](datakey,True)
self.datakey = data.name self.datakey = data.name
...@@ -178,6 +178,8 @@ class JobFrame(wx.Frame): ...@@ -178,6 +178,8 @@ class JobFrame(wx.Frame):
DATA_CONTROLLER[data.name] = data DATA_CONTROLLER[data.name] = data
plugin = REGISTRY['plugin'][self._jobType](self) plugin = REGISTRY['plugin'][self._jobType](self)
self.SetSize(plugin.GetSize())
PUBLISHER.sendMessage("msg_set_data", message=plugin) PUBLISHER.sendMessage("msg_set_data", message=plugin)
...@@ -186,6 +188,6 @@ if __name__ == "__main__": ...@@ -186,6 +188,6 @@ 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,'dl_poly',filename) f = JobFrame(None,'dacf',filename)
f.Show() f.Show()
app.MainLoop() app.MainLoop()
\ No newline at end of file
...@@ -33,7 +33,6 @@ Created on Jul 2, 2015 ...@@ -33,7 +33,6 @@ Created on Jul 2, 2015
import os import os
import wx import wx
import wx.aui as wxaui
import wx.grid as wxgrid import wx.grid as wxgrid
from MMTK import AtomCluster, Molecule from MMTK import AtomCluster, Molecule
...@@ -55,7 +54,7 @@ class PartialChargesPlugin(UserDefinitionPlugin): ...@@ -55,7 +54,7 @@ class PartialChargesPlugin(UserDefinitionPlugin):
self._selectedAtoms = [] self._selectedAtoms = []
UserDefinitionPlugin.__init__(self, parent) UserDefinitionPlugin.__init__(self, parent,size=(600,600))
def build_panel(self): def build_panel(self):
...@@ -69,12 +68,9 @@ class PartialChargesPlugin(UserDefinitionPlugin): ...@@ -69,12 +68,9 @@ class PartialChargesPlugin(UserDefinitionPlugin):
self._mainPanel.SetSizer(sizer) self._mainPanel.SetSizer(sizer)
self._mgr.AddPane(self._mainPanel, wxaui.AuiPaneInfo().DestroyOnClose().Center().Dock().CaptionVisible(False).CloseButton(False).BestSize(self.GetSize()))
self._mgr.Update()
def plug(self): def plug(self):
self.parent.mgr.GetPane(self).Float().Dockable(False).CloseButton(True).BestSize((600,600)) self.parent.mgr.GetPane(self).Float().Dockable(False).CloseButton(True)
self.parent.mgr.Update() self.parent.mgr.Update()
......
...@@ -191,9 +191,6 @@ class QVectorsPlugin(UserDefinitionPlugin): ...@@ -191,9 +191,6 @@ class QVectorsPlugin(UserDefinitionPlugin):
sizer.Add(generateButton, 0, wx.ALL|wx.EXPAND, 5) sizer.Add(generateButton, 0, wx.ALL|wx.EXPAND, 5)
self._mainPanel.SetSizer(sizer) self._mainPanel.SetSizer(sizer)
self._mgr.AddPane(self._mainPanel, wxaui.AuiPaneInfo().DestroyOnClose().Center().Dock().CaptionVisible(False).CloseButton(False).BestSize(self.GetSize()))
self._mgr.Update()
self.Bind(wxaui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_tab, self._notebook) self.Bind(wxaui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_tab, self._notebook)
self.Bind(wx.EVT_BUTTON, self.on_generate_q_vectors, generateButton) self.Bind(wx.EVT_BUTTON, self.on_generate_q_vectors, generateButton)
......
...@@ -30,10 +30,10 @@ Created on Sep 22, 2015 ...@@ -30,10 +30,10 @@ Created on Sep 22, 2015
''' '''
import wx import wx
import wx.aui as wxaui
from MDANSE import LOGGER, REGISTRY from MDANSE import LOGGER, REGISTRY
from MDANSE.Framework.UserDefinitionStore import UD_STORE from MDANSE.Framework.UserDefinitionStore import UD_STORE
from MDANSE.GUI import PUBLISHER from MDANSE.GUI import PUBLISHER
from MDANSE.GUI.Plugins.ComponentPlugin import ComponentPlugin from MDANSE.GUI.Plugins.ComponentPlugin import ComponentPlugin
...@@ -43,10 +43,14 @@ class UserDefinitionPlugin(ComponentPlugin): ...@@ -43,10 +43,14 @@ class UserDefinitionPlugin(ComponentPlugin):
def __init__(self,parent,*args,**kwargs): def __init__(self,parent,*args,**kwargs):
ComponentPlugin.__init__(self,parent,size=(800,500)) ComponentPlugin.__init__(self,parent,*args,**kwargs)
self.add_ud_panel() self.add_ud_panel()
self._mgr.AddPane(self._mainPanel, wxaui.AuiPaneInfo().DestroyOnClose().Center().Dock().CaptionVisible(False).CloseButton(False).BestSize(self.GetSize()))
self._mgr.Update()
def add_ud_panel(self): def add_ud_panel(self):
udPanel = wx.Panel(self._mainPanel,wx.ID_ANY) udPanel = wx.Panel(self._mainPanel,wx.ID_ANY)
...@@ -82,10 +86,10 @@ class UserDefinitionPlugin(ComponentPlugin): ...@@ -82,10 +86,10 @@ class UserDefinitionPlugin(ComponentPlugin):
return return
if UD_STORE.has_definition(self._target,self._type,name): if UD_STORE.has_definition(self._target,self._type,name):
LOGGER('There is already a user-definition with that name.','error',['dialog']) LOGGER('There is already an user-definition with that name.','error',['dialog'])
return return
UD_STORE.set_definition(self._target,self.type,name,value) UD_STORE.set_definition(self._target,self._type,name,value)
PUBLISHER.sendMessage("msg_set_ud",message=None) PUBLISHER.sendMessage("msg_set_ud",message=None)
......
...@@ -57,6 +57,8 @@ class UserDefinitionDialog(wx.Dialog): ...@@ -57,6 +57,8 @@ class UserDefinitionDialog(wx.Dialog):
self.SetTitle(self._plugin.label) self.SetTitle(self._plugin.label)
self.SetSize(self._plugin.GetSize())
self._plugin.set_trajectory(trajectory) self._plugin.set_trajectory(trajectory)
PUBLISHER.sendMessage("msg_set_data", message=self._plugin) PUBLISHER.sendMessage("msg_set_data", message=self._plugin)
......
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