Commit d2b02537 authored by eric pellegrini's avatar eric pellegrini
Browse files

Bug fixes in UserDefinitionViewer

parent 39dac300
......@@ -170,24 +170,26 @@ class UserDefinitionViewer(wx.Frame):
currentItemName = str(self._tree.GetItemText(currentItem))
print "on_delete", currentItemName
if level == 1:
UD_STORE.remove_target(currentItemName)
elif level == 2:
targetItem = self._tree.GetParent(currentItem)
targetItem = self._tree.GetItemParent(currentItem)
targetItemName = str(self._tree.GetItemText(targetItem))
UD_STORE.remove_section(targetItemName,currentItemName)
elif level == 3:
sectionItem = self._tree.GetParent(currentItem)
sectionItem = self._tree.GetItemParent(currentItem)
sectionItemName = str(self._tree.GetItemText(sectionItem))
targetItem = self._tree.GetParent(sectionItem)
targetItem = self._tree.GetItemParent(sectionItem)
targetItemName = str(self._tree.GetItemText(targetItem))
UD_STORE.remove_definition(targetItemName,sectionItemName,currentItemName)
else:
return
self._tree.DeleteAllItems()
self._tree.DeleteChildren(currentItem)
self._tree.Delete(currentItem)
self._udTree.clear()
self.build_plugins_tree()
self._info.Clear()
pub.sendMessage("msg_set_ud")
......@@ -216,7 +218,7 @@ class UserDefinitionViewer(wx.Frame):
if not self._editable:
return
currentItem = self._tree.GetSelection()
currentItem = event.GetItem()
currentItemName = str(self._tree.GetItemText(currentItem))
newItemName = self._tree.GetEditControl().GetValue()
......@@ -242,6 +244,6 @@ class UserDefinitionViewer(wx.Frame):
if __name__ == "__main__":
app = wx.App(False)
f = UserDefinitionViewer(None,ud=['protein_in_periodic_universe.nc','atom_selection',"sfdfdfsd"],editable=False)
f = UserDefinitionViewer(None,ud=['protein_in_periodic_universe.nc','atom_selection',"sfdfdfsd"],editable=True)
f.Show()
app.MainLoop()
\ No newline at end of file
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