| 62 | return TargetProfileNameValidator() |
| 63 | |
| 64 | def Validate(self, win): |
| 65 | entityEditor = win.Parent.parent |
| 66 | textCtrl = self.GetWindow() |
| 67 | text = textCtrl.GetValue().strip() |
| 68 | |
| 69 | try: |
| 70 | if len(text) == 0: |
| 71 | raise ValueError(_t("You must supply a name for your Target Profile!")) |
| 72 | elif text in [x.rawName for x in entityEditor.choices]: |
| 73 | raise ValueError(_t("Target Profile name already in use, please choose another.")) |
| 74 | |
| 75 | return True |
| 76 | except ValueError as e: |
| 77 | pyfalog.error(e) |
| 78 | wx.MessageBox("{}".format(e), _t("Error")) |
| 79 | textCtrl.SetFocus() |
| 80 | return False |
| 81 | |
| 82 | |
| 83 | class TargetProfileEntityEditor(EntityEditor): |