IDE: Fix DropTarget() methods that must return a bool with wxPython4. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Fri, 04 Nov 2022 22:14:14 +0100
branchwxPython4
changeset 3660 0e41dbe6ddcd
parent 3659 278dc1144059
child 3665 db7e4952b64f
IDE: Fix DropTarget() methods that must return a bool with wxPython4.
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
controls/DebugVariablePanel/DebugVariablePanel.py
controls/DebugVariablePanel/DebugVariableTextViewer.py
controls/VariablePanel.py
etherlab/ConfigEditor.py
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Fri Nov 04 22:11:55 2022 +0100
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Fri Nov 04 22:14:14 2022 +0100
@@ -166,6 +166,7 @@
         # Display message if data is invalid
         if message is not None:
             wx.CallAfter(self.ShowMessage, message)
+            return False
 
         # Data contain a reference to a variable to debug
         elif values[1] == "debug":
@@ -209,6 +210,8 @@
                     self.ParentWindow.InsertValue(values[0],
                                                   target_idx,
                                                   force=True)
+            return True
+        return False
 
     def OnLeave(self):
         """
--- a/controls/DebugVariablePanel/DebugVariablePanel.py	Fri Nov 04 22:11:55 2022 +0100
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py	Fri Nov 04 22:14:14 2022 +0100
@@ -134,6 +134,7 @@
         # Display message if data is invalid
         if message is not None:
             wx.CallAfter(self.ShowMessage, message)
+            return False
 
         # Data contain a reference to a variable to debug
         elif values[1] == "debug":
@@ -147,6 +148,9 @@
             else:
                 self.ParentWindow.InsertValue(values[0], force=True)
 
+            return True
+        return False
+
     def OnLeave(self):
         """
         Function called when mouse is leave Drop Target
--- a/controls/DebugVariablePanel/DebugVariableTextViewer.py	Fri Nov 04 22:11:55 2022 +0100
+++ b/controls/DebugVariablePanel/DebugVariableTextViewer.py	Fri Nov 04 22:14:14 2022 +0100
@@ -96,6 +96,7 @@
         # Display message if data is invalid
         if message is not None:
             wx.CallAfter(self.ShowMessage, message)
+            return False
 
         # Data contain a reference to a variable to debug
         elif values[1] == "debug":
@@ -118,6 +119,8 @@
                 self.ParentWindow.InsertValue(values[0],
                                               target_idx,
                                               force=True)
+            return True
+        return False
 
     def OnLeave(self):
         """
--- a/controls/VariablePanel.py	Fri Nov 04 22:11:55 2022 +0100
+++ b/controls/VariablePanel.py	Fri Nov 04 22:14:14 2022 +0100
@@ -322,7 +322,7 @@
                                         selected = None
                                     dialog.Destroy()
                                     if selected is None:
-                                        return
+                                        return False
                                     if selected == 0:
                                         location = "%I" + location
                                     elif selected == 1:
@@ -357,7 +357,7 @@
                 var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
                 dlg.Destroy()
                 if var_name is None:
-                    return
+                    return False
                 elif var_name.upper() in [
                         name.upper() for name in
                         self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
@@ -385,7 +385,7 @@
                                 selected = None
                             dialog.Destroy()
                             if selected is None:
-                                return
+                                return False
                             if selected == 0:
                                 location = "%I" + location
                             elif selected == 1:
@@ -396,7 +396,7 @@
                             configs = self.ParentWindow.Controler.GetProjectConfigNames(
                                 self.ParentWindow.Debug)
                             if len(configs) == 0:
-                                return
+                                return False
                             if not var_name.upper() in [
                                     name.upper() for name in
                                     self.ParentWindow.Controler.GetConfigurationVariableNames(configs[0])]:
@@ -414,7 +414,7 @@
                             var_infos.Class = "Local"
                             var_infos.InitialValue = values[0]
                         else:
-                            return
+                            return False
                     else:
                         var_infos.Class = "External"
                     var_infos.Number = len(self.ParentWindow.Values)
@@ -426,6 +426,9 @@
 
         if message is not None:
             wx.CallAfter(self.ShowMessage, message)
+            return False
+
+        return True
 
     def ShowMessage(self, message):
         message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK | wx.ICON_ERROR)
--- a/etherlab/ConfigEditor.py	Fri Nov 04 22:11:55 2022 +0100
+++ b/etherlab/ConfigEditor.py	Fri Nov 04 22:14:14 2022 +0100
@@ -449,6 +449,8 @@
 
         if message is not None:
             wx.CallAfter(self.ShowMessage, message)
+            return False
+        return True
 
     def ShowMessage(self, message):
         message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK | wx.ICON_ERROR)
@@ -501,6 +503,8 @@
 
         if message is not None:
             wx.CallAfter(self.ShowMessage, message)
+            return False
+        return True
 
     def ShowMessage(self, message):
         message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK | wx.ICON_ERROR)