author | Edouard Tisserant |
Fri, 05 Jan 2018 15:39:02 +0100 | |
changeset 1887 | 1b9907ef770b |
parent 1881 | 091005ec69c4 |
child 2437 | 105c20fdeb19 |
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
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:
1365
diff
changeset
|
23 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
814 | 24 |
|
1881
091005ec69c4
fix pylint py3k conversion warning: "(no-absolute-import) import missing `from __future__ import absolute_import`"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1878
diff
changeset
|
25 |
|
091005ec69c4
fix pylint py3k conversion warning: "(no-absolute-import) import missing `from __future__ import absolute_import`"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1878
diff
changeset
|
26 |
from __future__ import absolute_import |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
27 |
from collections import OrderedDict |
814 | 28 |
|
29 |
import wx |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
30 |
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
|
31 |
|
814 | 32 |
from dialogs.ForceVariableDialog import ForceVariableDialog |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
33 |
|
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
34 |
# Viewer highlight types |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
35 |
[HIGHLIGHT_NONE, |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
36 |
HIGHLIGHT_BEFORE, |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
37 |
HIGHLIGHT_AFTER, |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
38 |
HIGHLIGHT_LEFT, |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
39 |
HIGHLIGHT_RIGHT, |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
40 |
HIGHLIGHT_RESIZE] = range(6) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
41 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
42 |
# Viewer highlight styles |
1823
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
43 |
HIGHLIGHT = { |
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
44 |
} |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
45 |
|
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
46 |
# ------------------------------------------------------------------------------- |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
47 |
# Base Debug Variable Viewer Class |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
48 |
# ------------------------------------------------------------------------------- |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
49 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
50 |
|
1831
56b48961cc68
fix (old-style-class) Old-style class defined error for most parts of
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1823
diff
changeset
|
51 |
class DebugVariableViewer(object): |
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
52 |
""" |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
53 |
Class that implements a generic viewer that display a list of variable values |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
54 |
This class has to be inherited to effectively display variable values |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
55 |
""" |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
56 |
|
1852
70c1cc354a8f
fix pylint warning '(dangerous-default-value) Dangerous default value {} as argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1850
diff
changeset
|
57 |
def __init__(self, window, items=None): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
58 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
59 |
Constructor |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
60 |
@param window: Reference to the Debug Variable Panel |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
61 |
@param items: List of DebugVariableItem displayed by Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
62 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
63 |
self.ParentWindow = window |
1852
70c1cc354a8f
fix pylint warning '(dangerous-default-value) Dangerous default value {} as argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1850
diff
changeset
|
64 |
items = [] if items is None else items |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
65 |
self.ItemsDict = OrderedDict([(item.GetVariable(), item) |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
66 |
for item in items]) |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
67 |
self.Items = self.ItemsDict.viewvalues() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
68 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
69 |
# Variable storing current highlight displayed in Viewer |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
70 |
self.Highlight = HIGHLIGHT_NONE |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
71 |
# List of buttons |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
72 |
self.Buttons = [] |
1807
5562f34f2fc2
lazy initialization of highlight pens and brushes for DebugVariableViewer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
73 |
self.InitHighlightPensBrushes() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
74 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
75 |
def __del__(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
76 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
77 |
Destructor |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
78 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
79 |
# Remove reference to Debug Variable Panel |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
80 |
self.ParentWindow = None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
81 |
|
1807
5562f34f2fc2
lazy initialization of highlight pens and brushes for DebugVariableViewer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
82 |
def InitHighlightPensBrushes(self): |
5562f34f2fc2
lazy initialization of highlight pens and brushes for DebugVariableViewer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
83 |
""" |
5562f34f2fc2
lazy initialization of highlight pens and brushes for DebugVariableViewer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
84 |
Init global pens and brushes |
5562f34f2fc2
lazy initialization of highlight pens and brushes for DebugVariableViewer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
85 |
""" |
1823
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
86 |
if not HIGHLIGHT: |
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
87 |
HIGHLIGHT['DROP_PEN'] = wx.Pen(wx.Colour(0, 128, 255)) |
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
88 |
HIGHLIGHT['DROP_BRUSH'] = wx.Brush(wx.Colour(0, 128, 255, 128)) |
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
89 |
HIGHLIGHT['RESIZE_PEN'] = wx.Pen(wx.Colour(200, 200, 200)) |
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
90 |
HIGHLIGHT['RESIZE_BRUSH'] = wx.Brush(wx.Colour(200, 200, 200)) |
1807
5562f34f2fc2
lazy initialization of highlight pens and brushes for DebugVariableViewer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
91 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
92 |
def GetIndex(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
93 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
94 |
Return position of Viewer in Debug Variable Panel |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
95 |
@return: Position of Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
96 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
97 |
return self.ParentWindow.GetViewerIndex(self) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
98 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
99 |
def GetItem(self, variable): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
100 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
101 |
Return item storing values of a variable |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
102 |
@param variable: Variable path |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
103 |
@return: Item storing values of this variable |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
104 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
105 |
return self.ItemsDict.get(variable, None) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
106 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
107 |
def GetItems(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
108 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
109 |
Return items displayed by Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
110 |
@return: List of items displayed in Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
111 |
""" |
1202
3d8c87ab2b5d
Fixed bug when export all items values to clipboard in DebugVariablePanel
Laurent Bessard
parents:
1200
diff
changeset
|
112 |
return self.ItemsDict.values() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
113 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
114 |
def AddItem(self, item): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
115 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
116 |
Add an item to the list of items displayed by Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
117 |
@param item: Item to add to the list |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
118 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
119 |
self.ItemsDict[item.GetVariable()] = item |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
120 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
121 |
def RemoveItem(self, item): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
122 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
123 |
Remove an item from the list of items displayed by Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
124 |
@param item: Item to remove from the list |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
125 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
126 |
self.ItemsDict.pop(item.GetVariable(), None) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
127 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
128 |
def ClearItems(self): |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
129 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
130 |
Clear list of items displayed by Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
131 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
132 |
# Unsubscribe every items of the list |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
133 |
for item in self.Items: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
134 |
self.ParentWindow.RemoveDataConsumer(item) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
135 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
136 |
# Clear list |
1206
35046bc74554
Fixed bug when closing graph in Debug Variable Panel
Laurent Bessard
parents:
1202
diff
changeset
|
137 |
self.ItemsDict.clear() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
138 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
139 |
def ItemsIsEmpty(self): |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
140 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
141 |
Return if list of items displayed by Viewer is empty |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
142 |
@return: True if list is empty |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
143 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
144 |
return len(self.Items) == 0 |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
145 |
|
1207 | 146 |
def SubscribeAllDataConsumers(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
147 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
148 |
Function that unsubscribe and remove every item that store values of |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
149 |
a variable that doesn't exist in PLC anymore |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
150 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
151 |
for item in self.ItemsDict.values()[:]: |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
152 |
iec_path = item.GetVariable() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
153 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
154 |
# Check that variablepath exist in PLC |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
155 |
if self.ParentWindow.GetDataType(iec_path) is None: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
156 |
# If not, unsubscribe and remove it |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
157 |
self.ParentWindow.RemoveDataConsumer(item) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
158 |
self.RemoveItem(item) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
159 |
else: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
160 |
# If it exist, resubscribe and refresh data type |
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:
1362
diff
changeset
|
161 |
self.ParentWindow.AddDataConsumer(iec_path.upper(), item, True) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
162 |
item.RefreshVariableType() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
163 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
164 |
def ResetItemsData(self): |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
165 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
166 |
Reset data stored in every items displayed in Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
167 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
168 |
for item in self.Items: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
169 |
item.ResetData() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
170 |
|
1212 | 171 |
def GetItemsMinCommonTick(self): |
172 |
""" |
|
173 |
Return the minimum tick common to all iems displayed in Viewer |
|
174 |
@return: Minimum common tick between items |
|
175 |
""" |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
176 |
return reduce(max, [item.GetData()[0, 0] |
1212 | 177 |
for item in self.Items |
178 |
if len(item.GetData()) > 0], 0) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
179 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
180 |
def RefreshViewer(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
181 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
182 |
Method that refresh the content displayed by Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
183 |
Need to be overridden by inherited classes |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
184 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
185 |
pass |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
186 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
187 |
def SetHighlight(self, highlight): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
188 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
189 |
Set Highlight type displayed in Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
190 |
@return: True if highlight has changed |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
191 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
192 |
# Return immediately if highlight don't change |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
193 |
if self.Highlight == highlight: |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
194 |
return False |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
195 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
196 |
self.Highlight = highlight |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
197 |
return True |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
198 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
199 |
def GetButtons(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
200 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
201 |
Return list of buttons defined in Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
202 |
@return: List of buttons |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
203 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
204 |
return self.Buttons |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
205 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
206 |
def IsOverButton(self, x, y): |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
207 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
208 |
Return if point is over one button of Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
209 |
@param x: X coordinate of point |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
210 |
@param y: Y coordinate of point |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
211 |
@return: button where point is over |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
212 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
213 |
for button in self.GetButtons(): |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
214 |
if button.HitTest(x, y): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
215 |
return button |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
216 |
return None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
217 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
218 |
def HandleButton(self, x, y): |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
219 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
220 |
Search for the button under point and if found execute associated |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
221 |
callback |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
222 |
@param x: X coordinate of point |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
223 |
@param y: Y coordinate of point |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
224 |
@return: True if a button was found and callback executed |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
225 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
226 |
button = self.IsOverButton(x, y) |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
227 |
if button is None: |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
228 |
return False |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
229 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
230 |
button.ProcessCallback() |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
231 |
return True |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
232 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
233 |
def ShowButtons(self, show): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
234 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
235 |
Set display state of buttons in Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
236 |
@param show: Display state (True if buttons must be displayed) |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
237 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
238 |
# Change display of every buttons |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
239 |
for button in self.Buttons: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
240 |
button.Show(show) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
241 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
242 |
# Refresh button positions |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
243 |
self.RefreshButtonsPosition() |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
244 |
self.RefreshViewer() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
245 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
246 |
def RefreshButtonsPosition(self): |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
247 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
248 |
Function that refresh buttons position in Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
249 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
250 |
# Get Viewer size |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1841
diff
changeset
|
251 |
width, _height = self.GetSize() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
252 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
253 |
# Buttons are align right so we calculate buttons positions in |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
254 |
# reverse order |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
255 |
buttons = self.Buttons[:] |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
256 |
buttons.reverse() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
257 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
258 |
# Position offset on x coordinate |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
259 |
x_offset = 0 |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
260 |
for button in buttons: |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
261 |
# Buttons are stacked right, removing those that are not active |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
262 |
if button.IsEnabled(): |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
263 |
# Update button position according to button width and offset |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
264 |
# on x coordinate |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1841
diff
changeset
|
265 |
w, _h = button.GetSize() |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
266 |
button.SetPosition(width - 5 - w - x_offset, 5) |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
267 |
# Update offset on x coordinate |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
268 |
x_offset += w + 2 |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
269 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
270 |
def DrawCommonElements(self, dc, buttons=None): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
271 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
272 |
Function that draw common graphics for every Viewers |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
273 |
@param dc: wx.DC object corresponding to Device context where drawing |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
274 |
common graphics |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
275 |
@param buttons: List of buttons to draw if different from default |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
276 |
(default None) |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
277 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
278 |
# Get Viewer size |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
279 |
width, height = self.GetSize() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
280 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
281 |
# Set dc styling for drop before or drop after highlight |
1823
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
282 |
dc.SetPen(HIGHLIGHT['DROP_PEN']) |
1e9a67d68612
fix commit "lazy initialization of highlight pens and brushes
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1807
diff
changeset
|
283 |
dc.SetBrush(HIGHLIGHT['DROP_BRUSH']) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
284 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
285 |
# Draw line at upper side of Viewer if highlight is drop before |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
286 |
if self.Highlight == HIGHLIGHT_BEFORE: |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
287 |
dc.DrawLine(0, 1, width - 1, 1) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
288 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
289 |
# Draw line at lower side of Viewer if highlight is drop before |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
290 |
elif self.Highlight == HIGHLIGHT_AFTER: |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
291 |
dc.DrawLine(0, height - 1, width - 1, height - 1) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
292 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
293 |
# If no specific buttons are defined, get default buttons |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
294 |
if buttons is None: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
295 |
buttons = self.Buttons |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
296 |
# Draw buttons |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
297 |
for button in buttons: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
298 |
button.Draw(dc) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
299 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
300 |
# If graph dragging is processing |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
301 |
if self.ParentWindow.IsDragging(): |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
302 |
destBBox = self.ParentWindow.GetDraggingAxesClippingRegion(self) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
303 |
srcPos = self.ParentWindow.GetDraggingAxesPosition(self) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
304 |
if destBBox.width > 0 and destBBox.height > 0: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
305 |
srcPanel = self.ParentWindow.DraggingAxesPanel |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
306 |
srcBBox = srcPanel.GetAxesBoundingBox() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
307 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
308 |
srcX = srcBBox.x - (srcPos.x if destBBox.x == 0 else 0) |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
309 |
srcY = srcBBox.y - (srcPos.y if destBBox.y == 0 else 0) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
310 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
311 |
srcBmp = _convert_agg_to_wx_bitmap( |
1878
fb73a6b6622d
fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1852
diff
changeset
|
312 |
srcPanel.get_renderer(), None) |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
313 |
srcDC = wx.MemoryDC() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
314 |
srcDC.SelectObject(srcBmp) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
315 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
316 |
dc.Blit(destBBox.x, destBBox.y, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
317 |
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
|
318 |
srcDC, srcX, srcY) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
319 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
320 |
def OnEnter(self, event): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
321 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
322 |
Function called when entering Viewer |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
323 |
@param event: wx.MouseEvent |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
324 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
325 |
# Display buttons |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
326 |
self.ShowButtons(True) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
327 |
event.Skip() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
328 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
329 |
def OnLeave(self, event): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
330 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
331 |
Function called when leaving Viewer |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
332 |
@param event: wx.MouseEvent |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
333 |
""" |
1209 | 334 |
# Hide buttons |
335 |
self.ShowButtons(False) |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
336 |
event.Skip() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
337 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
338 |
def OnCloseButton(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
339 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
340 |
Function called when Close button is pressed |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
341 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
342 |
wx.CallAfter(self.ParentWindow.DeleteValue, self) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
343 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
344 |
def OnForceButton(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
345 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
346 |
Function called when Force button is pressed |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
347 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
348 |
self.ForceValue(self.ItemsDict.values()[0]) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
349 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
350 |
def OnReleaseButton(self): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
351 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
352 |
Function called when Release button is pressed |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
353 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
354 |
self.ReleaseValue(self.ItemsDict.values()[0]) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
355 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
356 |
def OnMouseDragging(self, x, y): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
357 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
358 |
Function called when mouse is dragged over Viewer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
359 |
@param x: X coordinate of mouse pointer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
360 |
@param y: Y coordinate of mouse pointer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
361 |
""" |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
362 |
xw, yw = self.GetPosition() |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
363 |
# Refresh highlight in Debug Variable Panel (highlight can be displayed |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
364 |
# in another Viewer |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
365 |
self.ParentWindow.RefreshHighlight(x + xw, y + yw) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
366 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
367 |
def RefreshHighlight(self, x, y): |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
368 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
369 |
Function called by Debug Variable Panel asking Viewer to refresh |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
370 |
highlight according to mouse position |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
371 |
@param x: X coordinate of mouse pointer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
372 |
@param y: Y coordinate of mouse pointer |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
373 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
374 |
# Get Viewer size |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1841
diff
changeset
|
375 |
_width, height = self.GetSize() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
376 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
377 |
# Mouse is in the first half of Viewer |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
378 |
if y < height / 2: |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
379 |
# If Viewer is the upper one, draw drop before highlight |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
380 |
if self.ParentWindow.IsViewerFirst(self): |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
381 |
self.SetHighlight(HIGHLIGHT_BEFORE) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
382 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
383 |
# Else draw drop after highlight in previous Viewer |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
384 |
else: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
385 |
self.SetHighlight(HIGHLIGHT_NONE) |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
386 |
self.ParentWindow.HighlightPreviousViewer(self) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
387 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
388 |
# Mouse is in the second half of Viewer, draw drop after highlight |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
389 |
else: |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
390 |
self.SetHighlight(HIGHLIGHT_AFTER) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
391 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
392 |
def OnEraseBackground(self, event): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
393 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
394 |
Function called when Viewer background is going to be erase |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
395 |
@param event: wx.EraseEvent |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
396 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
397 |
# Prevent flicker on Windows |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
398 |
pass |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
399 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
400 |
def OnResize(self, event): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
401 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
402 |
Function called when Viewer size changed |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
403 |
@param event: wx.ResizeEvent |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
404 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
405 |
# Refresh button positions |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
406 |
self.RefreshButtonsPosition() |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
407 |
self.ParentWindow.ForceRefresh() |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
408 |
event.Skip() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
409 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
410 |
def ForceValue(self, item): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
411 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
412 |
Force value of item given |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
413 |
@param item: Item to force value |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
414 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
415 |
# Check variable data type |
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
416 |
iec_path = item.GetVariable() |
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
417 |
iec_type = self.ParentWindow.GetDataType(iec_path) |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
418 |
# Return immediately if not found |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
419 |
if iec_type is None: |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
420 |
return |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
421 |
|
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
422 |
# Open a dialog to enter varaible forced value |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
423 |
dialog = ForceVariableDialog(self, iec_type, str(item.GetValue())) |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
424 |
if dialog.ShowModal() == wx.ID_OK: |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
425 |
self.ParentWindow.ForceDataValue(iec_path.upper(), |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
426 |
dialog.GetValue()) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
427 |
|
1198
8b4e6bd0aa92
Separated old table debug variable panel and new graphic debug variable panel
Laurent Bessard
parents:
1194
diff
changeset
|
428 |
def ReleaseValue(self, item): |
1200
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
429 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
430 |
Release value of item given |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
431 |
@param item: Item to release value |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
432 |
""" |
501cb0bb4c05
Splitted DebugVariableGraphicPanel.py into several files
Laurent Bessard
parents:
1199
diff
changeset
|
433 |
self.ParentWindow.ReleaseDataValue( |
1878
fb73a6b6622d
fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1852
diff
changeset
|
434 |
item.GetVariable().upper()) |