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

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):
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):
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)
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -251,10 +251,7 @@ class AtomSelectionPlugin(UserDefinitionPlugin):
self._mainSizer = wx.BoxSizer(wx.VERTICAL)
self._mainSizer.Add(self._mainPanel, 1, wx.EXPAND|wx.ALL, 5)
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_LISTBOX, self.on_insert_keyword_values, self.values)
......@@ -268,9 +265,9 @@ class AtomSelectionPlugin(UserDefinitionPlugin):
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)
......
......@@ -33,7 +33,6 @@ Created on Jun 30, 2015
import os
import wx
import wx.aui as wxaui
from MDANSE import LOGGER, REGISTRY
from MDANSE.GUI.Plugins.UserDefinitionPlugin import UserDefinitionPlugin
......@@ -85,7 +84,7 @@ class AtomsListPlugin(UserDefinitionPlugin):
self._selection = []
UserDefinitionPlugin.__init__(self,parent,size=(800,500))
UserDefinitionPlugin.__init__(self,parent,size=(600,600))
def build_panel(self):
......@@ -139,9 +138,6 @@ class AtomsListPlugin(UserDefinitionPlugin):
self._mainSizer.Add(self._mainPanel, 1, wx.EXPAND|wx.ALL, 5)
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_TREE_BEGIN_DRAG,self.on_add_atom,self._molecules)
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.on_add_atom)
......
......@@ -54,7 +54,7 @@ class JobPlugin(ComponentPlugin):
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):
......@@ -148,9 +148,9 @@ class JobPlugin(ComponentPlugin):
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)
......@@ -162,14 +162,14 @@ class JobFrame(wx.Frame):
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
job = REGISTRY['job'][self._jobType]
self.SetTitle(job.label)
data = REGISTRY['input_data'][job.ancestor[0]](datakey,True)
self.datakey = data.name
......@@ -178,6 +178,8 @@ class JobFrame(wx.Frame):
DATA_CONTROLLER[data.name] = data
plugin = REGISTRY['plugin'][self._jobType](self)
self.SetSize(plugin.GetSize())
PUBLISHER.sendMessage("msg_set_data", message=plugin)
......@@ -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')
app = wx.App(False)
f = JobFrame(None,'dl_poly',filename)
f = JobFrame(None,'dacf',filename)
f.Show()
app.MainLoop()
\ No newline at end of file
......@@ -33,7 +33,6 @@ Created on Jul 2, 2015
import os
import wx
import wx.aui as wxaui
import wx.grid as wxgrid
from MMTK import AtomCluster, Molecule
......@@ -55,7 +54,7 @@ class PartialChargesPlugin(UserDefinitionPlugin):
self._selectedAtoms = []
UserDefinitionPlugin.__init__(self, parent)
UserDefinitionPlugin.__init__(self, parent,size=(600,600))
def build_panel(self):
......@@ -69,12 +68,9 @@ class PartialChargesPlugin(UserDefinitionPlugin):
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):
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()
......
......@@ -191,9 +191,6 @@ class QVectorsPlugin(UserDefinitionPlugin):
sizer.Add(generateButton, 0, wx.ALL|wx.EXPAND, 5)
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(wx.EVT_BUTTON, self.on_generate_q_vectors, generateButton)
......
......@@ -30,10 +30,10 @@ Created on Sep 22, 2015
'''
import wx
import wx.aui as wxaui
from MDANSE import LOGGER, REGISTRY
from MDANSE.Framework.UserDefinitionStore import UD_STORE
from MDANSE.GUI import PUBLISHER
from MDANSE.GUI.Plugins.ComponentPlugin import ComponentPlugin
......@@ -43,10 +43,14 @@ class UserDefinitionPlugin(ComponentPlugin):
def __init__(self,parent,*args,**kwargs):
ComponentPlugin.__init__(self,parent,size=(800,500))
ComponentPlugin.__init__(self,parent,*args,**kwargs)
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):
udPanel = wx.Panel(self._mainPanel,wx.ID_ANY)
......@@ -82,10 +86,10 @@ class UserDefinitionPlugin(ComponentPlugin):
return
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
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)
......
......@@ -57,6 +57,8 @@ class UserDefinitionDialog(wx.Dialog):
self.SetTitle(self._plugin.label)
self.SetSize(self._plugin.GetSize())
self._plugin.set_trajectory(trajectory)
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