| 42 | return DmgPatternNameValidator() |
| 43 | |
| 44 | def Validate(self, win): |
| 45 | entityEditor = win.Parent.parent |
| 46 | textCtrl = self.GetWindow() |
| 47 | text = textCtrl.GetValue().strip() |
| 48 | |
| 49 | try: |
| 50 | if len(text) == 0: |
| 51 | raise ValueError(_t("You must supply a name for your Damage Profile!")) |
| 52 | elif text in [x.rawName for x in entityEditor.choices]: |
| 53 | raise ValueError(_t("Damage Profile name already in use, please choose another.")) |
| 54 | |
| 55 | return True |
| 56 | except ValueError as e: |
| 57 | pyfalog.error(e) |
| 58 | wx.MessageBox("{}".format(e), _t("Error")) |
| 59 | textCtrl.SetFocus() |
| 60 | return False |
| 61 | |
| 62 | |
| 63 | class DmgPatternEntityEditor(EntityEditor): |