mwxlib 0.99.0__py3-none-any.whl → 1.7.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mwx/__init__.py +7 -5
- mwx/bookshelf.py +133 -57
- mwx/controls.py +555 -518
- mwx/framework.py +569 -544
- mwx/graphman.py +708 -702
- mwx/images.py +29 -0
- mwx/matplot2.py +226 -217
- mwx/matplot2g.py +733 -657
- mwx/matplot2lg.py +192 -183
- mwx/mgplt.py +21 -23
- mwx/nutshell.py +1162 -1019
- mwx/plugins/ffmpeg_view.py +74 -76
- mwx/plugins/fft_view.py +14 -16
- mwx/plugins/frame_listview.py +56 -53
- mwx/plugins/line_profile.py +2 -2
- mwx/py/filling.py +9 -8
- mwx/testsuite.py +38 -0
- mwx/utilus.py +273 -208
- mwx/wxmon.py +45 -40
- mwx/wxpdb.py +81 -92
- mwx/wxwil.py +18 -18
- mwx/wxwit.py +49 -51
- {mwxlib-0.99.0.dist-info → mwxlib-1.7.13.dist-info}/METADATA +19 -17
- mwxlib-1.7.13.dist-info/RECORD +28 -0
- {mwxlib-0.99.0.dist-info → mwxlib-1.7.13.dist-info}/WHEEL +1 -1
- mwxlib-0.99.0.dist-info/LICENSE +0 -21
- mwxlib-0.99.0.dist-info/RECORD +0 -28
- {mwxlib-0.99.0.dist-info → mwxlib-1.7.13.dist-info}/top_level.txt +0 -0
mwx/wxmon.py
CHANGED
|
@@ -7,17 +7,17 @@ import wx
|
|
|
7
7
|
import wx.lib.eventwatcher as ew
|
|
8
8
|
from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin
|
|
9
9
|
|
|
10
|
-
from .utilus import where
|
|
10
|
+
from .utilus import where, ignore
|
|
11
11
|
from .controls import Icon, Clipboard
|
|
12
12
|
from .framework import CtrlInterface, Menu
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
16
|
-
"""Event monitor
|
|
16
|
+
"""Event monitor.
|
|
17
17
|
|
|
18
18
|
Attributes:
|
|
19
|
-
parent
|
|
20
|
-
target
|
|
19
|
+
parent: shellframe
|
|
20
|
+
target: widget to monitor
|
|
21
21
|
"""
|
|
22
22
|
def __init__(self, parent, **kwargs):
|
|
23
23
|
wx.ListCtrl.__init__(self, parent,
|
|
@@ -29,11 +29,11 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
29
29
|
|
|
30
30
|
self.parent = parent
|
|
31
31
|
self.target = None
|
|
32
|
-
self._target = None
|
|
32
|
+
self._target = None # previous target
|
|
33
33
|
|
|
34
34
|
self.Font = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
|
|
35
35
|
|
|
36
|
-
self.__dir = True
|
|
36
|
+
self.__dir = True # sort direction
|
|
37
37
|
self.__items = []
|
|
38
38
|
|
|
39
39
|
_alist = (
|
|
@@ -65,7 +65,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
65
65
|
@self.handler.bind('C-c pressed')
|
|
66
66
|
def copy(evt):
|
|
67
67
|
self.copy()
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
def OnDestroy(self, evt):
|
|
70
70
|
if evt.EventObject is self:
|
|
71
71
|
try:
|
|
@@ -73,41 +73,42 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
73
73
|
except Exception as e:
|
|
74
74
|
print(e)
|
|
75
75
|
evt.Skip()
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
def OnSetFocus(self, evt):
|
|
78
78
|
title = "{} target: {}".format(self.__class__.__name__, self.target)
|
|
79
79
|
self.parent.handler('title_window', title)
|
|
80
80
|
evt.Skip()
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
## --------------------------------
|
|
83
|
-
## EventWatcher wrapper interface
|
|
83
|
+
## EventWatcher wrapper interface.
|
|
84
84
|
## --------------------------------
|
|
85
|
-
ew.buildWxEventMap()
|
|
86
|
-
|
|
85
|
+
ew.buildWxEventMap() # build ew._eventBinders and ew._eventIdMap
|
|
86
|
+
|
|
87
87
|
@staticmethod
|
|
88
88
|
def get_name(event):
|
|
89
89
|
return ew._eventIdMap.get(event, 'Unknown')
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
@staticmethod
|
|
92
92
|
def get_binder(event):
|
|
93
93
|
return next(x for x in ew._eventBinders if x.typeId == event)
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
@staticmethod
|
|
96
96
|
def get_watchlist():
|
|
97
97
|
"""All watched event binders except noWatchList."""
|
|
98
98
|
return (x for x in ew._eventBinders if x not in ew._noWatchList)
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
def watch(self, widget=None):
|
|
101
101
|
"""Begin watching the widget."""
|
|
102
|
-
self.clear()
|
|
103
102
|
self.unwatch()
|
|
103
|
+
self.clear()
|
|
104
104
|
if widget is None:
|
|
105
|
-
widget = self._target
|
|
105
|
+
widget = self._target # Resume watching the previous target.
|
|
106
106
|
if not widget:
|
|
107
107
|
return
|
|
108
108
|
if not isinstance(widget, wx.Object):
|
|
109
109
|
wx.MessageBox("Cannot watch the widget.\n\n"
|
|
110
|
-
"- {!r} is not a wx.Object.".format(widget)
|
|
110
|
+
"- {!r} is not a wx.Object.".format(widget),
|
|
111
|
+
self.__module__)
|
|
111
112
|
return
|
|
112
113
|
self._target = widget
|
|
113
114
|
self.target = widget
|
|
@@ -123,7 +124,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
123
124
|
print(" #{:6d}:{:32s}{!s}".format(event, name, e))
|
|
124
125
|
continue
|
|
125
126
|
self.parent.handler('monitor_begin', widget)
|
|
126
|
-
|
|
127
|
+
|
|
127
128
|
def unwatch(self):
|
|
128
129
|
"""End watching the widget."""
|
|
129
130
|
widget = self.target
|
|
@@ -134,12 +135,12 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
134
135
|
print("- Failed to unbind {}: {}".format(binder.typeId, widget))
|
|
135
136
|
self.parent.handler('monitor_end', widget)
|
|
136
137
|
self.target = None
|
|
137
|
-
|
|
138
|
+
|
|
138
139
|
def onWatchedEvent(self, evt):
|
|
139
140
|
if self:
|
|
140
141
|
self.update(evt)
|
|
141
142
|
evt.Skip()
|
|
142
|
-
|
|
143
|
+
|
|
143
144
|
def dump(self, widget, verbose=True):
|
|
144
145
|
"""Dump all event handlers bound to the widget."""
|
|
145
146
|
## Note: This will not work unless [Monkey-patch for wx.core] is applied.
|
|
@@ -159,22 +160,26 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
159
160
|
except AttributeError:
|
|
160
161
|
pass
|
|
161
162
|
return ssmap
|
|
162
|
-
|
|
163
|
+
|
|
163
164
|
## --------------------------------
|
|
164
|
-
## Actions on list items
|
|
165
|
+
## Actions on list items.
|
|
165
166
|
## --------------------------------
|
|
166
|
-
|
|
167
|
+
|
|
167
168
|
def clear(self):
|
|
168
169
|
self.DeleteAllItems()
|
|
169
170
|
del self.__items[:]
|
|
170
|
-
|
|
171
|
+
|
|
171
172
|
def update(self, evt):
|
|
172
173
|
event = evt.EventType
|
|
173
174
|
obj = evt.EventObject
|
|
174
175
|
name = self.get_name(event)
|
|
175
176
|
source = ew._makeSourceString(obj) + " id=0x{:X}".format(id(evt))
|
|
176
177
|
stamp = 1
|
|
177
|
-
|
|
178
|
+
try:
|
|
179
|
+
with ignore(DeprecationWarning):
|
|
180
|
+
attribs = ew._makeAttribString(evt)
|
|
181
|
+
except Exception:
|
|
182
|
+
attribs = '' # Failed to get event attributes; possibly <BdbQuit>.
|
|
178
183
|
data = self.__items
|
|
179
184
|
for i, item in enumerate(data):
|
|
180
185
|
if item[0] == event:
|
|
@@ -195,7 +200,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
195
200
|
self.parent.debugger.set_trace()
|
|
196
201
|
return
|
|
197
202
|
self.blink(i)
|
|
198
|
-
|
|
203
|
+
|
|
199
204
|
def append(self, event):
|
|
200
205
|
data = self.__items
|
|
201
206
|
if event in (item[0] for item in data):
|
|
@@ -210,7 +215,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
210
215
|
self.SetItem(i, j, str(v))
|
|
211
216
|
self.SetItemTextColour(i, 'blue')
|
|
212
217
|
self.blink(i)
|
|
213
|
-
|
|
218
|
+
|
|
214
219
|
def blink(self, i):
|
|
215
220
|
if self.GetItemBackgroundColour(i) != wx.Colour('yellow'):
|
|
216
221
|
self.SetItemBackgroundColour(i, "yellow")
|
|
@@ -218,7 +223,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
218
223
|
if self and i < self.ItemCount:
|
|
219
224
|
self.SetItemBackgroundColour(i, 'white')
|
|
220
225
|
wx.CallAfter(wx.CallLater, 1000, _reset_color)
|
|
221
|
-
|
|
226
|
+
|
|
222
227
|
def copy(self):
|
|
223
228
|
if not self.SelectedItemCount:
|
|
224
229
|
return
|
|
@@ -228,8 +233,8 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
228
233
|
event, name, *_, attribs = self.__items[i]
|
|
229
234
|
text += "{}\t{}\n{}\n\n".format(event, name, attribs)
|
|
230
235
|
Clipboard.write(text[:-1])
|
|
231
|
-
|
|
232
|
-
def OnSortItems(self, evt):
|
|
236
|
+
|
|
237
|
+
def OnSortItems(self, evt): #<wx._controls.ListEvent>
|
|
233
238
|
n = self.ItemCount
|
|
234
239
|
if n < 2:
|
|
235
240
|
return
|
|
@@ -249,19 +254,19 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
249
254
|
self.SetItem(i, j, str(v))
|
|
250
255
|
self.Select(i, item in ls)
|
|
251
256
|
self.CheckItem(i, item in lc)
|
|
252
|
-
self.SetItemTextColour(i, 'black')
|
|
257
|
+
self.SetItemTextColour(i, 'black') # reset font
|
|
253
258
|
if item in lb:
|
|
254
259
|
self.SetItemTextColour(i, 'blue')
|
|
255
260
|
if item == fi:
|
|
256
261
|
self.Focus(i)
|
|
257
|
-
|
|
258
|
-
def OnItemDClick(self, evt):
|
|
262
|
+
|
|
263
|
+
def OnItemDClick(self, evt): #<wx._core.MouseEvent>
|
|
259
264
|
i, flag = self.HitTest(evt.Position)
|
|
260
265
|
if i >= 0:
|
|
261
266
|
item = self.__items[i]
|
|
262
|
-
wx.CallAfter(wx.TipWindow, self, item[-1], 512)
|
|
267
|
+
wx.CallAfter(wx.TipWindow, self, item[-1], 512) # attribs
|
|
263
268
|
evt.Skip()
|
|
264
|
-
|
|
269
|
+
|
|
265
270
|
def OnContextMenu(self, evt):
|
|
266
271
|
obj = self.target
|
|
267
272
|
wnd = self._target
|
|
@@ -290,9 +295,9 @@ def monit(widget=None, **kwargs):
|
|
|
290
295
|
return ew
|
|
291
296
|
|
|
292
297
|
|
|
293
|
-
## Monkey-patch for wx.core (deprecated)
|
|
298
|
+
## Monkey-patch for wx.core (deprecated).
|
|
294
299
|
if 0:
|
|
295
|
-
from wx import core
|
|
300
|
+
from wx import core # PY3
|
|
296
301
|
|
|
297
302
|
def _EvtHandler_Bind(self, event, handler=None, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
|
|
298
303
|
"""
|
|
@@ -346,11 +351,11 @@ if 0:
|
|
|
346
351
|
if v[0] == id or v[1] == handler:
|
|
347
352
|
handlers.remove(v)
|
|
348
353
|
else:
|
|
349
|
-
handlers.pop(0)
|
|
354
|
+
handlers.pop(0) # No optional arguments are specified.
|
|
350
355
|
if not handlers:
|
|
351
356
|
del vmap[event.typeId]
|
|
352
357
|
except KeyError:
|
|
353
|
-
pass
|
|
358
|
+
pass # Note: vmap is actually inconsistent, but ignored.
|
|
354
359
|
return retval
|
|
355
360
|
|
|
356
361
|
core.EvtHandler.Unbind = _EvtHandler_Unbind
|