# HG changeset patch # User Laurent Bessard # Date 1370329923 -7200 # Node ID b64dcc1a011f6a7c76b20ba11a5e526e1709d426 # Parent 598ff0043ad30a81692bf6fab14f0ab56dc7fc13 Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel diff -r 598ff0043ad3 -r b64dcc1a011f controls/DebugVariablePanel/DebugVariableGraphicPanel.py --- a/controls/DebugVariablePanel/DebugVariableGraphicPanel.py Mon Jun 03 22:48:42 2013 +0200 +++ b/controls/DebugVariablePanel/DebugVariableGraphicPanel.py Tue Jun 04 09:12:03 2013 +0200 @@ -732,6 +732,8 @@ def InsertValue(self, iec_path, idx = None, force=False, graph=False): for panel in self.GraphicPanels: if panel.GetItem(iec_path) is not None: + if graph and isinstance(panel, DebugVariableTextViewer): + self.ToggleViewerType(panel) return if idx is None: idx = len(self.GraphicPanels) @@ -767,28 +769,31 @@ break if source_panel is not None: source_panel_idx = self.GraphicPanels.index(source_panel) - if len(panel.GetItems()) == 1 and \ - idx in [source_panel_idx, source_panel_idx + 1]: - return - - source_panel.RemoveItem(item) - source_size = source_panel.GetSize() - if item.IsNumVariable() and graph: - panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL) - panel.SetCanvasSize(source_size.width, source_size.height) - if self.CursorTick is not None: - panel.SetCursorTick(self.CursorTick) - - else: - panel = DebugVariableTextViewer(self.GraphicsWindow, self, [item]) - - self.GraphicPanels.insert(idx, panel) - - if source_panel.ItemsIsEmpty(): - if source_panel.HasCapture(): - source_panel.ReleaseMouse() - source_panel.Destroy() - self.GraphicPanels.remove(source_panel) + + if (len(panel.GetItems()) == 1): + + self.GraphicPanels.insert(idx, source_panel) + self.GraphicPanels.pop(source_panel_idx) + + else: + source_panel.RemoveItem(item) + source_size = source_panel.GetSize() + if item.IsNumVariable() and graph: + panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL) + panel.SetCanvasSize(source_size.width, source_size.height) + if self.CursorTick is not None: + panel.SetCursorTick(self.CursorTick) + + else: + panel = DebugVariableTextViewer(self.GraphicsWindow, self, [item]) + + self.GraphicPanels.insert(idx, panel) + + if source_panel.ItemsIsEmpty(): + if source_panel.HasCapture(): + source_panel.ReleaseMouse() + source_panel.Destroy() + self.GraphicPanels.remove(source_panel) self.ResetVariableNameMask() self.RefreshGraphicsSizer() diff -r 598ff0043ad3 -r b64dcc1a011f controls/PouInstanceVariablesPanel.py --- a/controls/PouInstanceVariablesPanel.py Mon Jun 03 22:48:42 2013 +0200 +++ b/controls/PouInstanceVariablesPanel.py Tue Jun 04 09:12:03 2013 +0200 @@ -174,7 +174,7 @@ bitmap=GetBitmap("debug_instance"), size=wx.Size(28, 28), style=wx.NO_BORDER) self.Bind(wx.EVT_BUTTON, self.GenDebugButtonCallback(var_infos), debug_button) - debug_button.Bind(wx.EVT_RIGHT_UP, self.GenDebugButtonRightClickCallback(var_infos)) + debug_button.Bind(wx.EVT_LEFT_DCLICK, self.GenDebugButtonDClickCallback(var_infos)) buttons.append(debug_button) button_num = len(buttons) @@ -280,8 +280,8 @@ event.Skip() return DebugButtonCallback - def GenDebugButtonRightClickCallback(self, infos): - def DebugButtonCallback(event): + def GenDebugButtonDClickCallback(self, infos): + def DebugButtonDClickCallback(event): if self.InstanceChoice.GetSelection() != -1: if infos["class"] in ITEMS_VARIABLE: self.ParentWindow.AddDebugVariable( @@ -290,7 +290,7 @@ force=True, graph=True) event.Skip() - return DebugButtonCallback + return DebugButtonDClickCallback def GenGraphButtonCallback(self, infos): def GraphButtonCallback(event):