Don't close ForceVariableDialog if user entered wrong new value
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 14 Feb 2019 10:27:24 +0300
changeset 2511 d6e0442a3986
parent 2510 4f78f0e201d9
child 2512 69cef4e37ef9
Don't close ForceVariableDialog if user entered wrong new value

return back to edit field in this case
dialogs/ForceVariableDialog.py
--- a/dialogs/ForceVariableDialog.py	Thu Feb 14 10:19:30 2019 +0300
+++ b/dialogs/ForceVariableDialog.py	Thu Feb 14 10:27:24 2019 +0300
@@ -213,7 +213,12 @@
         self.ValueTextCtrl.SetValue(text(value))
 
     def OnOK(self, event):
+        """
+        Checks new entered value
+        before closing dialog window
+        """
         message = None
+        ret = True
         value = self.ValueTextCtrl.GetValue()
         if value == "":
             message = _("You must type a value!")
@@ -223,9 +228,10 @@
             dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
             dialog.ShowModal()
             dialog.Destroy()
+            ret = False
         else:
             self.EndModal(wx.ID_OK)
-        event.Skip()
+        event.Skip(ret)
 
     def GetValue(self):
         """