# HG changeset patch # User GP Orcullo # Date 1666954744 -28800 # Node ID d92c1a3dafa788ca98a9320658c15716f8368319 # Parent 369c7569bf941509896ee84c6c983894b1d2f528 wx fixes for controls diff -r 369c7569bf94 -r d92c1a3dafa7 controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Fri Oct 28 18:54:33 2022 +0800 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Fri Oct 28 18:59:04 2022 +0800 @@ -489,11 +489,12 @@ @param item: Item from which data to export, all items if None (default None) """ - self.ParentWindow.CopyDataToClipboard( - [(item, [entry for entry in item.GetData()]) - for item in (self.Items - if item is None - else [item])]) + if item and item.GetData(): + self.ParentWindow.CopyDataToClipboard( + [(item, [entry for entry in item.GetData()]) + for item in (self.Items + if item is None + else [item])]) def OnZoomFitButton(self): """ @@ -590,7 +591,7 @@ # Search for point that tick is the nearest from mouse X position # and set cursor tick to the tick of this point - if len(data) > 0: + if data and len(data) > 0: cursor_tick = data[numpy.argmin( numpy.abs(data[:, 0] - event.xdata)), 0] diff -r 369c7569bf94 -r d92c1a3dafa7 controls/DebugVariablePanel/DebugVariableTextViewer.py --- a/controls/DebugVariablePanel/DebugVariableTextViewer.py Fri Oct 28 18:54:33 2022 +0800 +++ b/controls/DebugVariablePanel/DebugVariableTextViewer.py Fri Oct 28 18:59:04 2022 +0800 @@ -122,6 +122,8 @@ return True return False + return True + def OnLeave(self): """ Function called when mouse is leave Drop Target diff -r 369c7569bf94 -r d92c1a3dafa7 controls/DebugVariablePanel/DebugVariableViewer.py --- a/controls/DebugVariablePanel/DebugVariableViewer.py Fri Oct 28 18:54:33 2022 +0800 +++ b/controls/DebugVariablePanel/DebugVariableViewer.py Fri Oct 28 18:59:04 2022 +0800 @@ -150,7 +150,7 @@ Function that unsubscribe and remove every item that store values of a variable that doesn't exist in PLC anymore """ - for item in list(self.ItemsDict.values())[:]: + for item in self.ItemsDict.values(): iec_path = item.GetVariable() # Check that variablepath exist in PLC diff -r 369c7569bf94 -r d92c1a3dafa7 controls/VariablePanel.py --- a/controls/VariablePanel.py Fri Oct 28 18:54:33 2022 +0800 +++ b/controls/VariablePanel.py Fri Oct 28 18:59:04 2022 +0800 @@ -424,6 +424,8 @@ return True + return True + def ShowMessage(self, message): message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK | wx.ICON_ERROR) message.ShowModal()