MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / ImplantTextValidor

Class ImplantTextValidor

gui/setEditor.py:34–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33_t = wx.GetTranslation
34class ImplantTextValidor(BaseValidator):
35 def __init__(self):
36 BaseValidator.__init__(self)
37
38 def Clone(self):
39 return ImplantTextValidor()
40
41 def Validate(self, win):
42 entityEditor = win.Parent.parent
43 textCtrl = self.GetWindow()
44 text = textCtrl.GetValue().strip()
45
46 try:
47 if len(text) == 0:
48 raise ValueError(_t("You must supply a name for the Implant Set!"))
49 elif text in [x.name for x in entityEditor.choices]:
50 raise ValueError(_t("Implant Set name already in use, please choose another."))
51
52 return True
53 except ValueError as e:
54 pyfalog.error(e)
55 wx.MessageBox("{}".format(e), _t("Error"))
56 textCtrl.SetFocus()
57 return False
58
59
60class ImplantSetEntityEditor(EntityEditor):

Callers 1

CloneMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected