When opening the character editor, always select the currently used

character by default
This commit is contained in:
cncfanatics
2010-10-30 19:37:06 +02:00
parent f125b5d8f9
commit 4655035d77
3 changed files with 15 additions and 7 deletions

View File

@@ -49,6 +49,7 @@ class CharacterEditor(wx.Frame):
cChar = service.Character.getInstance()
charList = cChar.getCharacterList()
charList.sort(key=lambda t: t[1])
self.btnSave = wx.Button(self, wx.ID_SAVE)
self.btnSave.Hide()
@@ -60,14 +61,17 @@ class CharacterEditor(wx.Frame):
self.skillTreeChoice = wx.Choice(self, wx.ID_ANY, style=0)
for id, name in charList:
self.skillTreeChoice.Append(name, id)
self.skillTreeChoice.SetSelection(0)
for id, name, active in charList:
i = self.skillTreeChoice.Append(name, id)
if active:
self.skillTreeChoice.SetSelection(i)
self.navSizer.Add(self.skillTreeChoice, 1, wx.ALL | wx.EXPAND, 5)
buttons = (("new", wx.ART_NEW), (("rename", bitmapLoader.getBitmap("rename", "icons")), "copy", wx.ART_COPY), ("delete", wx.ART_DELETE))
buttons = (("new", wx.ART_NEW),
("rename", bitmapLoader.getBitmap("rename", "icons")),
("copy", wx.ART_COPY),
("delete", wx.ART_DELETE))
size = None
for name, art in buttons:

View File

@@ -58,7 +58,9 @@ class CharacterSelection(wx.Panel):
activeChar = self.getActiveCharacter()
choice.Clear()
for id, name in cChar.getCharacterList():
charList = cChar.getCharacterList()
cChar.getCharacterList()
for id, name, active in charList:
currId = choice.Append(name, id)
if id == activeChar:
choice.SetSelection(currId)

View File

@@ -20,6 +20,7 @@
import eos.db
import eos.types
import copy
import service
class Character():
instance = None
@@ -42,7 +43,8 @@ class Character():
baseChars = [eos.types.Character.getAll0(), eos.types.Character.getAll5()]
# Flush incase all0 & all5 weren't in the db yet
eos.db.commit()
return map(lambda c: (c.ID, c.name), eos.db.getCharacterList())
sFit = service.Fit.getInstance()
return map(lambda c: (c.ID, c.name, c == sFit.character), eos.db.getCharacterList())
def getSkillGroups(self):
cat = eos.db.getCategory(16)