Fix issue with entity editor and wxPython 2.8

This commit is contained in:
blitzmann
2016-06-28 23:24:01 -04:00
parent cdca8fe236
commit b9f0812b38
5 changed files with 12 additions and 11 deletions

View File

@@ -98,7 +98,8 @@ class EntityEditor (wx.Panel):
dlg.CenterOnParent()
if dlg.ShowModal() == wx.ID_OK:
new = self.DoNew(dlg.GetValue().strip())
# using dlg.textctrl.GetValue instead of simply dlg.GetValue because the proper way does not work in wxPython 2.8
new = self.DoNew(dlg.txtctrl.GetValue().strip())
self.refreshEntityList(new)
wx.PostEvent(self.entityChoices, wx.CommandEvent(wx.wxEVT_COMMAND_CHOICE_SELECTED))
else:
@@ -114,7 +115,7 @@ class EntityEditor (wx.Panel):
dlg.CenterOnParent()
if dlg.ShowModal() == wx.ID_OK:
copy = self.DoCopy(active, dlg.GetValue().strip())
copy = self.DoCopy(active, dlg.txtctrl.GetValue().strip())
self.refreshEntityList(copy)
wx.PostEvent(self.entityChoices, wx.CommandEvent(wx.wxEVT_COMMAND_CHOICE_SELECTED))
@@ -128,7 +129,7 @@ class EntityEditor (wx.Panel):
dlg.CenterOnParent()
if dlg.ShowModal() == wx.ID_OK:
self.DoRename(active, dlg.GetValue().strip())
self.DoRename(active, dlg.txtctrl.GetValue().strip())
self.refreshEntityList(active)
wx.PostEvent(self.entityChoices, wx.CommandEvent(wx.wxEVT_COMMAND_CHOICE_SELECTED))

View File

@@ -37,14 +37,14 @@ class CharacterTextValidor(BaseValidator):
return CharacterTextValidor()
def Validate(self, win):
profileEditor = win.Parent
entityEditor = win.parent
textCtrl = self.GetWindow()
text = textCtrl.GetValue().strip()
try:
if len(text) == 0:
raise ValueError("You must supply a name for the Character!")
elif text in [x.name for x in profileEditor.entityEditor.choices]:
elif text in [x.name for x in entityEditor.choices]:
raise ValueError("Character name already in use, please choose another.")
return True

View File

@@ -36,14 +36,14 @@ class DmgPatternTextValidor(BaseValidator):
return DmgPatternTextValidor()
def Validate(self, win):
profileEditor = win.Parent
entityEditor = win.parent
textCtrl = self.GetWindow()
text = textCtrl.GetValue().strip()
try:
if len(text) == 0:
raise ValueError("You must supply a name for your Damage Profile!")
elif text in [x.name for x in profileEditor.entityEditor.choices]:
elif text in [x.name for x in entityEditor.choices]:
raise ValueError("Damage Profile name already in use, please choose another.")
return True

View File

@@ -33,14 +33,14 @@ class TargetResistsTextValidor(BaseValidator):
return TargetResistsTextValidor()
def Validate(self, win):
profileEditor = win.parent.Parent
entityEditor = win.parent
textCtrl = self.GetWindow()
text = textCtrl.GetValue().strip()
try:
if len(text) == 0:
raise ValueError("You must supply a name for your Target Resist Profile!")
elif text in [x.name for x in profileEditor.entityEditor.choices]:
elif text in [x.name for x in entityEditor.choices]:
raise ValueError("Target Resist Profile name already in use, please choose another.")
return True

View File

@@ -36,14 +36,14 @@ class ImplantTextValidor(BaseValidator):
return ImplantTextValidor()
def Validate(self, win):
profileEditor = win.parent.Parent
entityEditor = win.parent
textCtrl = self.GetWindow()
text = textCtrl.GetValue().strip()
try:
if len(text) == 0:
raise ValueError("You must supply a name for the Implant Set!")
elif text in [x.name for x in profileEditor.entityEditor.choices]:
elif text in [x.name for x in entityEditor.choices]:
raise ValueError("Imlplant Set name already in use, please choose another.")
return True