Fix changing characters not udpating stats right away as well as

unlearning not working
This commit is contained in:
cncfanatics
2010-10-29 13:01:26 +02:00
parent 322b372ee8
commit e05ded882c
3 changed files with 17 additions and 8 deletions

View File

@@ -27,6 +27,7 @@ import service
import gui.display as d
from gui.contextMenu import ContextMenu
import sys
import gui.fittingView as fv
CharListUpdated, CHAR_LIST_UPDATED = wx.lib.newevent.NewEvent()
CharChanged, CHAR_CHANGED = wx.lib.newevent.NewEvent()
@@ -67,7 +68,7 @@ class CharacterEditor(wx.Frame):
self.navSizer.Add(self.skillTreeChoice, 1, wx.ALL | wx.EXPAND, 5)
buttons = (("new", wx.ART_NEW), ("copy", wx.ART_COPY), ("rename", bitmapLoader.getBitmap("rename", "icons")), ("delete", wx.ART_DELETE))
size = None
for name, art in buttons:
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) if name != "rename" else art
@@ -157,7 +158,8 @@ class CharacterEditor(wx.Frame):
self.unrestrict()
wx.PostEvent(self, CharChanged())
event.Skip()
if event is not None:
event.Skip()
def getActiveCharacter(self):
selection = self.skillTreeChoice.GetCurrentSelection()
@@ -235,6 +237,16 @@ class CharacterEditor(wx.Frame):
self.restrict()
wx.PostEvent(self, CharChanged())
def Destroy(self):
cFit = service.Fit.getInstance()
fitID = self.mainFrame.getActiveFit()
if fitID is not None:
cFit.clearFit(fitID)
wx.PostEvent(self.mainFrame, fv.FitChanged(fitID=fitID))
wx.Frame.Destroy(self)
class SkillTreeView (wx.Panel):
def __init__(self, parent):
wx.Panel.__init__ (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.TAB_TRAVERSAL)

View File

@@ -139,10 +139,6 @@ class MainFrame(wx.Frame):
dlg=CharacterEditor(self)
dlg.Show()
cFit = service.Fit.getInstance()
cFit.clearFit(self.getActiveFit())
wx.PostEvent(self, fv.FitChanged(fitID=self.getActiveFit()))
def showDamagePatternEditor(self, event):
dlg=DmgPatternEditorDlg(self)
dlg.ShowModal()
@@ -165,7 +161,7 @@ class MainFrame(wx.Frame):
except:
wx.MessageBox("Error importing from file.", "Error", wx.OK | wx.ICON_ERROR, self)
dlg.Destroy()
def _openAfterImport(self, importCount, fitIDs):
if importCount == 1:
if self.getActiveFit() != fitIDs[0]:
@@ -272,7 +268,7 @@ class MainFrame(wx.Frame):
else:
clip.Close()
return None
def backupToXml(self, event):
sFit = service.Fit.getInstance()
saveDialog = wx.FileDialog(

View File

@@ -114,6 +114,7 @@ class Character():
skill = char.getSkill(skillID)
if isinstance(level, basestring):
skill.learned = False
skill.level = None
else:
skill.level = level