Commit 9e59725f authored by eric pellegrini's avatar eric pellegrini
Browse files

Bug fix when saving UD for a few UD based plugins

parent bbe06f94
......@@ -63,10 +63,15 @@ class AtomTransmutationPlugin(AtomSelectionPlugin):
element = self._elements.GetStringSelection()
self._ud['element'] = element
self._ud['indexes'] = self._selection
if not element:
LOGGER("No target element selected to be transmutated to", "error", ["dialog"])
return None
ud = {}
ud['element'] = element
ud['indexes'] = self._selection
return self._ud
return ud
class AtomTransmutationWidget(UserDefinitionWidget):
......
......@@ -270,10 +270,8 @@ class AtomsListPlugin(UDPlugin):
if not self._selection:
LOGGER("The current selection is empty", "error", ["dialog"])
return None
self._ud['indexes'] = self._selection
return self._ud
return {'indexes' : self._selection}
class AtomListWidget(UserDefinitionWidget):
......
......@@ -193,10 +193,6 @@ class QVectorsPlugin(UDPlugin):
self._mainPanel.SetSizer(sizer)
# self._mainSizer = wx.BoxSizer(wx.VERTICAL)
# self._mainSizer.Add(self._mainPanel, 1, wx.ALL|wx.EXPAND, 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()
......@@ -226,23 +222,6 @@ class QVectorsPlugin(UDPlugin):
self._availableGenerators.SetSelection(0)
self.select_generator(self._availableGenerators.GetStringSelection())
def set_user_definition(self):
if self._notebook.GetPageCount() == 0:
LOGGER("No Q vectors generated.", "error")
return
qPanel = self._notebook.GetPage(self._notebook.GetSelection())
if qPanel._grid.GetTable().data is None:
LOGGER("No data is the selected Q vectors tab", "error")
return
self._ud['parameters'] = (qPanel.generator.type,qPanel.parameters)
self._ud['generator'] = qPanel.generator.type
self._ud['q_vectors'] = qPanel.grid.GetTable().data
self._ud['is_lattice'] = qPanel.generator.is_lattice
def on_close(self, event):
......@@ -281,7 +260,7 @@ class QVectorsPlugin(UDPlugin):
parameters = self._configurationPanel.get_value()
generator.setup(parameters)
qPanel = QVectorsPanel(generator,parameters,self._panel,wx.ID_ANY)
qPanel = QVectorsPanel(generator,parameters,self._mainPanel,wx.ID_ANY)
self._notebook.AddPage(qPanel, "Q Vectors")
generator.setStatus(qPanel.progress)
......@@ -294,13 +273,27 @@ class QVectorsPlugin(UDPlugin):
def validate(self):
self.set_user_definition()
if self._notebook.GetPageCount() == 0:
LOGGER("No Q vectors generated.", "error")
return
qPanel = self._notebook.GetPage(self._notebook.GetSelection())
if qPanel._grid.GetTable().data is None:
LOGGER("No data is the selected Q vectors tab", "error")
return
ud = {}
ud['parameters'] = (qPanel.generator.type,qPanel.parameters)
ud['generator'] = qPanel.generator.type
ud['q_vectors'] = qPanel.grid.GetTable().data
ud['is_lattice'] = qPanel.generator.is_lattice
if not self._ud['q_vectors']:
if not ud['q_vectors']:
LOGGER("No Q vectors generated.", "error", ["dialog"])
return None
return self._ud
return ud
def select_generator(self, generatorName):
......
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