| 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 | |
| 60 | class ImplantSetEntityEditor(EntityEditor): |