Laurent@814: #!/usr/bin/env python Laurent@814: # -*- coding: utf-8 -*- Laurent@814: andrej@1571: # This file is part of Beremiz, a Integrated Development Environment for andrej@1571: # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. Laurent@814: # andrej@1571: # Copyright (C) 2012: Edouard TISSERANT and Laurent BESSARD Laurent@814: # andrej@1571: # See COPYING file for copyrights details. Laurent@814: # andrej@1571: # This program is free software; you can redistribute it and/or andrej@1571: # modify it under the terms of the GNU General Public License andrej@1571: # as published by the Free Software Foundation; either version 2 andrej@1571: # of the License, or (at your option) any later version. Laurent@814: # andrej@1571: # This program is distributed in the hope that it will be useful, andrej@1571: # but WITHOUT ANY WARRANTY; without even the implied warranty of andrej@1571: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the andrej@1571: # GNU General Public License for more details. Laurent@814: # andrej@1571: # You should have received a copy of the GNU General Public License andrej@1571: # along with this program; if not, write to the Free Software andrej@1571: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Laurent@814: andrej@1853: andrej@1853: from __future__ import absolute_import Laurent@1198: from types import TupleType Laurent@887: import numpy Laurent@814: Laurent@814: import wx Laurent@814: import wx.lib.buttons Laurent@888: Laurent@1198: import matplotlib andrej@1783: matplotlib.use('WX') # noqa Laurent@1198: import matplotlib.pyplot Laurent@1198: from matplotlib.backends.backend_wxagg import _convert_agg_to_wx_bitmap Laurent@1200: andrej@1783: Laurent@1200: from editors.DebugViewer import DebugViewer Laurent@814: from util.BitmapLibrary import GetBitmap Laurent@814: andrej@1853: from controls.DebugVariablePanel.DebugVariableItem import DebugVariableItem andrej@1853: from controls.DebugVariablePanel.DebugVariableTextViewer import DebugVariableTextViewer andrej@1853: from controls.DebugVariablePanel.DebugVariableGraphicViewer import * Laurent@1199: andrej@1783: andrej@1737: MILLISECOND = 1000000 # Number of nanosecond in a millisecond andrej@1737: SECOND = 1000 * MILLISECOND # Number of nanosecond in a second andrej@1737: MINUTE = 60 * SECOND # Number of nanosecond in a minute andrej@1737: HOUR = 60 * MINUTE # Number of nanosecond in a hour andrej@1737: DAY = 24 * HOUR # Number of nanosecond in a day Laurent@1215: Laurent@1215: # List of values possible for graph range Laurent@1215: # Format is [(time_in_plain_text, value_in_nanosecond),...] Laurent@1215: RANGE_VALUES = \ andrej@1578: [(_("%dms") % i, i * MILLISECOND) for i in (10, 20, 50, 100, 200, 500)] + \ andrej@1578: [(_("%ds") % i, i * SECOND) for i in (1, 2, 5, 10, 20, 30)] + \ andrej@1578: [(_("%dm") % i, i * MINUTE) for i in (1, 2, 5, 10, 20, 30)] + \ andrej@1578: [(_("%dh") % i, i * HOUR) for i in (1, 2, 3, 6, 12, 24)] Laurent@1215: Laurent@1215: # Scrollbar increment in pixel Laurent@1215: SCROLLBAR_UNIT = 10 Laurent@1215: andrej@1736: Laurent@1215: def compute_mask(x, y): Laurent@1215: return [(xp if xp == yp else "*") Laurent@1215: for xp, yp in zip(x, y)] Laurent@1215: andrej@1736: Laurent@1215: def NextTick(variables): Laurent@1215: next_tick = None andrej@1847: for _item, data in variables: Laurent@1215: if len(data) == 0: Laurent@1215: continue andrej@1730: Laurent@1231: next_tick = (data[0][0] Laurent@1231: if next_tick is None Laurent@1231: else min(next_tick, data[0][0])) andrej@1730: Laurent@1215: return next_tick Laurent@1215: andrej@1782: # ------------------------------------------------------------------------------- Laurent@1215: # Debug Variable Graphic Panel Drop Target andrej@1782: # ------------------------------------------------------------------------------- Laurent@1215: Laurent@1215: Laurent@814: class DebugVariableDropTarget(wx.TextDropTarget): andrej@1736: """ andrej@1736: Class that implements a custom drop target class for Debug Variable Graphic andrej@1736: Panel andrej@1736: """ andrej@1730: Laurent@1215: def __init__(self, window): Laurent@1215: """ Laurent@1215: Constructor Laurent@1215: @param window: Reference to the Debug Variable Panel Laurent@1215: """ Laurent@814: wx.TextDropTarget.__init__(self) Laurent@1215: self.ParentWindow = window andrej@1730: Laurent@916: def __del__(self): Laurent@1215: """ Laurent@1215: Destructor Laurent@1215: """ Laurent@1215: # Remove reference to Debug Variable Panel Laurent@916: self.ParentWindow = None andrej@1730: Laurent@928: def OnDragOver(self, x, y, d): Laurent@1215: """ Laurent@1215: Function called when mouse is dragged over Drop Target Laurent@1215: @param x: X coordinate of mouse pointer Laurent@1215: @param y: Y coordinate of mouse pointer Laurent@1215: @param d: Suggested default for return value Laurent@1215: """ andrej@1770: # Signal Debug Variable Panel to refresh highlight giving mouse position Laurent@1200: self.ParentWindow.RefreshHighlight(x, y) Laurent@928: return wx.TextDropTarget.OnDragOver(self, x, y, d) andrej@1730: Laurent@814: def OnDropText(self, x, y, data): Laurent@1215: """ Laurent@1215: Function called when mouse is released in Drop Target Laurent@1215: @param x: X coordinate of mouse pointer Laurent@1215: @param y: Y coordinate of mouse pointer Laurent@1215: @param data: Text associated to drag'n drop Laurent@1215: """ Laurent@1218: # Signal Debug Variable Panel to reset highlight Laurent@1218: self.ParentWindow.ResetHighlight() andrej@1730: Laurent@814: message = None andrej@1730: Laurent@1215: # Check that data is valid regarding DebugVariablePanel Laurent@814: try: Laurent@814: values = eval(data) Laurent@1200: if not isinstance(values, TupleType): Laurent@1207: raise ValueError andrej@1780: except Exception: andrej@1734: message = _("Invalid value \"%s\" for debug variable") % data Laurent@814: values = None andrej@1730: Laurent@1215: # Display message if data is invalid Laurent@814: if message is not None: Laurent@814: wx.CallAfter(self.ShowMessage, message) andrej@1730: Laurent@1215: # Data contain a reference to a variable to debug Laurent@1200: elif values[1] == "debug": andrej@1730: Laurent@1215: # Drag'n Drop is an internal is an internal move inside Debug andrej@1730: # Variable Panel Laurent@1200: if len(values) > 2 and values[2] == "move": Laurent@945: self.ParentWindow.MoveValue(values[0]) andrej@1730: Laurent@1215: # Drag'n Drop was initiated by another control of Beremiz Laurent@945: else: Laurent@945: self.ParentWindow.InsertValue(values[0], force=True) andrej@1730: Laurent@928: def OnLeave(self): Laurent@1215: """ Laurent@1215: Function called when mouse is leave Drop Target Laurent@1215: """ Laurent@1215: # Signal Debug Variable Panel to reset highlight Laurent@1198: self.ParentWindow.ResetHighlight() Laurent@928: return wx.TextDropTarget.OnLeave(self) andrej@1730: Laurent@814: def ShowMessage(self, message): Laurent@1215: """ Laurent@1215: Show error message in Error Dialog Laurent@1215: @param message: Error message to display Laurent@1215: """ andrej@1730: dialog = wx.MessageDialog(self.ParentWindow, andrej@1730: message, andrej@1730: _("Error"), andrej@1745: wx.OK | wx.ICON_ERROR) Laurent@814: dialog.ShowModal() Laurent@814: dialog.Destroy() Laurent@814: Laurent@1215: Laurent@1364: class DebugVariablePanel(wx.Panel, DebugViewer): andrej@1736: """ andrej@1736: Class that implements a Viewer that display variable values as a graphs andrej@1736: """ andrej@1730: Laurent@902: def __init__(self, parent, producer, window): Laurent@1215: """ Laurent@1215: Constructor Laurent@1215: @param parent: Reference to the parent wx.Window Laurent@1215: @param producer: Object receiving debug value and dispatching them to Laurent@1215: consumers Laurent@1215: @param window: Reference to Beremiz frame Laurent@1215: """ andrej@1745: wx.Panel.__init__(self, parent, style=wx.SP_3D | wx.TAB_TRAVERSAL) andrej@1730: Laurent@1215: # Save Reference to Beremiz frame Laurent@902: self.ParentWindow = window andrej@1730: Laurent@1215: # Variable storing flag indicating that variable displayed in table Laurent@1215: # received new value and then table need to be refreshed Laurent@814: self.HasNewData = False andrej@1730: Laurent@1215: # Variable storing flag indicating that refresh has been forced, and Laurent@1215: # that next time refresh is possible, it will be done even if no new Laurent@1215: # data is available Laurent@1008: self.Force = False andrej@1730: Laurent@1198: self.SetBackgroundColour(wx.WHITE) andrej@1730: Laurent@1198: main_sizer = wx.BoxSizer(wx.VERTICAL) andrej@1730: andrej@1737: self.Ticks = numpy.array([]) # List of tick received andrej@1737: self.StartTick = 0 # Tick starting range of data displayed andrej@1737: self.Fixed = False # Flag that range of data is fixed andrej@1737: self.CursorTick = None # Tick of cursor for displaying values andrej@1730: Laurent@1198: self.DraggingAxesPanel = None Laurent@1198: self.DraggingAxesBoundingBox = None Laurent@1198: self.DraggingAxesMousePos = None Laurent@1198: self.VetoScrollEvent = False andrej@1730: Laurent@1198: self.VariableNameMask = [] andrej@1730: Laurent@1198: self.GraphicPanels = [] andrej@1730: Laurent@1198: graphics_button_sizer = wx.BoxSizer(wx.HORIZONTAL) andrej@1745: main_sizer.AddSizer(graphics_button_sizer, border=5, flag=wx.GROW | wx.ALL) andrej@1730: Laurent@1198: range_label = wx.StaticText(self, label=_('Range:')) Laurent@1198: graphics_button_sizer.AddWindow(range_label, flag=wx.ALIGN_CENTER_VERTICAL) andrej@1730: Laurent@1198: self.CanvasRange = wx.ComboBox(self, style=wx.CB_READONLY) Laurent@1198: self.Bind(wx.EVT_COMBOBOX, self.OnRangeChanged, self.CanvasRange) andrej@1730: graphics_button_sizer.AddWindow(self.CanvasRange, 1, andrej@1768: border=5, andrej@1768: flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) andrej@1730: Laurent@1198: self.CanvasRange.Clear() Laurent@1198: default_range_idx = 0 andrej@1847: for idx, (text, _value) in enumerate(RANGE_VALUES): Laurent@1198: self.CanvasRange.Append(text) Laurent@1198: if text == "1s": Laurent@1198: default_range_idx = idx Laurent@1198: self.CanvasRange.SetSelection(default_range_idx) andrej@1730: Laurent@1198: for name, bitmap, help in [ andrej@1766: ("CurrentButton", "current", _("Go to current value")), andrej@1766: ("ExportGraphButton", "export_graph", _("Export graph values to clipboard"))]: andrej@1768: button = wx.lib.buttons.GenBitmapButton( andrej@1768: self, bitmap=GetBitmap(bitmap), andrej@1768: size=wx.Size(28, 28), style=wx.NO_BORDER) Laurent@1198: button.SetToolTipString(help) Laurent@1198: setattr(self, name, button) Laurent@1198: self.Bind(wx.EVT_BUTTON, getattr(self, "On" + name), button) Laurent@1198: graphics_button_sizer.AddWindow(button, border=5, flag=wx.LEFT) andrej@1730: andrej@1768: self.CanvasPosition = wx.ScrollBar( andrej@1768: self, size=wx.Size(0, 16), style=wx.SB_HORIZONTAL) andrej@1730: self.CanvasPosition.Bind(wx.EVT_SCROLL_THUMBTRACK, andrej@1768: self.OnPositionChanging, self.CanvasPosition) andrej@1730: self.CanvasPosition.Bind(wx.EVT_SCROLL_LINEUP, andrej@1768: self.OnPositionChanging, self.CanvasPosition) andrej@1730: self.CanvasPosition.Bind(wx.EVT_SCROLL_LINEDOWN, andrej@1768: self.OnPositionChanging, self.CanvasPosition) andrej@1730: self.CanvasPosition.Bind(wx.EVT_SCROLL_PAGEUP, andrej@1768: self.OnPositionChanging, self.CanvasPosition) andrej@1730: self.CanvasPosition.Bind(wx.EVT_SCROLL_PAGEDOWN, andrej@1768: self.OnPositionChanging, self.CanvasPosition) andrej@1745: main_sizer.AddWindow(self.CanvasPosition, border=5, flag=wx.GROW | wx.LEFT | wx.RIGHT | wx.BOTTOM) andrej@1730: Laurent@1198: self.TickSizer = wx.BoxSizer(wx.HORIZONTAL) andrej@1745: main_sizer.AddSizer(self.TickSizer, border=5, flag=wx.ALL | wx.GROW) andrej@1730: Laurent@1198: self.TickLabel = wx.StaticText(self) Laurent@1198: self.TickSizer.AddWindow(self.TickLabel, border=5, flag=wx.RIGHT) andrej@1730: andrej@1745: self.MaskLabel = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_CENTER | wx.NO_BORDER) andrej@1745: self.TickSizer.AddWindow(self.MaskLabel, 1, border=5, flag=wx.RIGHT | wx.GROW) andrej@1730: Laurent@1198: self.TickTimeLabel = wx.StaticText(self) Laurent@1198: self.TickSizer.AddWindow(self.TickTimeLabel) andrej@1730: andrej@1745: self.GraphicsWindow = wx.ScrolledWindow(self, style=wx.HSCROLL | wx.VSCROLL) Laurent@1198: self.GraphicsWindow.SetBackgroundColour(wx.WHITE) Laurent@1198: self.GraphicsWindow.SetDropTarget(DebugVariableDropTarget(self)) Laurent@1198: self.GraphicsWindow.Bind(wx.EVT_ERASE_BACKGROUND, self.OnGraphicsWindowEraseBackground) Laurent@1198: self.GraphicsWindow.Bind(wx.EVT_PAINT, self.OnGraphicsWindowPaint) Laurent@1198: self.GraphicsWindow.Bind(wx.EVT_SIZE, self.OnGraphicsWindowResize) Laurent@1198: self.GraphicsWindow.Bind(wx.EVT_MOUSEWHEEL, self.OnGraphicsWindowMouseWheel) andrej@1730: Laurent@1198: main_sizer.AddWindow(self.GraphicsWindow, 1, flag=wx.GROW) andrej@1730: Laurent@1198: self.GraphicsSizer = wx.BoxSizer(wx.VERTICAL) Laurent@1198: self.GraphicsWindow.SetSizer(self.GraphicsSizer) andrej@1730: Laurent@1192: DebugViewer.__init__(self, producer, True) andrej@1730: Laurent@916: self.SetSizer(main_sizer) andrej@1520: self.SetTickTime() andrej@1730: Laurent@1192: def SetTickTime(self, ticktime=0): Laurent@1215: """ Laurent@1215: Set Ticktime for calculate data range according to time range selected Laurent@1215: @param ticktime: Ticktime to apply to range (default: 0) Laurent@1215: """ Laurent@1215: # Save ticktime Laurent@1198: self.Ticktime = ticktime andrej@1730: Laurent@1215: # Set ticktime to millisecond if undefined Laurent@1198: if self.Ticktime == 0: Laurent@1198: self.Ticktime = MILLISECOND andrej@1730: Laurent@1215: # Calculate range to apply to data Laurent@1198: self.CurrentRange = RANGE_VALUES[ Laurent@1198: self.CanvasRange.GetSelection()][1] / self.Ticktime andrej@1730: Laurent@902: def SetDataProducer(self, producer): Laurent@1215: """ Laurent@1215: Set Data Producer Laurent@1215: @param producer: Data Producer Laurent@1215: """ Laurent@902: DebugViewer.SetDataProducer(self, producer) andrej@1730: Laurent@1215: # Set ticktime if data producer is available Laurent@1198: if self.DataProducer is not None: Laurent@1198: self.SetTickTime(self.DataProducer.GetTicktime()) andrej@1730: Edouard@1431: def RefreshNewData(self): Laurent@1215: """ Laurent@1215: Called to refresh Panel according to values received by variables Laurent@1215: Can receive any parameters (not used here) Laurent@1215: """ Laurent@1215: # Refresh graphs if new data is available or refresh is forced Laurent@902: if self.HasNewData or self.Force: Laurent@814: self.HasNewData = False Laurent@1198: self.RefreshView() andrej@1730: Edouard@1431: DebugViewer.RefreshNewData(self) andrej@1730: Edouard@1431: def NewDataAvailable(self, ticks): Laurent@1215: """ Laurent@1215: Called by DataProducer for each tick captured or by panel to refresh Laurent@1215: graphs Laurent@1215: @param tick: PLC tick captured andrej@1730: All other parameters are passed to refresh function Laurent@1215: """ Laurent@1215: # If tick given Laurent@1363: if ticks is not None: Laurent@1363: tick = ticks[-1] andrej@1730: Laurent@1215: # Save tick as start tick for range if data is still empty Laurent@927: if len(self.Ticks) == 0: Laurent@1363: self.StartTick = ticks[0] andrej@1730: Laurent@1215: # Add tick to list of ticks received Laurent@1363: self.Ticks = numpy.append(self.Ticks, ticks) andrej@1730: Laurent@1215: # Update start tick for range if range follow ticks received Laurent@902: if not self.Fixed or tick < self.StartTick + self.CurrentRange: Laurent@902: self.StartTick = max(self.StartTick, tick - self.CurrentRange) andrej@1730: Laurent@1215: # Force refresh if graph is fixed because range of data received Laurent@1215: # is too small to fill data range selected Laurent@1215: if self.Fixed and \ Laurent@1215: self.Ticks[-1] - self.Ticks[0] < self.CurrentRange: Laurent@928: self.Force = True andrej@1730: Laurent@1363: self.HasNewData = False Laurent@1363: self.RefreshView() andrej@1730: Laurent@1363: else: Edouard@1431: DebugViewer.NewDataAvailable(self, ticks) andrej@1730: Laurent@924: def ForceRefresh(self): Laurent@1215: """ Laurent@1215: Called to force refresh of graphs Laurent@1215: """ Laurent@924: self.Force = True Edouard@1431: wx.CallAfter(self.NewDataAvailable, None) andrej@1730: Laurent@928: def SetCursorTick(self, cursor_tick): Laurent@1227: """ Laurent@1227: Set Cursor for displaying values of items at a tick given Laurent@1227: @param cursor_tick: Tick of cursor Laurent@1227: """ Laurent@1227: # Save cursor tick Laurent@928: self.CursorTick = cursor_tick Laurent@1209: self.Fixed = cursor_tick is not None andrej@1730: self.UpdateCursorTick() andrej@1730: Laurent@1174: def MoveCursorTick(self, move): Laurent@1174: if self.CursorTick is not None: andrej@1730: cursor_tick = max(self.Ticks[0], andrej@1768: min(self.CursorTick + move, self.Ticks[-1])) Laurent@1192: cursor_tick_idx = numpy.argmin(numpy.abs(self.Ticks - cursor_tick)) Laurent@1192: if self.Ticks[cursor_tick_idx] == self.CursorTick: andrej@1730: cursor_tick_idx = max(0, andrej@1768: min(cursor_tick_idx + abs(move) / move, andrej@1768: len(self.Ticks) - 1)) Laurent@1192: self.CursorTick = self.Ticks[cursor_tick_idx] andrej@1768: self.StartTick = max( andrej@1768: self.Ticks[numpy.argmin( andrej@1768: numpy.abs(self.Ticks - self.CursorTick + self.CurrentRange))], andrej@1768: min(self.StartTick, self.CursorTick)) Laurent@1174: self.RefreshCanvasPosition() andrej@1730: self.UpdateCursorTick() andrej@1730: Laurent@928: def ResetCursorTick(self): Laurent@928: self.CursorTick = None Laurent@1227: self.Fixed = False Laurent@1084: self.UpdateCursorTick() andrej@1730: Laurent@1084: def UpdateCursorTick(self): Laurent@924: for panel in self.GraphicPanels: Laurent@1200: if isinstance(panel, DebugVariableGraphicViewer): Laurent@928: panel.SetCursorTick(self.CursorTick) Laurent@928: self.ForceRefresh() andrej@1730: Laurent@929: def StartDragNDrop(self, panel, item, x_mouse, y_mouse, x_mouse_start, y_mouse_start): Laurent@929: if len(panel.GetItems()) > 1: Laurent@1200: self.DraggingAxesPanel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL) Laurent@929: self.DraggingAxesPanel.SetCursorTick(self.CursorTick) Laurent@929: width, height = panel.GetSize() Laurent@943: self.DraggingAxesPanel.SetSize(wx.Size(width, height)) Laurent@1044: self.DraggingAxesPanel.ResetGraphics() Laurent@929: self.DraggingAxesPanel.SetPosition(wx.Point(0, -height)) Laurent@929: else: Laurent@929: self.DraggingAxesPanel = panel Laurent@1212: self.DraggingAxesBoundingBox = panel.GetAxesBoundingBox(parent_coordinate=True) Laurent@925: self.DraggingAxesMousePos = wx.Point( andrej@1730: x_mouse_start - self.DraggingAxesBoundingBox.x, Laurent@928: y_mouse_start - self.DraggingAxesBoundingBox.y) Laurent@928: self.MoveDragNDrop(x_mouse, y_mouse) andrej@1730: Laurent@925: def MoveDragNDrop(self, x_mouse, y_mouse): Laurent@925: self.DraggingAxesBoundingBox.x = x_mouse - self.DraggingAxesMousePos.x Laurent@925: self.DraggingAxesBoundingBox.y = y_mouse - self.DraggingAxesMousePos.y Laurent@934: self.RefreshHighlight(x_mouse, y_mouse) andrej@1730: Laurent@934: def RefreshHighlight(self, x_mouse, y_mouse): Laurent@929: for idx, panel in enumerate(self.GraphicPanels): Laurent@928: x, y = panel.GetPosition() Laurent@943: width, height = panel.GetSize() Laurent@928: rect = wx.Rect(x, y, width, height) andrej@1766: if rect.InsideXY(x_mouse, y_mouse) or \ andrej@1766: idx == 0 and y_mouse < 0 or \ andrej@1766: idx == len(self.GraphicPanels) - 1 and y_mouse > panel.GetPosition()[1]: Laurent@1200: panel.RefreshHighlight(x_mouse - x, y_mouse - y) Laurent@943: else: Laurent@943: panel.SetHighlight(HIGHLIGHT_NONE) Laurent@962: if wx.Platform == "__WXMSW__": Laurent@962: self.RefreshView() Laurent@962: else: Laurent@962: self.ForceRefresh() andrej@1730: Laurent@934: def ResetHighlight(self): Laurent@934: for panel in self.GraphicPanels: Laurent@943: panel.SetHighlight(HIGHLIGHT_NONE) Laurent@962: if wx.Platform == "__WXMSW__": Laurent@962: self.RefreshView() Laurent@962: else: Laurent@962: self.ForceRefresh() andrej@1730: Laurent@925: def IsDragging(self): Laurent@925: return self.DraggingAxesPanel is not None andrej@1730: Laurent@925: def GetDraggingAxesClippingRegion(self, panel): Laurent@925: x, y = panel.GetPosition() Laurent@943: width, height = panel.GetSize() Laurent@925: bbox = wx.Rect(x, y, width, height) Laurent@925: bbox = bbox.Intersect(self.DraggingAxesBoundingBox) Laurent@925: bbox.x -= x Laurent@925: bbox.y -= y Laurent@925: return bbox andrej@1730: Laurent@943: def GetDraggingAxesPosition(self, panel): Laurent@943: x, y = panel.GetPosition() Laurent@943: return wx.Point(self.DraggingAxesBoundingBox.x - x, Laurent@943: self.DraggingAxesBoundingBox.y - y) andrej@1730: Laurent@925: def StopDragNDrop(self, variable, x_mouse, y_mouse): Laurent@943: if self.DraggingAxesPanel not in self.GraphicPanels: Laurent@943: self.DraggingAxesPanel.Destroy() Laurent@925: self.DraggingAxesPanel = None Laurent@925: self.DraggingAxesBoundingBox = None Laurent@925: self.DraggingAxesMousePos = None Laurent@925: for idx, panel in enumerate(self.GraphicPanels): Laurent@943: panel.SetHighlight(HIGHLIGHT_NONE) Laurent@925: xw, yw = panel.GetPosition() Laurent@943: width, height = panel.GetSize() Laurent@925: bbox = wx.Rect(xw, yw, width, height) Laurent@925: if bbox.InsideXY(x_mouse, y_mouse): Laurent@943: panel.ShowButtons(True) Laurent@925: merge_type = GRAPH_PARALLEL Laurent@1200: if isinstance(panel, DebugVariableTextViewer) or panel.Is3DCanvas(): Laurent@925: if y_mouse > yw + height / 2: Laurent@925: idx += 1 Laurent@1214: wx.CallAfter(self.MoveValue, variable, idx, True) Laurent@925: else: Laurent@925: rect = panel.GetAxesBoundingBox(True) Laurent@925: if rect.InsideXY(x_mouse, y_mouse): Laurent@925: merge_rect = wx.Rect(rect.x, rect.y, rect.width / 2., rect.height) Laurent@925: if merge_rect.InsideXY(x_mouse, y_mouse): Laurent@925: merge_type = GRAPH_ORTHOGONAL Laurent@925: wx.CallAfter(self.MergeGraphs, variable, idx, merge_type, force=True) Laurent@925: else: Laurent@925: if y_mouse > yw + height / 2: Laurent@925: idx += 1 Laurent@1214: wx.CallAfter(self.MoveValue, variable, idx, True) Laurent@929: self.ForceRefresh() andrej@1730: return Laurent@929: width, height = self.GraphicsWindow.GetVirtualSize() Laurent@929: rect = wx.Rect(0, 0, width, height) Laurent@929: if rect.InsideXY(x_mouse, y_mouse): Laurent@1214: wx.CallAfter(self.MoveValue, variable, len(self.GraphicPanels), True) Laurent@925: self.ForceRefresh() andrej@1730: Laurent@1218: def RefreshGraphicsSizer(self): Laurent@1218: self.GraphicsSizer.Clear() andrej@1730: Laurent@1218: for panel in self.GraphicPanels: Laurent@1218: self.GraphicsSizer.AddWindow(panel, flag=wx.GROW) andrej@1730: Laurent@1218: self.GraphicsSizer.Layout() Laurent@1218: self.RefreshGraphicsWindowScrollbars() andrej@1730: Laurent@1198: def RefreshView(self): Laurent@1198: self.RefreshCanvasPosition() andrej@1730: Laurent@1198: width, height = self.GraphicsWindow.GetVirtualSize() Laurent@1198: bitmap = wx.EmptyBitmap(width, height) Laurent@1198: dc = wx.BufferedDC(wx.ClientDC(self.GraphicsWindow), bitmap) Laurent@1198: dc.Clear() Laurent@1198: dc.BeginDrawing() Laurent@1198: if self.DraggingAxesPanel is not None: Laurent@1198: destBBox = self.DraggingAxesBoundingBox Laurent@1198: srcBBox = self.DraggingAxesPanel.GetAxesBoundingBox() andrej@1730: Laurent@1198: srcBmp = _convert_agg_to_wx_bitmap(self.DraggingAxesPanel.get_renderer(), None) Laurent@1198: srcDC = wx.MemoryDC() Laurent@1198: srcDC.SelectObject(srcBmp) andrej@1730: andrej@1730: dc.Blit(destBBox.x, destBBox.y, andrej@1730: int(destBBox.width), int(destBBox.height), Laurent@1198: srcDC, srcBBox.x, srcBBox.y) Laurent@1198: dc.EndDrawing() andrej@1730: Laurent@1198: if not self.Fixed or self.Force: Laurent@1198: self.Force = False Laurent@1198: refresh_graphics = True Laurent@1198: else: Laurent@1198: refresh_graphics = False andrej@1730: Laurent@1198: if self.DraggingAxesPanel is not None and self.DraggingAxesPanel not in self.GraphicPanels: Laurent@1198: self.DraggingAxesPanel.RefreshViewer(refresh_graphics) Laurent@1198: for panel in self.GraphicPanels: Laurent@1200: if isinstance(panel, DebugVariableGraphicViewer): Laurent@1198: panel.RefreshViewer(refresh_graphics) Laurent@1198: else: Laurent@1198: panel.RefreshViewer() andrej@1730: Laurent@1198: if self.CursorTick is not None: Laurent@1198: tick = self.CursorTick Laurent@1198: elif len(self.Ticks) > 0: Laurent@1198: tick = self.Ticks[-1] Laurent@1198: else: Laurent@1198: tick = None Laurent@1198: if tick is not None: surkovsv93@1538: self.TickLabel.SetLabel(label=_("Tick: %d") % tick) Laurent@1198: tick_duration = int(tick * self.Ticktime) Laurent@1198: not_null = False Laurent@1198: duration = "" andrej@1578: for value, format in [(tick_duration / DAY, _("%dd")), andrej@1578: ((tick_duration % DAY) / HOUR, _("%dh")), andrej@1578: ((tick_duration % HOUR) / MINUTE, _("%dm")), andrej@1578: ((tick_duration % MINUTE) / SECOND, _("%ds"))]: andrej@1730: Laurent@1198: if value > 0 or not_null: Laurent@1198: duration += format % value Laurent@1198: not_null = True andrej@1730: andrej@1730: duration += _("%03gms") % (float(tick_duration % SECOND) / MILLISECOND) Laurent@1198: self.TickTimeLabel.SetLabel("t: %s" % duration) Laurent@1198: else: Laurent@1198: self.TickLabel.SetLabel("") Laurent@1198: self.TickTimeLabel.SetLabel("") Laurent@1198: self.TickSizer.Layout() andrej@1730: Laurent@1207: def SubscribeAllDataConsumers(self): Laurent@1207: DebugViewer.SubscribeAllDataConsumers(self) andrej@1730: Laurent@1198: if self.DataProducer is not None: Laurent@916: if self.DataProducer is not None: Laurent@1198: self.SetTickTime(self.DataProducer.GetTicktime()) andrej@1730: Laurent@1271: self.ResetCursorTick() andrej@1730: Laurent@1266: for panel in self.GraphicPanels[:]: Laurent@1207: panel.SubscribeAllDataConsumers() Laurent@1200: if panel.ItemsIsEmpty(): Laurent@1198: if panel.HasCapture(): Laurent@1198: panel.ReleaseMouse() Laurent@1198: self.GraphicPanels.remove(panel) Laurent@1198: panel.Destroy() andrej@1730: Laurent@1198: self.ResetVariableNameMask() Laurent@1198: self.RefreshGraphicsSizer() Laurent@1198: self.ForceRefresh() andrej@1730: Laurent@916: def ResetView(self): Laurent@1176: self.UnsubscribeAllDataConsumers() andrej@1730: Laurent@1198: self.Fixed = False Laurent@1198: for panel in self.GraphicPanels: Laurent@1198: panel.Destroy() Laurent@1198: self.GraphicPanels = [] Laurent@1198: self.ResetVariableNameMask() Laurent@1198: self.RefreshGraphicsSizer() andrej@1730: Laurent@1218: def SetCanvasPosition(self, tick): Laurent@1218: tick = max(self.Ticks[0], min(tick, self.Ticks[-1] - self.CurrentRange)) Laurent@1218: self.StartTick = self.Ticks[numpy.argmin(numpy.abs(self.Ticks - tick))] Laurent@1218: self.Fixed = True Laurent@1218: self.RefreshCanvasPosition() Laurent@1218: self.ForceRefresh() andrej@1730: Laurent@916: def RefreshCanvasPosition(self): Laurent@902: if len(self.Ticks) > 0: Laurent@902: pos = int(self.StartTick - self.Ticks[0]) Laurent@902: range = int(self.Ticks[-1] - self.Ticks[0]) Laurent@902: else: Laurent@902: pos = 0 Laurent@902: range = 0 Laurent@902: self.CanvasPosition.SetScrollbar(pos, self.CurrentRange, range, self.CurrentRange) andrej@1730: Laurent@932: def ChangeRange(self, dir, tick=None): Laurent@928: current_range = self.CurrentRange Laurent@928: current_range_idx = self.CanvasRange.GetSelection() Laurent@1191: new_range_idx = max(0, min(current_range_idx + dir, len(RANGE_VALUES) - 1)) Laurent@928: if new_range_idx != current_range_idx: Laurent@928: self.CanvasRange.SetSelection(new_range_idx) Laurent@1191: self.CurrentRange = RANGE_VALUES[new_range_idx][1] / self.Ticktime Laurent@928: if len(self.Ticks) > 0: Laurent@932: if tick is None: Laurent@932: tick = self.StartTick + self.CurrentRange / 2. Laurent@1213: new_start_tick = min(tick - (tick - self.StartTick) * self.CurrentRange / current_range, Laurent@1213: self.Ticks[-1] - self.CurrentRange) Laurent@928: self.StartTick = self.Ticks[numpy.argmin(numpy.abs(self.Ticks - new_start_tick))] Laurent@1213: self.Fixed = new_start_tick < self.Ticks[-1] - self.CurrentRange Laurent@928: self.ForceRefresh() andrej@1730: Laurent@902: def RefreshRange(self): Laurent@902: if len(self.Ticks) > 0: Laurent@902: if self.Fixed and self.Ticks[-1] - self.Ticks[0] < self.CurrentRange: Laurent@902: self.Fixed = False Laurent@902: if self.Fixed: Laurent@902: self.StartTick = min(self.StartTick, self.Ticks[-1] - self.CurrentRange) Laurent@902: else: Laurent@902: self.StartTick = max(self.Ticks[0], self.Ticks[-1] - self.CurrentRange) Laurent@924: self.ForceRefresh() andrej@1730: Laurent@902: def OnRangeChanged(self, event): Laurent@902: try: Laurent@1191: self.CurrentRange = RANGE_VALUES[self.CanvasRange.GetSelection()][1] / self.Ticktime andrej@1846: except ValueError: Laurent@902: self.CanvasRange.SetValue(str(self.CurrentRange)) Laurent@902: wx.CallAfter(self.RefreshRange) Laurent@902: event.Skip() andrej@1730: Laurent@902: def OnCurrentButton(self, event): Laurent@902: if len(self.Ticks) > 0: Laurent@902: self.StartTick = max(self.Ticks[0], self.Ticks[-1] - self.CurrentRange) Laurent@928: self.ResetCursorTick() Laurent@902: event.Skip() andrej@1730: Laurent@902: def CopyDataToClipboard(self, variables): Laurent@924: text = "tick;%s;\n" % ";".join([item.GetVariable() for item, data in variables]) Laurent@902: next_tick = NextTick(variables) Laurent@902: while next_tick is not None: Laurent@902: values = [] Laurent@924: for item, data in variables: Laurent@902: if len(data) > 0: Laurent@902: if next_tick == data[0][0]: Laurent@924: var_type = item.GetVariableType() Laurent@924: if var_type in ["STRING", "WSTRING"]: Laurent@924: value = item.GetRawValue(int(data.pop(0)[2])) Laurent@924: if var_type == "STRING": Laurent@924: values.append("'%s'" % value) Laurent@924: else: Laurent@924: values.append('"%s"' % value) Laurent@924: else: Laurent@924: values.append("%.3f" % data.pop(0)[1]) Laurent@902: else: Laurent@902: values.append("") Laurent@902: else: Laurent@902: values.append("") Laurent@902: text += "%d;%s;\n" % (next_tick, ";".join(values)) Laurent@902: next_tick = NextTick(variables) Laurent@902: self.ParentWindow.SetCopyBuffer(text) andrej@1730: Laurent@902: def OnExportGraphButton(self, event): Laurent@1198: items = reduce(lambda x, y: x + y, Laurent@1198: [panel.GetItems() for panel in self.GraphicPanels], Laurent@1198: []) Laurent@1198: variables = [(item, [entry for entry in item.GetData()]) Laurent@1198: for item in items Laurent@1198: if item.IsNumVariable()] Laurent@902: wx.CallAfter(self.CopyDataToClipboard, variables) Laurent@902: event.Skip() andrej@1730: Laurent@902: def OnPositionChanging(self, event): Laurent@902: if len(self.Ticks) > 0: Laurent@902: self.StartTick = self.Ticks[0] + event.GetPosition() Laurent@902: self.Fixed = True Laurent@924: self.ForceRefresh() Laurent@902: event.Skip() andrej@1730: Laurent@916: def GetRange(self): Laurent@916: return self.StartTick, self.StartTick + self.CurrentRange andrej@1730: Laurent@916: def GetViewerIndex(self, viewer): Laurent@916: if viewer in self.GraphicPanels: Laurent@916: return self.GraphicPanels.index(viewer) Laurent@916: return None andrej@1730: Laurent@934: def IsViewerFirst(self, viewer): Laurent@934: return viewer == self.GraphicPanels[0] andrej@1730: Laurent@934: def HighlightPreviousViewer(self, viewer): Laurent@934: if self.IsViewerFirst(viewer): Laurent@934: return Laurent@934: idx = self.GetViewerIndex(viewer) Laurent@934: if idx is None: Laurent@934: return Laurent@943: self.GraphicPanels[idx-1].SetHighlight(HIGHLIGHT_AFTER) andrej@1730: Laurent@928: def ResetVariableNameMask(self): Laurent@928: items = [] Laurent@928: for panel in self.GraphicPanels: Laurent@928: items.extend(panel.GetItems()) Laurent@928: if len(items) > 1: andrej@1768: self.VariableNameMask = reduce( andrej@1768: compute_mask, [item.GetVariable().split('.') for item in items]) Laurent@928: elif len(items) > 0: Laurent@928: self.VariableNameMask = items[0].GetVariable().split('.')[:-1] + ['*'] Laurent@928: else: Laurent@928: self.VariableNameMask = [] Laurent@931: self.MaskLabel.ChangeValue(".".join(self.VariableNameMask)) Laurent@931: self.MaskLabel.SetInsertionPoint(self.MaskLabel.GetLastPosition()) andrej@1730: Laurent@928: def GetVariableNameMask(self): Laurent@928: return self.VariableNameMask andrej@1730: andrej@1744: def InsertValue(self, iec_path, idx=None, force=False, graph=False): Laurent@1198: for panel in self.GraphicPanels: Laurent@1198: if panel.GetItem(iec_path) is not None: Laurent@1217: if graph and isinstance(panel, DebugVariableTextViewer): Laurent@1217: self.ToggleViewerType(panel) Laurent@1198: return Laurent@1198: if idx is None: Laurent@1198: idx = len(self.GraphicPanels) Laurent@1198: item = DebugVariableItem(self, iec_path, True) Laurent@1365: result = self.AddDataConsumer(iec_path.upper(), item, True) Laurent@814: if result is not None or force: andrej@1730: Laurent@1209: self.Freeze() Laurent@1214: if item.IsNumVariable() and graph: Laurent@1200: panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL) Laurent@1198: if self.CursorTick is not None: Laurent@1198: panel.SetCursorTick(self.CursorTick) Laurent@916: else: Laurent@1200: panel = DebugVariableTextViewer(self.GraphicsWindow, self, [item]) Laurent@1198: if idx is not None: Laurent@1198: self.GraphicPanels.insert(idx, panel) Laurent@1198: else: Laurent@1198: self.GraphicPanels.append(panel) Laurent@1198: self.ResetVariableNameMask() Laurent@1198: self.RefreshGraphicsSizer() Laurent@1209: self.Thaw() Laurent@1198: self.ForceRefresh() andrej@1730: andrej@1744: def MoveValue(self, iec_path, idx=None, graph=False): Laurent@919: if idx is None: Laurent@919: idx = len(self.GraphicPanels) Laurent@919: source_panel = None Laurent@919: item = None Laurent@919: for panel in self.GraphicPanels: Laurent@919: item = panel.GetItem(iec_path) Laurent@919: if item is not None: Laurent@919: source_panel = panel Laurent@919: break Laurent@919: if source_panel is not None: Laurent@1214: source_panel_idx = self.GraphicPanels.index(source_panel) andrej@1730: andrej@1828: if len(source_panel.GetItems()) == 1: andrej@1730: Laurent@1218: if source_panel_idx < idx: Laurent@1218: self.GraphicPanels.insert(idx, source_panel) Laurent@1218: self.GraphicPanels.pop(source_panel_idx) Laurent@1218: elif source_panel_idx > idx: Laurent@1218: self.GraphicPanels.pop(source_panel_idx) Laurent@1218: self.GraphicPanels.insert(idx, source_panel) Laurent@1218: else: Laurent@1218: return andrej@1730: Laurent@1217: else: Laurent@1217: source_panel.RemoveItem(item) Laurent@1217: source_size = source_panel.GetSize() Laurent@1217: if item.IsNumVariable() and graph: Laurent@1217: panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL) Laurent@1264: panel.SetCanvasHeight(source_size.height) Laurent@1217: if self.CursorTick is not None: Laurent@1217: panel.SetCursorTick(self.CursorTick) andrej@1730: Laurent@1217: else: Laurent@1217: panel = DebugVariableTextViewer(self.GraphicsWindow, self, [item]) andrej@1730: Laurent@1217: self.GraphicPanels.insert(idx, panel) andrej@1730: Laurent@1217: if source_panel.ItemsIsEmpty(): Laurent@1217: if source_panel.HasCapture(): Laurent@1217: source_panel.ReleaseMouse() Laurent@1217: source_panel.Destroy() Laurent@1217: self.GraphicPanels.remove(source_panel) andrej@1730: Laurent@928: self.ResetVariableNameMask() Laurent@919: self.RefreshGraphicsSizer() Laurent@924: self.ForceRefresh() andrej@1730: Laurent@916: def MergeGraphs(self, source, target_idx, merge_type, force=False): Laurent@909: source_item = None Laurent@916: source_panel = None Laurent@916: for panel in self.GraphicPanels: Laurent@916: source_item = panel.GetItem(source) Laurent@916: if source_item is not None: Laurent@916: source_panel = panel Laurent@916: break Laurent@909: if source_item is None: Laurent@1198: item = DebugVariableItem(self, source, True) Laurent@909: if item.IsNumVariable(): Laurent@1365: result = self.AddDataConsumer(source.upper(), item, True) Laurent@909: if result is not None or force: Laurent@909: source_item = item Laurent@945: if source_item is not None and source_item.IsNumVariable(): Laurent@1041: if source_panel is not None: Laurent@1041: source_size = source_panel.GetSize() Laurent@1041: else: Laurent@1041: source_size = None Laurent@916: target_panel = self.GraphicPanels[target_idx] Laurent@916: graph_type = target_panel.GraphType Laurent@916: if target_panel != source_panel: Laurent@916: if (merge_type == GRAPH_PARALLEL and graph_type != merge_type or andrej@1730: merge_type == GRAPH_ORTHOGONAL and Laurent@916: (graph_type == GRAPH_PARALLEL and len(target_panel.Items) > 1 or Laurent@916: graph_type == GRAPH_ORTHOGONAL and len(target_panel.Items) >= 3)): Laurent@909: return andrej@1730: Laurent@916: if source_panel is not None: Laurent@916: source_panel.RemoveItem(source_item) Laurent@1200: if source_panel.ItemsIsEmpty(): Laurent@943: if source_panel.HasCapture(): Laurent@943: source_panel.ReleaseMouse() Laurent@1216: source_panel.Destroy() Laurent@916: self.GraphicPanels.remove(source_panel) andrej@1828: elif merge_type != graph_type and len(target_panel.Items) == 2: Laurent@936: target_panel.RemoveItem(source_item) Laurent@936: else: Laurent@936: target_panel = None andrej@1730: Laurent@936: if target_panel is not None: Laurent@916: target_panel.AddItem(source_item) Laurent@916: target_panel.GraphType = merge_type Laurent@1041: size = target_panel.GetSize() Laurent@1041: if merge_type == GRAPH_ORTHOGONAL: Laurent@1264: target_panel.SetCanvasHeight(size.width) Laurent@1264: elif source_size is not None and source_panel != target_panel: Laurent@1264: target_panel.SetCanvasHeight(size.height + source_size.height) Laurent@1265: else: Laurent@1265: target_panel.SetCanvasHeight(size.height) Laurent@916: target_panel.ResetGraphics() andrej@1730: Laurent@928: self.ResetVariableNameMask() Laurent@916: self.RefreshGraphicsSizer() Laurent@924: self.ForceRefresh() andrej@1730: Laurent@916: def DeleteValue(self, source_panel, item=None): Laurent@916: source_idx = self.GetViewerIndex(source_panel) Laurent@916: if source_idx is not None: andrej@1730: Laurent@916: if item is None: Laurent@1200: source_panel.ClearItems() Laurent@1216: source_panel.Destroy() Laurent@916: self.GraphicPanels.remove(source_panel) Laurent@928: self.ResetVariableNameMask() Laurent@916: self.RefreshGraphicsSizer() Laurent@916: else: Laurent@916: source_panel.RemoveItem(item) Laurent@1200: if source_panel.ItemsIsEmpty(): Laurent@1216: source_panel.Destroy() Laurent@916: self.GraphicPanels.remove(source_panel) Laurent@928: self.ResetVariableNameMask() Laurent@916: self.RefreshGraphicsSizer() Laurent@1227: if len(self.GraphicPanels) == 0: Laurent@1227: self.Fixed = False Laurent@1227: self.ResetCursorTick() Laurent@924: self.ForceRefresh() andrej@1730: Laurent@1214: def ToggleViewerType(self, panel): Laurent@1214: panel_idx = self.GetViewerIndex(panel) Laurent@1214: if panel_idx is not None: Laurent@1214: self.GraphicPanels.remove(panel) Laurent@1214: items = panel.GetItems() Laurent@1214: if isinstance(panel, DebugVariableGraphicViewer): Laurent@1214: for idx, item in enumerate(items): Laurent@1214: new_panel = DebugVariableTextViewer(self.GraphicsWindow, self, [item]) Laurent@1214: self.GraphicPanels.insert(panel_idx + idx, new_panel) Laurent@1214: else: Laurent@1214: new_panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, items, GRAPH_PARALLEL) Laurent@1214: self.GraphicPanels.insert(panel_idx, new_panel) Laurent@1214: panel.Destroy() Laurent@1214: self.RefreshGraphicsSizer() Laurent@1214: self.ForceRefresh() andrej@1730: Laurent@887: def ResetGraphicsValues(self): Laurent@1198: self.Ticks = numpy.array([]) Laurent@1198: self.StartTick = 0 Laurent@1198: for panel in self.GraphicPanels: Laurent@1200: panel.ResetItemsData() Laurent@1198: self.ResetCursorTick() Laurent@916: Laurent@916: def RefreshGraphicsWindowScrollbars(self): Laurent@916: xstart, ystart = self.GraphicsWindow.GetViewStart() Laurent@916: window_size = self.GraphicsWindow.GetClientSize() Laurent@916: vwidth, vheight = self.GraphicsSizer.GetMinSize() Laurent@887: posx = max(0, min(xstart, (vwidth - window_size[0]) / SCROLLBAR_UNIT)) Laurent@887: posy = max(0, min(ystart, (vheight - window_size[1]) / SCROLLBAR_UNIT)) Laurent@916: self.GraphicsWindow.Scroll(posx, posy) andrej@1730: self.GraphicsWindow.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT, andrej@1768: vwidth / SCROLLBAR_UNIT, vheight / SCROLLBAR_UNIT, andrej@1768: posx, posy) andrej@1730: Laurent@988: def OnGraphicsWindowEraseBackground(self, event): Laurent@988: pass andrej@1730: Laurent@988: def OnGraphicsWindowPaint(self, event): Laurent@988: self.RefreshView() Laurent@988: event.Skip() andrej@1730: Laurent@916: def OnGraphicsWindowResize(self, event): Laurent@1041: size = self.GetSize() Laurent@1041: for panel in self.GraphicPanels: Laurent@1041: panel_size = panel.GetSize() andrej@1766: if isinstance(panel, DebugVariableGraphicViewer) and \ andrej@1766: panel.GraphType == GRAPH_ORTHOGONAL and \ andrej@1766: panel_size.width == panel_size.height: Laurent@1264: panel.SetCanvasHeight(size.width) Laurent@916: self.RefreshGraphicsWindowScrollbars() Laurent@1194: self.GraphicsSizer.Layout() Laurent@924: event.Skip() Laurent@1040: Laurent@1040: def OnGraphicsWindowMouseWheel(self, event): Laurent@1040: if self.VetoScrollEvent: Laurent@1040: self.VetoScrollEvent = False Laurent@1040: else: Laurent@1040: event.Skip()