Implement copy and delete too
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
import eos.db
|
||||
import eos.types
|
||||
import copy
|
||||
|
||||
class Character():
|
||||
instance = None
|
||||
@@ -68,3 +69,13 @@ class Character():
|
||||
|
||||
def getCharName(self, charID):
|
||||
return eos.db.getCharacter(charID).name
|
||||
|
||||
def copy(self, charID):
|
||||
char = eos.db.getCharacter(charID)
|
||||
newChar = copy.deepcopy(char)
|
||||
eos.db.save(newChar)
|
||||
return newChar.ID
|
||||
|
||||
def delete(self, charID):
|
||||
char = eos.db.getCharacter(charID)
|
||||
eos.db.remove(char)
|
||||
|
||||
@@ -212,10 +212,24 @@ class CharacterEditor (wx.Dialog):
|
||||
self.skillTreeChoice.SetSelection(selection)
|
||||
|
||||
def copy(self, event):
|
||||
pass
|
||||
cChar = controller.Character.getInstance()
|
||||
charID = cChar.copy(self.getActiveCharacter())
|
||||
id = self.skillTreeChoice.Append(cChar.getCharName(charID), charID)
|
||||
self.skillTreeChoice.SetSelection(id)
|
||||
self.btnDelete.Enable(True)
|
||||
self.btnRename.Enable(True)
|
||||
self.rename(event)
|
||||
|
||||
def delete(self, event):
|
||||
pass
|
||||
cChar = controller.Character.getInstance()
|
||||
cChar.delete(self.getActiveCharacter())
|
||||
sel = self.skillTreeChoice.GetSelection()
|
||||
self.skillTreeChoice.Delete(sel)
|
||||
self.skillTreeChoice.SetSelection(sel - 1)
|
||||
newSelection = self.getActiveCharacter()
|
||||
if cChar.getCharName(newSelection) in ("All 0", "All 5"):
|
||||
self.btnDelete.Enable(False)
|
||||
self.btnRename.Enable(False)
|
||||
|
||||
class SkillTreeView (wx.Panel):
|
||||
def __init__(self, parent):
|
||||
|
||||
Reference in New Issue
Block a user