editors/CodeFileEditor.py
changeset 1658 ba6a6d6e989c
parent 1556 32e9d0ef30dc
child 1699 65ce8afe4b8f
--- a/editors/CodeFileEditor.py	Thu Mar 09 15:35:19 2017 +0300
+++ b/editors/CodeFileEditor.py	Thu Mar 09 17:29:17 2017 +0300
@@ -757,6 +757,11 @@
     def DoGetBestSize(self):
         return self.ParentWindow.GetPanelBestSize()
 
+    def ShowErrorMessage(self, message):
+        dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
+        dialog.ShowModal()
+        dialog.Destroy()
+
     def OnVariablesGridCellChange(self, event):
         row, col = event.GetRow(), event.GetCol()
         colname = self.Table.GetColLabelValue(col, False)
@@ -780,10 +785,8 @@
             wx.CallAfter(self.RefreshView)
 
         if message is not None:
-            dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
-            dialog.ShowModal()
-            dialog.Destroy()
             event.Veto()
+            wx.CallAfter(self.ShowErrorMessage, message)
         else:
             event.Skip()