author | Andrey Skvortsov <andrej.skvortzov@gmail.com> |
Fri, 22 Sep 2017 10:54:42 +0300 | |
changeset 1826 | 91796f408540 |
parent 1783 | 3311eea28d56 |
child 1828 | 396da88d7b5c |
permissions | -rw-r--r-- |
814 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
4 |
# This file is part of Beremiz, a Integrated Development Environment for |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
5 |
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
814 | 6 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
7 |
# Copyright (C) 2012: Edouard TISSERANT and Laurent BESSARD |
814 | 8 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
9 |
# See COPYING file for copyrights details. |
814 | 10 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
11 |
# This program is free software; you can redistribute it and/or |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
12 |
# modify it under the terms of the GNU General Public License |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
13 |
# as published by the Free Software Foundation; either version 2 |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
14 |
# of the License, or (at your option) any later version. |
814 | 15 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
16 |
# This program is distributed in the hope that it will be useful, |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
19 |
# GNU General Public License for more details. |
814 | 20 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
21 |
# You should have received a copy of the GNU General Public License |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
22 |
# along with this program; if not, write to the Free Software |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1538
diff
changeset
|
23 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
814 | 24 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
25 |
from types import TupleType |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
26 |
import math |
887
d3c6c4ab8b28
Adding support for displaying graphs of debugged numeric variables in 2D and 3D in DebugVariablePanel
Laurent Bessard
parents:
878
diff
changeset
|
27 |
import numpy |
814 | 28 |
|
29 |
import wx |
|
30 |
import wx.lib.buttons |
|
888
baf5dbfd28f4
Adding support for disabling 2D and 3D graphics in DebugVariablePanel when matplotlib is not installed
Laurent Bessard
parents:
887
diff
changeset
|
31 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
32 |
import matplotlib |
1783
3311eea28d56
clean-up: fix PEP8 E402 module level import not at top of file
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
33 |
matplotlib.use('WX') # noqa |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
34 |
import matplotlib.pyplot |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
35 |
from matplotlib.backends.backend_wxagg import _convert_agg_to_wx_bitmap |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
36 |
|
1783
3311eea28d56
clean-up: fix PEP8 E402 module level import not at top of file
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
37 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
38 |
from editors.DebugViewer import DebugViewer |
814 | 39 |
from util.BitmapLibrary import GetBitmap |
40 |
||
1199
fc0e7d80494f
Move GraphButton from DebugVariableGraphicPanel to separate file
Laurent Bessard
parents:
1198
diff
changeset
|
41 |
from DebugVariableItem import DebugVariableItem |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
42 |
from DebugVariableTextViewer import DebugVariableTextViewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
43 |
from DebugVariableGraphicViewer import * |
1199
fc0e7d80494f
Move GraphButton from DebugVariableGraphicPanel to separate file
Laurent Bessard
parents:
1198
diff
changeset
|
44 |
|
1783
3311eea28d56
clean-up: fix PEP8 E402 module level import not at top of file
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
45 |
|
1737
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
46 |
MILLISECOND = 1000000 # Number of nanosecond in a millisecond |
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
47 |
SECOND = 1000 * MILLISECOND # Number of nanosecond in a second |
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
48 |
MINUTE = 60 * SECOND # Number of nanosecond in a minute |
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
49 |
HOUR = 60 * MINUTE # Number of nanosecond in a hour |
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
50 |
DAY = 24 * HOUR # Number of nanosecond in a day |
1215 | 51 |
|
52 |
# List of values possible for graph range |
|
53 |
# Format is [(time_in_plain_text, value_in_nanosecond),...] |
|
54 |
RANGE_VALUES = \ |
|
1578
f8e2a04c4445
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
55 |
[(_("%dms") % i, i * MILLISECOND) for i in (10, 20, 50, 100, 200, 500)] + \ |
f8e2a04c4445
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
56 |
[(_("%ds") % i, i * SECOND) for i in (1, 2, 5, 10, 20, 30)] + \ |
f8e2a04c4445
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
57 |
[(_("%dm") % i, i * MINUTE) for i in (1, 2, 5, 10, 20, 30)] + \ |
f8e2a04c4445
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
58 |
[(_("%dh") % i, i * HOUR) for i in (1, 2, 3, 6, 12, 24)] |
1215 | 59 |
|
60 |
# Scrollbar increment in pixel |
|
61 |
SCROLLBAR_UNIT = 10 |
|
62 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
63 |
|
1215 | 64 |
def compute_mask(x, y): |
65 |
return [(xp if xp == yp else "*") |
|
66 |
for xp, yp in zip(x, y)] |
|
67 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
68 |
|
1215 | 69 |
def NextTick(variables): |
70 |
next_tick = None |
|
71 |
for item, data in variables: |
|
72 |
if len(data) == 0: |
|
73 |
continue |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
74 |
|
1231 | 75 |
next_tick = (data[0][0] |
76 |
if next_tick is None |
|
77 |
else min(next_tick, data[0][0])) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
78 |
|
1215 | 79 |
return next_tick |
80 |
||
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
81 |
# ------------------------------------------------------------------------------- |
1215 | 82 |
# Debug Variable Graphic Panel Drop Target |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
83 |
# ------------------------------------------------------------------------------- |
1215 | 84 |
|
85 |
||
814 | 86 |
class DebugVariableDropTarget(wx.TextDropTarget): |
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
87 |
""" |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
88 |
Class that implements a custom drop target class for Debug Variable Graphic |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
89 |
Panel |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
90 |
""" |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
91 |
|
1215 | 92 |
def __init__(self, window): |
93 |
""" |
|
94 |
Constructor |
|
95 |
@param window: Reference to the Debug Variable Panel |
|
96 |
""" |
|
814 | 97 |
wx.TextDropTarget.__init__(self) |
1215 | 98 |
self.ParentWindow = window |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
99 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
100 |
def __del__(self): |
1215 | 101 |
""" |
102 |
Destructor |
|
103 |
""" |
|
104 |
# Remove reference to Debug Variable Panel |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
105 |
self.ParentWindow = None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
106 |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
107 |
def OnDragOver(self, x, y, d): |
1215 | 108 |
""" |
109 |
Function called when mouse is dragged over Drop Target |
|
110 |
@param x: X coordinate of mouse pointer |
|
111 |
@param y: Y coordinate of mouse pointer |
|
112 |
@param d: Suggested default for return value |
|
113 |
""" |
|
1770
449fd504a711
clean-up: fix PEP8 E114 indentation is not a multiple of four (comment)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
114 |
# Signal Debug Variable Panel to refresh highlight giving mouse position |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
115 |
self.ParentWindow.RefreshHighlight(x, y) |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
116 |
return wx.TextDropTarget.OnDragOver(self, x, y, d) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
117 |
|
814 | 118 |
def OnDropText(self, x, y, data): |
1215 | 119 |
""" |
120 |
Function called when mouse is released in Drop Target |
|
121 |
@param x: X coordinate of mouse pointer |
|
122 |
@param y: Y coordinate of mouse pointer |
|
123 |
@param data: Text associated to drag'n drop |
|
124 |
""" |
|
1218 | 125 |
# Signal Debug Variable Panel to reset highlight |
126 |
self.ParentWindow.ResetHighlight() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
127 |
|
814 | 128 |
message = None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
129 |
|
1215 | 130 |
# Check that data is valid regarding DebugVariablePanel |
814 | 131 |
try: |
132 |
values = eval(data) |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
133 |
if not isinstance(values, TupleType): |
1207 | 134 |
raise ValueError |
1780
c52d1460cea8
clean-up: fix PEP8 E722 do not use bare except'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1770
diff
changeset
|
135 |
except Exception: |
1734
750eeb7230a1
clean-up: fix some PEP8 E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
136 |
message = _("Invalid value \"%s\" for debug variable") % data |
814 | 137 |
values = None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
138 |
|
1215 | 139 |
# Display message if data is invalid |
814 | 140 |
if message is not None: |
141 |
wx.CallAfter(self.ShowMessage, message) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
142 |
|
1215 | 143 |
# Data contain a reference to a variable to debug |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
144 |
elif values[1] == "debug": |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
145 |
|
1215 | 146 |
# Drag'n Drop is an internal is an internal move inside Debug |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
147 |
# Variable Panel |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
148 |
if len(values) > 2 and values[2] == "move": |
945
c1159acb0886
Added support for drag'n dropping non-numeric variables
Laurent Bessard
parents:
943
diff
changeset
|
149 |
self.ParentWindow.MoveValue(values[0]) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
150 |
|
1215 | 151 |
# Drag'n Drop was initiated by another control of Beremiz |
945
c1159acb0886
Added support for drag'n dropping non-numeric variables
Laurent Bessard
parents:
943
diff
changeset
|
152 |
else: |
c1159acb0886
Added support for drag'n dropping non-numeric variables
Laurent Bessard
parents:
943
diff
changeset
|
153 |
self.ParentWindow.InsertValue(values[0], force=True) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
154 |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
155 |
def OnLeave(self): |
1215 | 156 |
""" |
157 |
Function called when mouse is leave Drop Target |
|
158 |
""" |
|
159 |
# Signal Debug Variable Panel to reset highlight |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
160 |
self.ParentWindow.ResetHighlight() |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
161 |
return wx.TextDropTarget.OnLeave(self) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
162 |
|
814 | 163 |
def ShowMessage(self, message): |
1215 | 164 |
""" |
165 |
Show error message in Error Dialog |
|
166 |
@param message: Error message to display |
|
167 |
""" |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
168 |
dialog = wx.MessageDialog(self.ParentWindow, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
169 |
message, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
170 |
_("Error"), |
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
171 |
wx.OK | wx.ICON_ERROR) |
814 | 172 |
dialog.ShowModal() |
173 |
dialog.Destroy() |
|
174 |
||
1215 | 175 |
|
1364
e9e17d3b2849
Remove old debug panels and viewers not using matplotlib
Laurent Bessard
parents:
1363
diff
changeset
|
176 |
class DebugVariablePanel(wx.Panel, DebugViewer): |
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
177 |
""" |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
178 |
Class that implements a Viewer that display variable values as a graphs |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
179 |
""" |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
180 |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
181 |
def __init__(self, parent, producer, window): |
1215 | 182 |
""" |
183 |
Constructor |
|
184 |
@param parent: Reference to the parent wx.Window |
|
185 |
@param producer: Object receiving debug value and dispatching them to |
|
186 |
consumers |
|
187 |
@param window: Reference to Beremiz frame |
|
188 |
""" |
|
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
189 |
wx.Panel.__init__(self, parent, style=wx.SP_3D | wx.TAB_TRAVERSAL) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
190 |
|
1215 | 191 |
# Save Reference to Beremiz frame |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
192 |
self.ParentWindow = window |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
193 |
|
1215 | 194 |
# Variable storing flag indicating that variable displayed in table |
195 |
# received new value and then table need to be refreshed |
|
814 | 196 |
self.HasNewData = False |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
197 |
|
1215 | 198 |
# Variable storing flag indicating that refresh has been forced, and |
199 |
# that next time refresh is possible, it will be done even if no new |
|
200 |
# data is available |
|
1008
1e5d285864f6
Fixed bugs in DebugVariablePanel when matplotlib not installed
Laurent Bessard
parents:
988
diff
changeset
|
201 |
self.Force = False |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
202 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
203 |
self.SetBackgroundColour(wx.WHITE) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
204 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
205 |
main_sizer = wx.BoxSizer(wx.VERTICAL) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
206 |
|
1737
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
207 |
self.Ticks = numpy.array([]) # List of tick received |
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
208 |
self.StartTick = 0 # Tick starting range of data displayed |
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
209 |
self.Fixed = False # Flag that range of data is fixed |
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
210 |
self.CursorTick = None # Tick of cursor for displaying values |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
211 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
212 |
self.DraggingAxesPanel = None |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
213 |
self.DraggingAxesBoundingBox = None |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
214 |
self.DraggingAxesMousePos = None |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
215 |
self.VetoScrollEvent = False |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
216 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
217 |
self.VariableNameMask = [] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
218 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
219 |
self.GraphicPanels = [] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
220 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
221 |
graphics_button_sizer = wx.BoxSizer(wx.HORIZONTAL) |
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
222 |
main_sizer.AddSizer(graphics_button_sizer, border=5, flag=wx.GROW | wx.ALL) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
223 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
224 |
range_label = wx.StaticText(self, label=_('Range:')) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
225 |
graphics_button_sizer.AddWindow(range_label, flag=wx.ALIGN_CENTER_VERTICAL) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
226 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
227 |
self.CanvasRange = wx.ComboBox(self, style=wx.CB_READONLY) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
228 |
self.Bind(wx.EVT_COMBOBOX, self.OnRangeChanged, self.CanvasRange) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
229 |
graphics_button_sizer.AddWindow(self.CanvasRange, 1, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
230 |
border=5, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
231 |
flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
232 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
233 |
self.CanvasRange.Clear() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
234 |
default_range_idx = 0 |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
235 |
for idx, (text, value) in enumerate(RANGE_VALUES): |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
236 |
self.CanvasRange.Append(text) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
237 |
if text == "1s": |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
238 |
default_range_idx = idx |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
239 |
self.CanvasRange.SetSelection(default_range_idx) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
240 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
241 |
for name, bitmap, help in [ |
1766
c1e5b9f19483
clean-up: fix PEP8 E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
242 |
("CurrentButton", "current", _("Go to current value")), |
c1e5b9f19483
clean-up: fix PEP8 E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
243 |
("ExportGraphButton", "export_graph", _("Export graph values to clipboard"))]: |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
244 |
button = wx.lib.buttons.GenBitmapButton( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
245 |
self, bitmap=GetBitmap(bitmap), |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
246 |
size=wx.Size(28, 28), style=wx.NO_BORDER) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
247 |
button.SetToolTipString(help) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
248 |
setattr(self, name, button) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
249 |
self.Bind(wx.EVT_BUTTON, getattr(self, "On" + name), button) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
250 |
graphics_button_sizer.AddWindow(button, border=5, flag=wx.LEFT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
251 |
|
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
252 |
self.CanvasPosition = wx.ScrollBar( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
253 |
self, size=wx.Size(0, 16), style=wx.SB_HORIZONTAL) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
254 |
self.CanvasPosition.Bind(wx.EVT_SCROLL_THUMBTRACK, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
255 |
self.OnPositionChanging, self.CanvasPosition) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
256 |
self.CanvasPosition.Bind(wx.EVT_SCROLL_LINEUP, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
257 |
self.OnPositionChanging, self.CanvasPosition) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
258 |
self.CanvasPosition.Bind(wx.EVT_SCROLL_LINEDOWN, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
259 |
self.OnPositionChanging, self.CanvasPosition) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
260 |
self.CanvasPosition.Bind(wx.EVT_SCROLL_PAGEUP, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
261 |
self.OnPositionChanging, self.CanvasPosition) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
262 |
self.CanvasPosition.Bind(wx.EVT_SCROLL_PAGEDOWN, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
263 |
self.OnPositionChanging, self.CanvasPosition) |
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
264 |
main_sizer.AddWindow(self.CanvasPosition, border=5, flag=wx.GROW | wx.LEFT | wx.RIGHT | wx.BOTTOM) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
265 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
266 |
self.TickSizer = wx.BoxSizer(wx.HORIZONTAL) |
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
267 |
main_sizer.AddSizer(self.TickSizer, border=5, flag=wx.ALL | wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
268 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
269 |
self.TickLabel = wx.StaticText(self) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
270 |
self.TickSizer.AddWindow(self.TickLabel, border=5, flag=wx.RIGHT) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
271 |
|
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
272 |
self.MaskLabel = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_CENTER | wx.NO_BORDER) |
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
273 |
self.TickSizer.AddWindow(self.MaskLabel, 1, border=5, flag=wx.RIGHT | wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
274 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
275 |
self.TickTimeLabel = wx.StaticText(self) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
276 |
self.TickSizer.AddWindow(self.TickTimeLabel) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
277 |
|
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
278 |
self.GraphicsWindow = wx.ScrolledWindow(self, style=wx.HSCROLL | wx.VSCROLL) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
279 |
self.GraphicsWindow.SetBackgroundColour(wx.WHITE) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
280 |
self.GraphicsWindow.SetDropTarget(DebugVariableDropTarget(self)) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
281 |
self.GraphicsWindow.Bind(wx.EVT_ERASE_BACKGROUND, self.OnGraphicsWindowEraseBackground) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
282 |
self.GraphicsWindow.Bind(wx.EVT_PAINT, self.OnGraphicsWindowPaint) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
283 |
self.GraphicsWindow.Bind(wx.EVT_SIZE, self.OnGraphicsWindowResize) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
284 |
self.GraphicsWindow.Bind(wx.EVT_MOUSEWHEEL, self.OnGraphicsWindowMouseWheel) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
285 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
286 |
main_sizer.AddWindow(self.GraphicsWindow, 1, flag=wx.GROW) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
287 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
288 |
self.GraphicsSizer = wx.BoxSizer(wx.VERTICAL) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
289 |
self.GraphicsWindow.SetSizer(self.GraphicsSizer) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
290 |
|
1192
d8783c0c7d80
Fixed bugs in DebugVariablePanel with ticktime modifications
Laurent Bessard
parents:
1191
diff
changeset
|
291 |
DebugViewer.__init__(self, producer, True) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
292 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
293 |
self.SetSizer(main_sizer) |
1520
6addc58f63a6
add initialization tick time on Beremiz start
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1431
diff
changeset
|
294 |
self.SetTickTime() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
295 |
|
1192
d8783c0c7d80
Fixed bugs in DebugVariablePanel with ticktime modifications
Laurent Bessard
parents:
1191
diff
changeset
|
296 |
def SetTickTime(self, ticktime=0): |
1215 | 297 |
""" |
298 |
Set Ticktime for calculate data range according to time range selected |
|
299 |
@param ticktime: Ticktime to apply to range (default: 0) |
|
300 |
""" |
|
301 |
# Save ticktime |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
302 |
self.Ticktime = ticktime |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
303 |
|
1215 | 304 |
# Set ticktime to millisecond if undefined |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
305 |
if self.Ticktime == 0: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
306 |
self.Ticktime = MILLISECOND |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
307 |
|
1215 | 308 |
# Calculate range to apply to data |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
309 |
self.CurrentRange = RANGE_VALUES[ |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
310 |
self.CanvasRange.GetSelection()][1] / self.Ticktime |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
311 |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
312 |
def SetDataProducer(self, producer): |
1215 | 313 |
""" |
314 |
Set Data Producer |
|
315 |
@param producer: Data Producer |
|
316 |
""" |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
317 |
DebugViewer.SetDataProducer(self, producer) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
318 |
|
1215 | 319 |
# Set ticktime if data producer is available |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
320 |
if self.DataProducer is not None: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
321 |
self.SetTickTime(self.DataProducer.GetTicktime()) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
322 |
|
1431 | 323 |
def RefreshNewData(self): |
1215 | 324 |
""" |
325 |
Called to refresh Panel according to values received by variables |
|
326 |
Can receive any parameters (not used here) |
|
327 |
""" |
|
328 |
# Refresh graphs if new data is available or refresh is forced |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
329 |
if self.HasNewData or self.Force: |
814 | 330 |
self.HasNewData = False |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
331 |
self.RefreshView() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
332 |
|
1431 | 333 |
DebugViewer.RefreshNewData(self) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
334 |
|
1431 | 335 |
def NewDataAvailable(self, ticks): |
1215 | 336 |
""" |
337 |
Called by DataProducer for each tick captured or by panel to refresh |
|
338 |
graphs |
|
339 |
@param tick: PLC tick captured |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
340 |
All other parameters are passed to refresh function |
1215 | 341 |
""" |
342 |
# If tick given |
|
1363
e87e0166d0a7
Added new debug process separating non-wx thread extracting debug values from connector and 10 Hz wx timer refreshing Beremiz debug Viewers and communicating throw double-buffering, to avoid segmentation faults and optimize CPU usage
Laurent Bessard
parents:
1362
diff
changeset
|
343 |
if ticks is not None: |
e87e0166d0a7
Added new debug process separating non-wx thread extracting debug values from connector and 10 Hz wx timer refreshing Beremiz debug Viewers and communicating throw double-buffering, to avoid segmentation faults and optimize CPU usage
Laurent Bessard
parents:
1362
diff
changeset
|
344 |
tick = ticks[-1] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
345 |
|
1215 | 346 |
# Save tick as start tick for range if data is still empty |
927 | 347 |
if len(self.Ticks) == 0: |
1363
e87e0166d0a7
Added new debug process separating non-wx thread extracting debug values from connector and 10 Hz wx timer refreshing Beremiz debug Viewers and communicating throw double-buffering, to avoid segmentation faults and optimize CPU usage
Laurent Bessard
parents:
1362
diff
changeset
|
348 |
self.StartTick = ticks[0] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
349 |
|
1215 | 350 |
# Add tick to list of ticks received |
1363
e87e0166d0a7
Added new debug process separating non-wx thread extracting debug values from connector and 10 Hz wx timer refreshing Beremiz debug Viewers and communicating throw double-buffering, to avoid segmentation faults and optimize CPU usage
Laurent Bessard
parents:
1362
diff
changeset
|
351 |
self.Ticks = numpy.append(self.Ticks, ticks) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
352 |
|
1215 | 353 |
# Update start tick for range if range follow ticks received |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
354 |
if not self.Fixed or tick < self.StartTick + self.CurrentRange: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
355 |
self.StartTick = max(self.StartTick, tick - self.CurrentRange) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
356 |
|
1215 | 357 |
# Force refresh if graph is fixed because range of data received |
358 |
# is too small to fill data range selected |
|
359 |
if self.Fixed and \ |
|
360 |
self.Ticks[-1] - self.Ticks[0] < self.CurrentRange: |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
361 |
self.Force = True |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
362 |
|
1363
e87e0166d0a7
Added new debug process separating non-wx thread extracting debug values from connector and 10 Hz wx timer refreshing Beremiz debug Viewers and communicating throw double-buffering, to avoid segmentation faults and optimize CPU usage
Laurent Bessard
parents:
1362
diff
changeset
|
363 |
self.HasNewData = False |
e87e0166d0a7
Added new debug process separating non-wx thread extracting debug values from connector and 10 Hz wx timer refreshing Beremiz debug Viewers and communicating throw double-buffering, to avoid segmentation faults and optimize CPU usage
Laurent Bessard
parents:
1362
diff
changeset
|
364 |
self.RefreshView() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
365 |
|
1363
e87e0166d0a7
Added new debug process separating non-wx thread extracting debug values from connector and 10 Hz wx timer refreshing Beremiz debug Viewers and communicating throw double-buffering, to avoid segmentation faults and optimize CPU usage
Laurent Bessard
parents:
1362
diff
changeset
|
366 |
else: |
1431 | 367 |
DebugViewer.NewDataAvailable(self, ticks) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
368 |
|
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
369 |
def ForceRefresh(self): |
1215 | 370 |
""" |
371 |
Called to force refresh of graphs |
|
372 |
""" |
|
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
373 |
self.Force = True |
1431 | 374 |
wx.CallAfter(self.NewDataAvailable, None) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
375 |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
376 |
def SetCursorTick(self, cursor_tick): |
1227
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
377 |
""" |
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
378 |
Set Cursor for displaying values of items at a tick given |
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
379 |
@param cursor_tick: Tick of cursor |
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
380 |
""" |
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
381 |
# Save cursor tick |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
382 |
self.CursorTick = cursor_tick |
1209 | 383 |
self.Fixed = cursor_tick is not None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
384 |
self.UpdateCursorTick() |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
385 |
|
1174
9cc1a3fa9619
Add support for moving cursor in Debug Graphs using arrow keys
Laurent Bessard
parents:
1102
diff
changeset
|
386 |
def MoveCursorTick(self, move): |
9cc1a3fa9619
Add support for moving cursor in Debug Graphs using arrow keys
Laurent Bessard
parents:
1102
diff
changeset
|
387 |
if self.CursorTick is not None: |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
388 |
cursor_tick = max(self.Ticks[0], |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
389 |
min(self.CursorTick + move, self.Ticks[-1])) |
1192
d8783c0c7d80
Fixed bugs in DebugVariablePanel with ticktime modifications
Laurent Bessard
parents:
1191
diff
changeset
|
390 |
cursor_tick_idx = numpy.argmin(numpy.abs(self.Ticks - cursor_tick)) |
d8783c0c7d80
Fixed bugs in DebugVariablePanel with ticktime modifications
Laurent Bessard
parents:
1191
diff
changeset
|
391 |
if self.Ticks[cursor_tick_idx] == self.CursorTick: |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
392 |
cursor_tick_idx = max(0, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
393 |
min(cursor_tick_idx + abs(move) / move, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
394 |
len(self.Ticks) - 1)) |
1192
d8783c0c7d80
Fixed bugs in DebugVariablePanel with ticktime modifications
Laurent Bessard
parents:
1191
diff
changeset
|
395 |
self.CursorTick = self.Ticks[cursor_tick_idx] |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
396 |
self.StartTick = max( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
397 |
self.Ticks[numpy.argmin( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
398 |
numpy.abs(self.Ticks - self.CursorTick + self.CurrentRange))], |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
399 |
min(self.StartTick, self.CursorTick)) |
1174
9cc1a3fa9619
Add support for moving cursor in Debug Graphs using arrow keys
Laurent Bessard
parents:
1102
diff
changeset
|
400 |
self.RefreshCanvasPosition() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
401 |
self.UpdateCursorTick() |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
402 |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
403 |
def ResetCursorTick(self): |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
404 |
self.CursorTick = None |
1227
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
405 |
self.Fixed = False |
1084
baa09a1c7b15
Fixed bug in DebugVariablePanel, cursor not reset when graphs were reset
Laurent Bessard
parents:
1044
diff
changeset
|
406 |
self.UpdateCursorTick() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
407 |
|
1084
baa09a1c7b15
Fixed bug in DebugVariablePanel, cursor not reset when graphs were reset
Laurent Bessard
parents:
1044
diff
changeset
|
408 |
def UpdateCursorTick(self): |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
409 |
for panel in self.GraphicPanels: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
410 |
if isinstance(panel, DebugVariableGraphicViewer): |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
411 |
panel.SetCursorTick(self.CursorTick) |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
412 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
413 |
|
929
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
414 |
def StartDragNDrop(self, panel, item, x_mouse, y_mouse, x_mouse_start, y_mouse_start): |
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
415 |
if len(panel.GetItems()) > 1: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
416 |
self.DraggingAxesPanel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL) |
929
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
417 |
self.DraggingAxesPanel.SetCursorTick(self.CursorTick) |
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
418 |
width, height = panel.GetSize() |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
419 |
self.DraggingAxesPanel.SetSize(wx.Size(width, height)) |
1044 | 420 |
self.DraggingAxesPanel.ResetGraphics() |
929
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
421 |
self.DraggingAxesPanel.SetPosition(wx.Point(0, -height)) |
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
422 |
else: |
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
423 |
self.DraggingAxesPanel = panel |
1212 | 424 |
self.DraggingAxesBoundingBox = panel.GetAxesBoundingBox(parent_coordinate=True) |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
425 |
self.DraggingAxesMousePos = wx.Point( |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
426 |
x_mouse_start - self.DraggingAxesBoundingBox.x, |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
427 |
y_mouse_start - self.DraggingAxesBoundingBox.y) |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
428 |
self.MoveDragNDrop(x_mouse, y_mouse) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
429 |
|
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
430 |
def MoveDragNDrop(self, x_mouse, y_mouse): |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
431 |
self.DraggingAxesBoundingBox.x = x_mouse - self.DraggingAxesMousePos.x |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
432 |
self.DraggingAxesBoundingBox.y = y_mouse - self.DraggingAxesMousePos.y |
934
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
433 |
self.RefreshHighlight(x_mouse, y_mouse) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
434 |
|
934
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
435 |
def RefreshHighlight(self, x_mouse, y_mouse): |
929
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
436 |
for idx, panel in enumerate(self.GraphicPanels): |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
437 |
x, y = panel.GetPosition() |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
438 |
width, height = panel.GetSize() |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
439 |
rect = wx.Rect(x, y, width, height) |
1766
c1e5b9f19483
clean-up: fix PEP8 E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
440 |
if rect.InsideXY(x_mouse, y_mouse) or \ |
c1e5b9f19483
clean-up: fix PEP8 E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
441 |
idx == 0 and y_mouse < 0 or \ |
c1e5b9f19483
clean-up: fix PEP8 E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
442 |
idx == len(self.GraphicPanels) - 1 and y_mouse > panel.GetPosition()[1]: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
443 |
panel.RefreshHighlight(x_mouse - x, y_mouse - y) |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
444 |
else: |
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
445 |
panel.SetHighlight(HIGHLIGHT_NONE) |
962
c0dcbbdb0bb1
Fix bug on Windows when drag'n dropping variable to DebugVariablePanel, panel not refreshed
Laurent Bessard
parents:
952
diff
changeset
|
446 |
if wx.Platform == "__WXMSW__": |
c0dcbbdb0bb1
Fix bug on Windows when drag'n dropping variable to DebugVariablePanel, panel not refreshed
Laurent Bessard
parents:
952
diff
changeset
|
447 |
self.RefreshView() |
c0dcbbdb0bb1
Fix bug on Windows when drag'n dropping variable to DebugVariablePanel, panel not refreshed
Laurent Bessard
parents:
952
diff
changeset
|
448 |
else: |
c0dcbbdb0bb1
Fix bug on Windows when drag'n dropping variable to DebugVariablePanel, panel not refreshed
Laurent Bessard
parents:
952
diff
changeset
|
449 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
450 |
|
934
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
451 |
def ResetHighlight(self): |
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
452 |
for panel in self.GraphicPanels: |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
453 |
panel.SetHighlight(HIGHLIGHT_NONE) |
962
c0dcbbdb0bb1
Fix bug on Windows when drag'n dropping variable to DebugVariablePanel, panel not refreshed
Laurent Bessard
parents:
952
diff
changeset
|
454 |
if wx.Platform == "__WXMSW__": |
c0dcbbdb0bb1
Fix bug on Windows when drag'n dropping variable to DebugVariablePanel, panel not refreshed
Laurent Bessard
parents:
952
diff
changeset
|
455 |
self.RefreshView() |
c0dcbbdb0bb1
Fix bug on Windows when drag'n dropping variable to DebugVariablePanel, panel not refreshed
Laurent Bessard
parents:
952
diff
changeset
|
456 |
else: |
c0dcbbdb0bb1
Fix bug on Windows when drag'n dropping variable to DebugVariablePanel, panel not refreshed
Laurent Bessard
parents:
952
diff
changeset
|
457 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
458 |
|
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
459 |
def IsDragging(self): |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
460 |
return self.DraggingAxesPanel is not None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
461 |
|
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
462 |
def GetDraggingAxesClippingRegion(self, panel): |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
463 |
x, y = panel.GetPosition() |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
464 |
width, height = panel.GetSize() |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
465 |
bbox = wx.Rect(x, y, width, height) |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
466 |
bbox = bbox.Intersect(self.DraggingAxesBoundingBox) |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
467 |
bbox.x -= x |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
468 |
bbox.y -= y |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
469 |
return bbox |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
470 |
|
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
471 |
def GetDraggingAxesPosition(self, panel): |
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
472 |
x, y = panel.GetPosition() |
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
473 |
return wx.Point(self.DraggingAxesBoundingBox.x - x, |
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
474 |
self.DraggingAxesBoundingBox.y - y) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
475 |
|
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
476 |
def StopDragNDrop(self, variable, x_mouse, y_mouse): |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
477 |
if self.DraggingAxesPanel not in self.GraphicPanels: |
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
478 |
self.DraggingAxesPanel.Destroy() |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
479 |
self.DraggingAxesPanel = None |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
480 |
self.DraggingAxesBoundingBox = None |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
481 |
self.DraggingAxesMousePos = None |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
482 |
for idx, panel in enumerate(self.GraphicPanels): |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
483 |
panel.SetHighlight(HIGHLIGHT_NONE) |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
484 |
xw, yw = panel.GetPosition() |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
485 |
width, height = panel.GetSize() |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
486 |
bbox = wx.Rect(xw, yw, width, height) |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
487 |
if bbox.InsideXY(x_mouse, y_mouse): |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
488 |
panel.ShowButtons(True) |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
489 |
merge_type = GRAPH_PARALLEL |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
490 |
if isinstance(panel, DebugVariableTextViewer) or panel.Is3DCanvas(): |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
491 |
if y_mouse > yw + height / 2: |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
492 |
idx += 1 |
1214
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
493 |
wx.CallAfter(self.MoveValue, variable, idx, True) |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
494 |
else: |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
495 |
rect = panel.GetAxesBoundingBox(True) |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
496 |
if rect.InsideXY(x_mouse, y_mouse): |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
497 |
merge_rect = wx.Rect(rect.x, rect.y, rect.width / 2., rect.height) |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
498 |
if merge_rect.InsideXY(x_mouse, y_mouse): |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
499 |
merge_type = GRAPH_ORTHOGONAL |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
500 |
wx.CallAfter(self.MergeGraphs, variable, idx, merge_type, force=True) |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
501 |
else: |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
502 |
if y_mouse > yw + height / 2: |
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
503 |
idx += 1 |
1214
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
504 |
wx.CallAfter(self.MoveValue, variable, idx, True) |
929
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
505 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
506 |
return |
929
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
507 |
width, height = self.GraphicsWindow.GetVirtualSize() |
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
508 |
rect = wx.Rect(0, 0, width, height) |
c562031146e4
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
928
diff
changeset
|
509 |
if rect.InsideXY(x_mouse, y_mouse): |
1214
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
510 |
wx.CallAfter(self.MoveValue, variable, len(self.GraphicPanels), True) |
925
5f9dd88a605b
Added support for drag'n drop variable from one graph to another with visible graph
Laurent Bessard
parents:
924
diff
changeset
|
511 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
512 |
|
1218 | 513 |
def RefreshGraphicsSizer(self): |
514 |
self.GraphicsSizer.Clear() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
515 |
|
1218 | 516 |
for panel in self.GraphicPanels: |
517 |
self.GraphicsSizer.AddWindow(panel, flag=wx.GROW) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
518 |
|
1218 | 519 |
self.GraphicsSizer.Layout() |
520 |
self.RefreshGraphicsWindowScrollbars() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
521 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
522 |
def RefreshView(self): |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
523 |
self.RefreshCanvasPosition() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
524 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
525 |
width, height = self.GraphicsWindow.GetVirtualSize() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
526 |
bitmap = wx.EmptyBitmap(width, height) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
527 |
dc = wx.BufferedDC(wx.ClientDC(self.GraphicsWindow), bitmap) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
528 |
dc.Clear() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
529 |
dc.BeginDrawing() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
530 |
if self.DraggingAxesPanel is not None: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
531 |
destBBox = self.DraggingAxesBoundingBox |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
532 |
srcBBox = self.DraggingAxesPanel.GetAxesBoundingBox() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
533 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
534 |
srcBmp = _convert_agg_to_wx_bitmap(self.DraggingAxesPanel.get_renderer(), None) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
535 |
srcDC = wx.MemoryDC() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
536 |
srcDC.SelectObject(srcBmp) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
537 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
538 |
dc.Blit(destBBox.x, destBBox.y, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
539 |
int(destBBox.width), int(destBBox.height), |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
540 |
srcDC, srcBBox.x, srcBBox.y) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
541 |
dc.EndDrawing() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
542 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
543 |
if not self.Fixed or self.Force: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
544 |
self.Force = False |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
545 |
refresh_graphics = True |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
546 |
else: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
547 |
refresh_graphics = False |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
548 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
549 |
if self.DraggingAxesPanel is not None and self.DraggingAxesPanel not in self.GraphicPanels: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
550 |
self.DraggingAxesPanel.RefreshViewer(refresh_graphics) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
551 |
for panel in self.GraphicPanels: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
552 |
if isinstance(panel, DebugVariableGraphicViewer): |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
553 |
panel.RefreshViewer(refresh_graphics) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
554 |
else: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
555 |
panel.RefreshViewer() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
556 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
557 |
if self.CursorTick is not None: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
558 |
tick = self.CursorTick |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
559 |
elif len(self.Ticks) > 0: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
560 |
tick = self.Ticks[-1] |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
561 |
else: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
562 |
tick = None |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
563 |
if tick is not None: |
1538
ee1715e94136
Add russian translation on label "Tick" in debug variable panel.
Sergey Surkov <surkovsv93@gmail.com>
parents:
1520
diff
changeset
|
564 |
self.TickLabel.SetLabel(label=_("Tick: %d") % tick) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
565 |
tick_duration = int(tick * self.Ticktime) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
566 |
not_null = False |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
567 |
duration = "" |
1578
f8e2a04c4445
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
568 |
for value, format in [(tick_duration / DAY, _("%dd")), |
f8e2a04c4445
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
569 |
((tick_duration % DAY) / HOUR, _("%dh")), |
f8e2a04c4445
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
570 |
((tick_duration % HOUR) / MINUTE, _("%dm")), |
f8e2a04c4445
add localization to time strings in DebugVariablePanel and to dialog shown after variable drag'n'drop
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
571 |
((tick_duration % MINUTE) / SECOND, _("%ds"))]: |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
572 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
573 |
if value > 0 or not_null: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
574 |
duration += format % value |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
575 |
not_null = True |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
576 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
577 |
duration += _("%03gms") % (float(tick_duration % SECOND) / MILLISECOND) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
578 |
self.TickTimeLabel.SetLabel("t: %s" % duration) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
579 |
else: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
580 |
self.TickLabel.SetLabel("") |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
581 |
self.TickTimeLabel.SetLabel("") |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
582 |
self.TickSizer.Layout() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
583 |
|
1207 | 584 |
def SubscribeAllDataConsumers(self): |
585 |
DebugViewer.SubscribeAllDataConsumers(self) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
586 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
587 |
if self.DataProducer is not None: |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
588 |
if self.DataProducer is not None: |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
589 |
self.SetTickTime(self.DataProducer.GetTicktime()) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
590 |
|
1271
757b83fd2173
Fix bug when transferring PLC and orthogonal graph is displayed with cursor
Laurent Bessard
parents:
1266
diff
changeset
|
591 |
self.ResetCursorTick() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
592 |
|
1266
4282f62c1cf0
Fixed bug when removing obsolete variables from Debug Variable Panel
Laurent Bessard
parents:
1265
diff
changeset
|
593 |
for panel in self.GraphicPanels[:]: |
1207 | 594 |
panel.SubscribeAllDataConsumers() |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
595 |
if panel.ItemsIsEmpty(): |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
596 |
if panel.HasCapture(): |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
597 |
panel.ReleaseMouse() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
598 |
self.GraphicPanels.remove(panel) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
599 |
panel.Destroy() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
600 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
601 |
self.ResetVariableNameMask() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
602 |
self.RefreshGraphicsSizer() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
603 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
604 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
605 |
def ResetView(self): |
1176
f4b434672204
Moved and rewrote DebugViewer and DebusDataConsumer classes
Laurent Bessard
parents:
1174
diff
changeset
|
606 |
self.UnsubscribeAllDataConsumers() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
607 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
608 |
self.Fixed = False |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
609 |
for panel in self.GraphicPanels: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
610 |
panel.Destroy() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
611 |
self.GraphicPanels = [] |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
612 |
self.ResetVariableNameMask() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
613 |
self.RefreshGraphicsSizer() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
614 |
|
1218 | 615 |
def SetCanvasPosition(self, tick): |
616 |
tick = max(self.Ticks[0], min(tick, self.Ticks[-1] - self.CurrentRange)) |
|
617 |
self.StartTick = self.Ticks[numpy.argmin(numpy.abs(self.Ticks - tick))] |
|
618 |
self.Fixed = True |
|
619 |
self.RefreshCanvasPosition() |
|
620 |
self.ForceRefresh() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
621 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
622 |
def RefreshCanvasPosition(self): |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
623 |
if len(self.Ticks) > 0: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
624 |
pos = int(self.StartTick - self.Ticks[0]) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
625 |
range = int(self.Ticks[-1] - self.Ticks[0]) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
626 |
else: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
627 |
pos = 0 |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
628 |
range = 0 |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
629 |
self.CanvasPosition.SetScrollbar(pos, self.CurrentRange, range, self.CurrentRange) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
630 |
|
932
ebe63100b6d7
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
931
diff
changeset
|
631 |
def ChangeRange(self, dir, tick=None): |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
632 |
current_range = self.CurrentRange |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
633 |
current_range_idx = self.CanvasRange.GetSelection() |
1191
5237f87e035f
Fixed values in DebugVariablePanel range selection ComboBox
Laurent Bessard
parents:
1190
diff
changeset
|
634 |
new_range_idx = max(0, min(current_range_idx + dir, len(RANGE_VALUES) - 1)) |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
635 |
if new_range_idx != current_range_idx: |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
636 |
self.CanvasRange.SetSelection(new_range_idx) |
1191
5237f87e035f
Fixed values in DebugVariablePanel range selection ComboBox
Laurent Bessard
parents:
1190
diff
changeset
|
637 |
self.CurrentRange = RANGE_VALUES[new_range_idx][1] / self.Ticktime |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
638 |
if len(self.Ticks) > 0: |
932
ebe63100b6d7
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
931
diff
changeset
|
639 |
if tick is None: |
ebe63100b6d7
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
931
diff
changeset
|
640 |
tick = self.StartTick + self.CurrentRange / 2. |
1213
599e43ec921b
Fixed bug when scroll in and out using wheel mouse in graph, range of data displayed could be out of bounds of whole data stored range
Laurent Bessard
parents:
1212
diff
changeset
|
641 |
new_start_tick = min(tick - (tick - self.StartTick) * self.CurrentRange / current_range, |
599e43ec921b
Fixed bug when scroll in and out using wheel mouse in graph, range of data displayed could be out of bounds of whole data stored range
Laurent Bessard
parents:
1212
diff
changeset
|
642 |
self.Ticks[-1] - self.CurrentRange) |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
643 |
self.StartTick = self.Ticks[numpy.argmin(numpy.abs(self.Ticks - new_start_tick))] |
1213
599e43ec921b
Fixed bug when scroll in and out using wheel mouse in graph, range of data displayed could be out of bounds of whole data stored range
Laurent Bessard
parents:
1212
diff
changeset
|
644 |
self.Fixed = new_start_tick < self.Ticks[-1] - self.CurrentRange |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
645 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
646 |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
647 |
def RefreshRange(self): |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
648 |
if len(self.Ticks) > 0: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
649 |
if self.Fixed and self.Ticks[-1] - self.Ticks[0] < self.CurrentRange: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
650 |
self.Fixed = False |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
651 |
if self.Fixed: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
652 |
self.StartTick = min(self.StartTick, self.Ticks[-1] - self.CurrentRange) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
653 |
else: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
654 |
self.StartTick = max(self.Ticks[0], self.Ticks[-1] - self.CurrentRange) |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
655 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
656 |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
657 |
def OnRangeChanged(self, event): |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
658 |
try: |
1191
5237f87e035f
Fixed values in DebugVariablePanel range selection ComboBox
Laurent Bessard
parents:
1190
diff
changeset
|
659 |
self.CurrentRange = RANGE_VALUES[self.CanvasRange.GetSelection()][1] / self.Ticktime |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
660 |
except ValueError, e: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
661 |
self.CanvasRange.SetValue(str(self.CurrentRange)) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
662 |
wx.CallAfter(self.RefreshRange) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
663 |
event.Skip() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
664 |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
665 |
def OnCurrentButton(self, event): |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
666 |
if len(self.Ticks) > 0: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
667 |
self.StartTick = max(self.Ticks[0], self.Ticks[-1] - self.CurrentRange) |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
668 |
self.ResetCursorTick() |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
669 |
event.Skip() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
670 |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
671 |
def CopyDataToClipboard(self, variables): |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
672 |
text = "tick;%s;\n" % ";".join([item.GetVariable() for item, data in variables]) |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
673 |
next_tick = NextTick(variables) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
674 |
while next_tick is not None: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
675 |
values = [] |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
676 |
for item, data in variables: |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
677 |
if len(data) > 0: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
678 |
if next_tick == data[0][0]: |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
679 |
var_type = item.GetVariableType() |
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
680 |
if var_type in ["STRING", "WSTRING"]: |
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
681 |
value = item.GetRawValue(int(data.pop(0)[2])) |
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
682 |
if var_type == "STRING": |
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
683 |
values.append("'%s'" % value) |
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
684 |
else: |
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
685 |
values.append('"%s"' % value) |
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
686 |
else: |
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
687 |
values.append("%.3f" % data.pop(0)[1]) |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
688 |
else: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
689 |
values.append("") |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
690 |
else: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
691 |
values.append("") |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
692 |
text += "%d;%s;\n" % (next_tick, ";".join(values)) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
693 |
next_tick = NextTick(variables) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
694 |
self.ParentWindow.SetCopyBuffer(text) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
695 |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
696 |
def OnExportGraphButton(self, event): |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
697 |
items = reduce(lambda x, y: x + y, |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
698 |
[panel.GetItems() for panel in self.GraphicPanels], |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
699 |
[]) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
700 |
variables = [(item, [entry for entry in item.GetData()]) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
701 |
for item in items |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
702 |
if item.IsNumVariable()] |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
703 |
wx.CallAfter(self.CopyDataToClipboard, variables) |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
704 |
event.Skip() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
705 |
|
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
706 |
def OnPositionChanging(self, event): |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
707 |
if len(self.Ticks) > 0: |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
708 |
self.StartTick = self.Ticks[0] + event.GetPosition() |
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
709 |
self.Fixed = True |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
710 |
self.ForceRefresh() |
902
ffa8ee5ee2fe
Adding support for defining a time range for DebugVariablePanel graphics and navigating across the recording.
Laurent Bessard
parents:
898
diff
changeset
|
711 |
event.Skip() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
712 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
713 |
def GetRange(self): |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
714 |
return self.StartTick, self.StartTick + self.CurrentRange |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
715 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
716 |
def GetViewerIndex(self, viewer): |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
717 |
if viewer in self.GraphicPanels: |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
718 |
return self.GraphicPanels.index(viewer) |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
719 |
return None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
720 |
|
934
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
721 |
def IsViewerFirst(self, viewer): |
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
722 |
return viewer == self.GraphicPanels[0] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
723 |
|
934
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
724 |
def HighlightPreviousViewer(self, viewer): |
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
725 |
if self.IsViewerFirst(viewer): |
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
726 |
return |
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
727 |
idx = self.GetViewerIndex(viewer) |
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
728 |
if idx is None: |
fc00c11feff5
Fixed highlights for dropping graphs between the others
Laurent Bessard
parents:
932
diff
changeset
|
729 |
return |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
730 |
self.GraphicPanels[idx-1].SetHighlight(HIGHLIGHT_AFTER) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
731 |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
732 |
def ResetVariableNameMask(self): |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
733 |
items = [] |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
734 |
for panel in self.GraphicPanels: |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
735 |
items.extend(panel.GetItems()) |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
736 |
if len(items) > 1: |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
737 |
self.VariableNameMask = reduce( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
738 |
compute_mask, [item.GetVariable().split('.') for item in items]) |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
739 |
elif len(items) > 0: |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
740 |
self.VariableNameMask = items[0].GetVariable().split('.')[:-1] + ['*'] |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
741 |
else: |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
742 |
self.VariableNameMask = [] |
931
da4970f6c46c
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
930
diff
changeset
|
743 |
self.MaskLabel.ChangeValue(".".join(self.VariableNameMask)) |
da4970f6c46c
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
930
diff
changeset
|
744 |
self.MaskLabel.SetInsertionPoint(self.MaskLabel.GetLastPosition()) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
745 |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
746 |
def GetVariableNameMask(self): |
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
747 |
return self.VariableNameMask |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
748 |
|
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1737
diff
changeset
|
749 |
def InsertValue(self, iec_path, idx=None, force=False, graph=False): |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
750 |
for panel in self.GraphicPanels: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
751 |
if panel.GetItem(iec_path) is not None: |
1217
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
752 |
if graph and isinstance(panel, DebugVariableTextViewer): |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
753 |
self.ToggleViewerType(panel) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
754 |
return |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
755 |
if idx is None: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
756 |
idx = len(self.GraphicPanels) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
757 |
item = DebugVariableItem(self, iec_path, True) |
1365
debc97102b23
Added support for optimizing debug, preventing to filling buffers with only the last value for debug data consumers that only show the current state
Laurent Bessard
parents:
1364
diff
changeset
|
758 |
result = self.AddDataConsumer(iec_path.upper(), item, True) |
814 | 759 |
if result is not None or force: |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
760 |
|
1209 | 761 |
self.Freeze() |
1214
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
762 |
if item.IsNumVariable() and graph: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
763 |
panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
764 |
if self.CursorTick is not None: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
765 |
panel.SetCursorTick(self.CursorTick) |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
766 |
else: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
767 |
panel = DebugVariableTextViewer(self.GraphicsWindow, self, [item]) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
768 |
if idx is not None: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
769 |
self.GraphicPanels.insert(idx, panel) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
770 |
else: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
771 |
self.GraphicPanels.append(panel) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
772 |
self.ResetVariableNameMask() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
773 |
self.RefreshGraphicsSizer() |
1209 | 774 |
self.Thaw() |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
775 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
776 |
|
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1737
diff
changeset
|
777 |
def MoveValue(self, iec_path, idx=None, graph=False): |
919
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
778 |
if idx is None: |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
779 |
idx = len(self.GraphicPanels) |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
780 |
source_panel = None |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
781 |
item = None |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
782 |
for panel in self.GraphicPanels: |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
783 |
item = panel.GetItem(iec_path) |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
784 |
if item is not None: |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
785 |
source_panel = panel |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
786 |
break |
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
787 |
if source_panel is not None: |
1214
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
788 |
source_panel_idx = self.GraphicPanels.index(source_panel) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
789 |
|
1218 | 790 |
if (len(source_panel.GetItems()) == 1): |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
791 |
|
1218 | 792 |
if source_panel_idx < idx: |
793 |
self.GraphicPanels.insert(idx, source_panel) |
|
794 |
self.GraphicPanels.pop(source_panel_idx) |
|
795 |
elif source_panel_idx > idx: |
|
796 |
self.GraphicPanels.pop(source_panel_idx) |
|
797 |
self.GraphicPanels.insert(idx, source_panel) |
|
798 |
else: |
|
799 |
return |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
800 |
|
1217
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
801 |
else: |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
802 |
source_panel.RemoveItem(item) |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
803 |
source_size = source_panel.GetSize() |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
804 |
if item.IsNumVariable() and graph: |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
805 |
panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, [item], GRAPH_PARALLEL) |
1264 | 806 |
panel.SetCanvasHeight(source_size.height) |
1217
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
807 |
if self.CursorTick is not None: |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
808 |
panel.SetCursorTick(self.CursorTick) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
809 |
|
1217
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
810 |
else: |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
811 |
panel = DebugVariableTextViewer(self.GraphicsWindow, self, [item]) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
812 |
|
1217
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
813 |
self.GraphicPanels.insert(idx, panel) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
814 |
|
1217
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
815 |
if source_panel.ItemsIsEmpty(): |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
816 |
if source_panel.HasCapture(): |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
817 |
source_panel.ReleaseMouse() |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
818 |
source_panel.Destroy() |
b64dcc1a011f
Fixed bug when moving TextViewer and replacing right click by double click when adding graph in Debug Variable Panel
Laurent Bessard
parents:
1216
diff
changeset
|
819 |
self.GraphicPanels.remove(source_panel) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
820 |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
821 |
self.ResetVariableNameMask() |
919
4a36e38e51d3
Fix bug in DebugVariablePanel when manipulating graph layout and adding drag'n drop graph from parallel graphs and moving graphs order
Laurent Bessard
parents:
916
diff
changeset
|
822 |
self.RefreshGraphicsSizer() |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
823 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
824 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
825 |
def MergeGraphs(self, source, target_idx, merge_type, force=False): |
909
852af7c6f0ef
Adding support for change DebugVariablePanel 2D graphs layout using drag'n drop
Laurent Bessard
parents:
907
diff
changeset
|
826 |
source_item = None |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
827 |
source_panel = None |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
828 |
for panel in self.GraphicPanels: |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
829 |
source_item = panel.GetItem(source) |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
830 |
if source_item is not None: |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
831 |
source_panel = panel |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
832 |
break |
909
852af7c6f0ef
Adding support for change DebugVariablePanel 2D graphs layout using drag'n drop
Laurent Bessard
parents:
907
diff
changeset
|
833 |
if source_item is None: |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
834 |
item = DebugVariableItem(self, source, True) |
909
852af7c6f0ef
Adding support for change DebugVariablePanel 2D graphs layout using drag'n drop
Laurent Bessard
parents:
907
diff
changeset
|
835 |
if item.IsNumVariable(): |
1365
debc97102b23
Added support for optimizing debug, preventing to filling buffers with only the last value for debug data consumers that only show the current state
Laurent Bessard
parents:
1364
diff
changeset
|
836 |
result = self.AddDataConsumer(source.upper(), item, True) |
909
852af7c6f0ef
Adding support for change DebugVariablePanel 2D graphs layout using drag'n drop
Laurent Bessard
parents:
907
diff
changeset
|
837 |
if result is not None or force: |
852af7c6f0ef
Adding support for change DebugVariablePanel 2D graphs layout using drag'n drop
Laurent Bessard
parents:
907
diff
changeset
|
838 |
source_item = item |
945
c1159acb0886
Added support for drag'n dropping non-numeric variables
Laurent Bessard
parents:
943
diff
changeset
|
839 |
if source_item is not None and source_item.IsNumVariable(): |
1041
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
840 |
if source_panel is not None: |
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
841 |
source_size = source_panel.GetSize() |
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
842 |
else: |
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
843 |
source_size = None |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
844 |
target_panel = self.GraphicPanels[target_idx] |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
845 |
graph_type = target_panel.GraphType |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
846 |
if target_panel != source_panel: |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
847 |
if (merge_type == GRAPH_PARALLEL and graph_type != merge_type or |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
848 |
merge_type == GRAPH_ORTHOGONAL and |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
849 |
(graph_type == GRAPH_PARALLEL and len(target_panel.Items) > 1 or |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
850 |
graph_type == GRAPH_ORTHOGONAL and len(target_panel.Items) >= 3)): |
909
852af7c6f0ef
Adding support for change DebugVariablePanel 2D graphs layout using drag'n drop
Laurent Bessard
parents:
907
diff
changeset
|
851 |
return |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
852 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
853 |
if source_panel is not None: |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
854 |
source_panel.RemoveItem(source_item) |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
855 |
if source_panel.ItemsIsEmpty(): |
943
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
856 |
if source_panel.HasCapture(): |
da7f80e04a54
Fixed panels displaying non-numeric variables in DebugVariablePanel
Laurent Bessard
parents:
938
diff
changeset
|
857 |
source_panel.ReleaseMouse() |
1216
598ff0043ad3
Fixed bug in DebugVariablePanel on Windows
Laurent Bessard
parents:
1215
diff
changeset
|
858 |
source_panel.Destroy() |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
859 |
self.GraphicPanels.remove(source_panel) |
936
364d178df2d3
Added button for exporting individual graph values to clipboard
Laurent Bessard
parents:
935
diff
changeset
|
860 |
elif (merge_type != graph_type and len(target_panel.Items) == 2): |
364d178df2d3
Added button for exporting individual graph values to clipboard
Laurent Bessard
parents:
935
diff
changeset
|
861 |
target_panel.RemoveItem(source_item) |
364d178df2d3
Added button for exporting individual graph values to clipboard
Laurent Bessard
parents:
935
diff
changeset
|
862 |
else: |
364d178df2d3
Added button for exporting individual graph values to clipboard
Laurent Bessard
parents:
935
diff
changeset
|
863 |
target_panel = None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
864 |
|
936
364d178df2d3
Added button for exporting individual graph values to clipboard
Laurent Bessard
parents:
935
diff
changeset
|
865 |
if target_panel is not None: |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
866 |
target_panel.AddItem(source_item) |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
867 |
target_panel.GraphType = merge_type |
1041
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
868 |
size = target_panel.GetSize() |
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
869 |
if merge_type == GRAPH_ORTHOGONAL: |
1264 | 870 |
target_panel.SetCanvasHeight(size.width) |
871 |
elif source_size is not None and source_panel != target_panel: |
|
872 |
target_panel.SetCanvasHeight(size.height + source_size.height) |
|
1265
242512c56ea1
Fix bug in graphic viewer height when drag'n dropping variable in parallel mode
Laurent Bessard
parents:
1264
diff
changeset
|
873 |
else: |
242512c56ea1
Fix bug in graphic viewer height when drag'n dropping variable in parallel mode
Laurent Bessard
parents:
1264
diff
changeset
|
874 |
target_panel.SetCanvasHeight(size.height) |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
875 |
target_panel.ResetGraphics() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
876 |
|
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
877 |
self.ResetVariableNameMask() |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
878 |
self.RefreshGraphicsSizer() |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
879 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
880 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
881 |
def DeleteValue(self, source_panel, item=None): |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
882 |
source_idx = self.GetViewerIndex(source_panel) |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
883 |
if source_idx is not None: |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
884 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
885 |
if item is None: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
886 |
source_panel.ClearItems() |
1216
598ff0043ad3
Fixed bug in DebugVariablePanel on Windows
Laurent Bessard
parents:
1215
diff
changeset
|
887 |
source_panel.Destroy() |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
888 |
self.GraphicPanels.remove(source_panel) |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
889 |
self.ResetVariableNameMask() |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
890 |
self.RefreshGraphicsSizer() |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
891 |
else: |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
892 |
source_panel.RemoveItem(item) |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
893 |
if source_panel.ItemsIsEmpty(): |
1216
598ff0043ad3
Fixed bug in DebugVariablePanel on Windows
Laurent Bessard
parents:
1215
diff
changeset
|
894 |
source_panel.Destroy() |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
895 |
self.GraphicPanels.remove(source_panel) |
928
a94e7fea7051
Improved matplotlib graphic debug panel implementation
Laurent Bessard
parents:
927
diff
changeset
|
896 |
self.ResetVariableNameMask() |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
897 |
self.RefreshGraphicsSizer() |
1227
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
898 |
if len(self.GraphicPanels) == 0: |
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
899 |
self.Fixed = False |
01e86190f8c7
Fixed tick not refreshed when in DebugVariablePanel when variable in it
Laurent Bessard
parents:
1218
diff
changeset
|
900 |
self.ResetCursorTick() |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
901 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
902 |
|
1214
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
903 |
def ToggleViewerType(self, panel): |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
904 |
panel_idx = self.GetViewerIndex(panel) |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
905 |
if panel_idx is not None: |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
906 |
self.GraphicPanels.remove(panel) |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
907 |
items = panel.GetItems() |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
908 |
if isinstance(panel, DebugVariableGraphicViewer): |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
909 |
for idx, item in enumerate(items): |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
910 |
new_panel = DebugVariableTextViewer(self.GraphicsWindow, self, [item]) |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
911 |
self.GraphicPanels.insert(panel_idx + idx, new_panel) |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
912 |
else: |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
913 |
new_panel = DebugVariableGraphicViewer(self.GraphicsWindow, self, items, GRAPH_PARALLEL) |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
914 |
self.GraphicPanels.insert(panel_idx, new_panel) |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
915 |
panel.Destroy() |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
916 |
self.RefreshGraphicsSizer() |
2ef048b5383c
Added support for opening text viewer by default and toggling between GraphicViewer and TextViewer
Laurent Bessard
parents:
1213
diff
changeset
|
917 |
self.ForceRefresh() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
918 |
|
887
d3c6c4ab8b28
Adding support for displaying graphs of debugged numeric variables in 2D and 3D in DebugVariablePanel
Laurent Bessard
parents:
878
diff
changeset
|
919 |
def ResetGraphicsValues(self): |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
920 |
self.Ticks = numpy.array([]) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
921 |
self.StartTick = 0 |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
922 |
for panel in self.GraphicPanels: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
923 |
panel.ResetItemsData() |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
924 |
self.ResetCursorTick() |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
925 |
|
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
926 |
def RefreshGraphicsWindowScrollbars(self): |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
927 |
xstart, ystart = self.GraphicsWindow.GetViewStart() |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
928 |
window_size = self.GraphicsWindow.GetClientSize() |
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
929 |
vwidth, vheight = self.GraphicsSizer.GetMinSize() |
887
d3c6c4ab8b28
Adding support for displaying graphs of debugged numeric variables in 2D and 3D in DebugVariablePanel
Laurent Bessard
parents:
878
diff
changeset
|
930 |
posx = max(0, min(xstart, (vwidth - window_size[0]) / SCROLLBAR_UNIT)) |
d3c6c4ab8b28
Adding support for displaying graphs of debugged numeric variables in 2D and 3D in DebugVariablePanel
Laurent Bessard
parents:
878
diff
changeset
|
931 |
posy = max(0, min(ystart, (vheight - window_size[1]) / SCROLLBAR_UNIT)) |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
932 |
self.GraphicsWindow.Scroll(posx, posy) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
933 |
self.GraphicsWindow.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
934 |
vwidth / SCROLLBAR_UNIT, vheight / SCROLLBAR_UNIT, |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1766
diff
changeset
|
935 |
posx, posy) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
936 |
|
988
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
980
diff
changeset
|
937 |
def OnGraphicsWindowEraseBackground(self, event): |
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
980
diff
changeset
|
938 |
pass |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
939 |
|
988
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
980
diff
changeset
|
940 |
def OnGraphicsWindowPaint(self, event): |
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
980
diff
changeset
|
941 |
self.RefreshView() |
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
980
diff
changeset
|
942 |
event.Skip() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1578
diff
changeset
|
943 |
|
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
944 |
def OnGraphicsWindowResize(self, event): |
1041
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
945 |
size = self.GetSize() |
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
946 |
for panel in self.GraphicPanels: |
736ec395399a
Fixed graph panel size when modifying DebugVariablePanel layout
Laurent Bessard
parents:
1040
diff
changeset
|
947 |
panel_size = panel.GetSize() |
1766
c1e5b9f19483
clean-up: fix PEP8 E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
948 |
if isinstance(panel, DebugVariableGraphicViewer) and \ |
c1e5b9f19483
clean-up: fix PEP8 E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
949 |
panel.GraphType == GRAPH_ORTHOGONAL and \ |
c1e5b9f19483
clean-up: fix PEP8 E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
950 |
panel_size.width == panel_size.height: |
1264 | 951 |
panel.SetCanvasHeight(size.width) |
916
697d8b77d716
Improved matplotlib graphic debug panel implementation, adding force, release, split and delete graph buttons, replacing data grid by adding panel displaying non-numeric data between graphs
Laurent Bessard
parents:
912
diff
changeset
|
952 |
self.RefreshGraphicsWindowScrollbars() |
1194
0cf48602ee24
Fixed bug with moving cursor with keyboard in DebugVariablePanel
Laurent Bessard
parents:
1193
diff
changeset
|
953 |
self.GraphicsSizer.Layout() |
924
5f2cc382be8c
Added support for displaying string variables variations in a graph and cursor on graphs
Laurent Bessard
parents:
919
diff
changeset
|
954 |
event.Skip() |
1040
af8a1aee3584
Fixed MouseWheel behavior in DebugVariablePanel, change graph range only if CTRL is pressed
Laurent Bessard
parents:
1008
diff
changeset
|
955 |
|
af8a1aee3584
Fixed MouseWheel behavior in DebugVariablePanel, change graph range only if CTRL is pressed
Laurent Bessard
parents:
1008
diff
changeset
|
956 |
def OnGraphicsWindowMouseWheel(self, event): |
af8a1aee3584
Fixed MouseWheel behavior in DebugVariablePanel, change graph range only if CTRL is pressed
Laurent Bessard
parents:
1008
diff
changeset
|
957 |
if self.VetoScrollEvent: |
af8a1aee3584
Fixed MouseWheel behavior in DebugVariablePanel, change graph range only if CTRL is pressed
Laurent Bessard
parents:
1008
diff
changeset
|
958 |
self.VetoScrollEvent = False |
af8a1aee3584
Fixed MouseWheel behavior in DebugVariablePanel, change graph range only if CTRL is pressed
Laurent Bessard
parents:
1008
diff
changeset
|
959 |
else: |
af8a1aee3584
Fixed MouseWheel behavior in DebugVariablePanel, change graph range only if CTRL is pressed
Laurent Bessard
parents:
1008
diff
changeset
|
960 |
event.Skip() |