mwxlib 1.6.8__py3-none-any.whl → 1.7.0__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.
Potentially problematic release.
This version of mwxlib might be problematic. Click here for more details.
- mwx/bookshelf.py +26 -22
- mwx/controls.py +142 -143
- mwx/framework.py +109 -114
- mwx/graphman.py +90 -89
- mwx/matplot2.py +82 -81
- mwx/matplot2g.py +165 -165
- mwx/matplot2lg.py +57 -57
- mwx/mgplt.py +12 -12
- mwx/nutshell.py +306 -288
- mwx/plugins/ffmpeg_view.py +15 -15
- mwx/plugins/fft_view.py +4 -4
- mwx/plugins/frame_listview.py +26 -26
- mwx/plugins/line_profile.py +1 -1
- mwx/utilus.py +40 -40
- mwx/wxmon.py +20 -20
- mwx/wxpdb.py +46 -46
- mwx/wxwil.py +11 -11
- mwx/wxwit.py +15 -15
- {mwxlib-1.6.8.dist-info → mwxlib-1.7.0.dist-info}/METADATA +1 -1
- mwxlib-1.7.0.dist-info/RECORD +28 -0
- mwxlib-1.6.8.dist-info/RECORD +0 -28
- {mwxlib-1.6.8.dist-info → mwxlib-1.7.0.dist-info}/WHEEL +0 -0
- {mwxlib-1.6.8.dist-info → mwxlib-1.7.0.dist-info}/top_level.txt +0 -0
mwx/wxmon.py
CHANGED
|
@@ -13,7 +13,7 @@ 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
19
|
parent: shellframe
|
|
@@ -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,30 +73,30 @@ 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
83
|
## EventWatcher wrapper interface
|
|
84
84
|
## --------------------------------
|
|
85
85
|
ew.buildWxEventMap() # build ew._eventBinders and ew._eventIdMap
|
|
86
|
-
|
|
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
102
|
self.unwatch()
|
|
@@ -124,7 +124,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
124
124
|
print(" #{:6d}:{:32s}{!s}".format(event, name, e))
|
|
125
125
|
continue
|
|
126
126
|
self.parent.handler('monitor_begin', widget)
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
def unwatch(self):
|
|
129
129
|
"""End watching the widget."""
|
|
130
130
|
widget = self.target
|
|
@@ -135,12 +135,12 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
135
135
|
print("- Failed to unbind {}: {}".format(binder.typeId, widget))
|
|
136
136
|
self.parent.handler('monitor_end', widget)
|
|
137
137
|
self.target = None
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
def onWatchedEvent(self, evt):
|
|
140
140
|
if self:
|
|
141
141
|
self.update(evt)
|
|
142
142
|
evt.Skip()
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
def dump(self, widget, verbose=True):
|
|
145
145
|
"""Dump all event handlers bound to the widget."""
|
|
146
146
|
## Note: This will not work unless [Monkey-patch for wx.core] is applied.
|
|
@@ -160,15 +160,15 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
160
160
|
except AttributeError:
|
|
161
161
|
pass
|
|
162
162
|
return ssmap
|
|
163
|
-
|
|
163
|
+
|
|
164
164
|
## --------------------------------
|
|
165
165
|
## Actions on list items
|
|
166
166
|
## --------------------------------
|
|
167
|
-
|
|
167
|
+
|
|
168
168
|
def clear(self):
|
|
169
169
|
self.DeleteAllItems()
|
|
170
170
|
del self.__items[:]
|
|
171
|
-
|
|
171
|
+
|
|
172
172
|
def update(self, evt):
|
|
173
173
|
event = evt.EventType
|
|
174
174
|
obj = evt.EventObject
|
|
@@ -200,7 +200,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
200
200
|
self.parent.debugger.set_trace()
|
|
201
201
|
return
|
|
202
202
|
self.blink(i)
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
def append(self, event):
|
|
205
205
|
data = self.__items
|
|
206
206
|
if event in (item[0] for item in data):
|
|
@@ -215,7 +215,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
215
215
|
self.SetItem(i, j, str(v))
|
|
216
216
|
self.SetItemTextColour(i, 'blue')
|
|
217
217
|
self.blink(i)
|
|
218
|
-
|
|
218
|
+
|
|
219
219
|
def blink(self, i):
|
|
220
220
|
if self.GetItemBackgroundColour(i) != wx.Colour('yellow'):
|
|
221
221
|
self.SetItemBackgroundColour(i, "yellow")
|
|
@@ -223,7 +223,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
223
223
|
if self and i < self.ItemCount:
|
|
224
224
|
self.SetItemBackgroundColour(i, 'white')
|
|
225
225
|
wx.CallAfter(wx.CallLater, 1000, _reset_color)
|
|
226
|
-
|
|
226
|
+
|
|
227
227
|
def copy(self):
|
|
228
228
|
if not self.SelectedItemCount:
|
|
229
229
|
return
|
|
@@ -233,7 +233,7 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
233
233
|
event, name, *_, attribs = self.__items[i]
|
|
234
234
|
text += "{}\t{}\n{}\n\n".format(event, name, attribs)
|
|
235
235
|
Clipboard.write(text[:-1])
|
|
236
|
-
|
|
236
|
+
|
|
237
237
|
def OnSortItems(self, evt): #<wx._controls.ListEvent>
|
|
238
238
|
n = self.ItemCount
|
|
239
239
|
if n < 2:
|
|
@@ -259,14 +259,14 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
259
259
|
self.SetItemTextColour(i, 'blue')
|
|
260
260
|
if item == fi:
|
|
261
261
|
self.Focus(i)
|
|
262
|
-
|
|
262
|
+
|
|
263
263
|
def OnItemDClick(self, evt): #<wx._core.MouseEvent>
|
|
264
264
|
i, flag = self.HitTest(evt.Position)
|
|
265
265
|
if i >= 0:
|
|
266
266
|
item = self.__items[i]
|
|
267
267
|
wx.CallAfter(wx.TipWindow, self, item[-1], 512) # attribs
|
|
268
268
|
evt.Skip()
|
|
269
|
-
|
|
269
|
+
|
|
270
270
|
def OnContextMenu(self, evt):
|
|
271
271
|
obj = self.target
|
|
272
272
|
wnd = self._target
|
mwx/wxpdb.py
CHANGED
|
@@ -27,7 +27,7 @@ echo.verbose = 0
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class Debugger(Pdb):
|
|
30
|
-
"""Graphical debugger with extended Pdb
|
|
30
|
+
"""Graphical debugger with extended Pdb.
|
|
31
31
|
|
|
32
32
|
Args:
|
|
33
33
|
parent: shellframe
|
|
@@ -55,18 +55,18 @@ class Debugger(Pdb):
|
|
|
55
55
|
prompt = property(lambda self: self.indents + '(Pdb) ',
|
|
56
56
|
lambda self, v: None) # fake setter
|
|
57
57
|
handler = property(lambda self: self.__handler)
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
@property
|
|
60
60
|
def interactive_shell(self):
|
|
61
61
|
return self.__shell
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
@interactive_shell.setter
|
|
64
64
|
def interactive_shell(self, v):
|
|
65
65
|
self.__shell = v
|
|
66
66
|
## Don't use rawinput
|
|
67
67
|
self.stdin = self.__shell.interp.stdin
|
|
68
68
|
self.stdout = self.__shell.interp.stdout
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
@property
|
|
71
71
|
def busy(self):
|
|
72
72
|
"""Indicates that the current state is debug mode.
|
|
@@ -79,14 +79,14 @@ class Debugger(Pdb):
|
|
|
79
79
|
return self.curframe is not None
|
|
80
80
|
except AttributeError:
|
|
81
81
|
pass
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
@property
|
|
84
84
|
def tracing(self):
|
|
85
85
|
"""Indicates that the current state is trace mode.
|
|
86
86
|
"""
|
|
87
87
|
## cf. (self.handler.current_state == 2)
|
|
88
88
|
return self.__hookpoint is not None
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
def __init__(self, parent, *args, **kwargs):
|
|
91
91
|
Pdb.__init__(self, *args, **kwargs)
|
|
92
92
|
|
|
@@ -138,26 +138,26 @@ class Debugger(Pdb):
|
|
|
138
138
|
'debug_begin' : (1, self.on_debug_begin, dispatch),
|
|
139
139
|
},
|
|
140
140
|
})
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
def set_breakpoint(self):
|
|
143
143
|
"""Set a breakpoint at the current line."""
|
|
144
144
|
filename = self.curframe.f_code.co_filename
|
|
145
145
|
ln = self.editor.buffer.cline + 1
|
|
146
146
|
if ln not in self.get_file_breaks(filename):
|
|
147
147
|
self.send_input('b {}'.format(ln), echo=True)
|
|
148
|
-
|
|
148
|
+
|
|
149
149
|
def jump_to_entry(self):
|
|
150
150
|
"""Jump to the first lineno of the code."""
|
|
151
151
|
ln = self.editor.buffer.markline + 1
|
|
152
152
|
if ln:
|
|
153
153
|
self.send_input('j {}'.format(ln), echo=True)
|
|
154
|
-
|
|
154
|
+
|
|
155
155
|
def jump_to_lineno(self):
|
|
156
156
|
"""Jump to the lineno of the code."""
|
|
157
157
|
ln = self.editor.buffer.cline + 1
|
|
158
158
|
if ln:
|
|
159
159
|
self.send_input('j {}'.format(ln), echo=True)
|
|
160
|
-
|
|
160
|
+
|
|
161
161
|
def exec_until_lineno(self):
|
|
162
162
|
"""Continue execution until the lineno of the code."""
|
|
163
163
|
frame = self.curframe
|
|
@@ -170,14 +170,14 @@ class Debugger(Pdb):
|
|
|
170
170
|
self.message("--> {}:{}:{}".format(filename, ln, name), indent=0)
|
|
171
171
|
else:
|
|
172
172
|
self.stamp_where()
|
|
173
|
-
|
|
173
|
+
|
|
174
174
|
def stamp_where(self):
|
|
175
175
|
"""Stamp current where(frame) message."""
|
|
176
176
|
## cf. (print_stack_entry for frame in self.stack)
|
|
177
177
|
self.send_input('w')
|
|
178
178
|
if not self.verbose:
|
|
179
179
|
self.message("--> {}".format(where(self.curframe)), indent=0)
|
|
180
|
-
|
|
180
|
+
|
|
181
181
|
def send_input(self, c, echo=False):
|
|
182
182
|
"""Send input:str (echo message if needed)."""
|
|
183
183
|
def _send():
|
|
@@ -185,14 +185,14 @@ class Debugger(Pdb):
|
|
|
185
185
|
if echo or self.verbose:
|
|
186
186
|
self.message(c, indent=0)
|
|
187
187
|
wx.CallAfter(_send)
|
|
188
|
-
|
|
188
|
+
|
|
189
189
|
def message(self, msg, indent=True):
|
|
190
190
|
"""Add prefix and insert msg at the end of command-line."""
|
|
191
191
|
shell = self.interactive_shell
|
|
192
192
|
shell.goto_char(shell.eolc)
|
|
193
193
|
prefix = self.indents if indent else ''
|
|
194
194
|
print("{}{}".format(prefix, msg), file=self.stdout)
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
def watch(self, bp):
|
|
197
197
|
"""Start tracing."""
|
|
198
198
|
if self.busy: # don't set while debugging
|
|
@@ -202,7 +202,7 @@ class Debugger(Pdb):
|
|
|
202
202
|
sys.settrace(self.trace_dispatch)
|
|
203
203
|
threading.settrace(self.trace_dispatch)
|
|
204
204
|
self.handler('trace_begin', bp)
|
|
205
|
-
|
|
205
|
+
|
|
206
206
|
def unwatch(self):
|
|
207
207
|
"""End tracing."""
|
|
208
208
|
if self.busy: # don't unset while debugging
|
|
@@ -219,7 +219,7 @@ class Debugger(Pdb):
|
|
|
219
219
|
## Called to abort when the debugger is invalid status:
|
|
220
220
|
## e.g., (self.handler.current_state > 0 but not busy)
|
|
221
221
|
self.handler('abort')
|
|
222
|
-
|
|
222
|
+
|
|
223
223
|
def debug(self, obj, *args, **kwargs):
|
|
224
224
|
"""Debug a callable object.
|
|
225
225
|
"""
|
|
@@ -244,7 +244,7 @@ class Debugger(Pdb):
|
|
|
244
244
|
f"Debugger has been closed.\n\n{e}")
|
|
245
245
|
finally:
|
|
246
246
|
self.set_quit()
|
|
247
|
-
|
|
247
|
+
|
|
248
248
|
def run(self, cmd, filename="<string>"):
|
|
249
249
|
"""Debug a statement executed via the exec() function.
|
|
250
250
|
"""
|
|
@@ -270,22 +270,22 @@ class Debugger(Pdb):
|
|
|
270
270
|
f"Debugger has been closed.\n\n{e}")
|
|
271
271
|
finally:
|
|
272
272
|
self.set_quit()
|
|
273
|
-
|
|
273
|
+
|
|
274
274
|
## --------------------------------
|
|
275
275
|
## Actions for handler
|
|
276
276
|
## --------------------------------
|
|
277
|
-
|
|
277
|
+
|
|
278
278
|
def _markbp(self, lineno, style):
|
|
279
|
-
"""Add a
|
|
280
|
-
[1]
|
|
281
|
-
[2]
|
|
279
|
+
"""Add a marker to lineno, with the following style markers:
|
|
280
|
+
[1] white_arrow for breakpoints
|
|
281
|
+
[2] red_arrow for exceptions
|
|
282
282
|
"""
|
|
283
283
|
if self.editor:
|
|
284
284
|
if lineno:
|
|
285
285
|
self.editor.buffer.MarkerAdd(lineno - 1, style)
|
|
286
286
|
else:
|
|
287
287
|
self.editor.buffer.MarkerDeleteAll(style)
|
|
288
|
-
|
|
288
|
+
|
|
289
289
|
def on_debug_begin(self, frame):
|
|
290
290
|
"""Called before set_trace.
|
|
291
291
|
Note: self.busy -> False or None
|
|
@@ -293,7 +293,7 @@ class Debugger(Pdb):
|
|
|
293
293
|
self.__hookpoint = None
|
|
294
294
|
self.indents = ' ' * 2
|
|
295
295
|
self.stdin.input = '' # clear stdin buffer
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
def on_debug_mark(self, frame):
|
|
298
298
|
"""Called when interaction."""
|
|
299
299
|
code = frame.f_code
|
|
@@ -331,7 +331,7 @@ class Debugger(Pdb):
|
|
|
331
331
|
buffer.ensureLineMoreOnScreen(lineno - 1)
|
|
332
332
|
self.code = code
|
|
333
333
|
wx.CallAfter(_mark)
|
|
334
|
-
|
|
334
|
+
|
|
335
335
|
def on_debug_next(self, frame):
|
|
336
336
|
"""Called in preloop (cmdloop)."""
|
|
337
337
|
shell = self.interactive_shell
|
|
@@ -347,7 +347,7 @@ class Debugger(Pdb):
|
|
|
347
347
|
shell.EnsureCaretVisible()
|
|
348
348
|
self.__cpos = shell.cpos
|
|
349
349
|
wx.CallAfter(_next)
|
|
350
|
-
|
|
350
|
+
|
|
351
351
|
def on_debug_end(self, frame):
|
|
352
352
|
"""Called after set_quit.
|
|
353
353
|
Note: self.busy -> True (until this stage)
|
|
@@ -359,23 +359,23 @@ class Debugger(Pdb):
|
|
|
359
359
|
|
|
360
360
|
## Note: Required to terminate the reader of threading pdb.
|
|
361
361
|
self.send_input('\n')
|
|
362
|
-
|
|
362
|
+
|
|
363
363
|
def on_trace_hook(self, frame):
|
|
364
364
|
"""Called when a breakppoint is reached."""
|
|
365
365
|
self.__hookpoint = None
|
|
366
366
|
self.interactive_shell.write('\n', -1) # move to eolc and insert LFD
|
|
367
367
|
self.message(where(frame.f_code), indent=0)
|
|
368
|
-
|
|
368
|
+
|
|
369
369
|
## --------------------------------
|
|
370
370
|
## Override Bdb methods
|
|
371
371
|
## --------------------------------
|
|
372
|
-
|
|
372
|
+
|
|
373
373
|
def break_anywhere(self, frame):
|
|
374
374
|
"""Return False (override)
|
|
375
375
|
even if there is any breakpoint for frame's filename.
|
|
376
376
|
"""
|
|
377
377
|
return False
|
|
378
|
-
|
|
378
|
+
|
|
379
379
|
def dispatch_line(self, frame):
|
|
380
380
|
"""Invoke user function and return trace function for line event.
|
|
381
381
|
|
|
@@ -394,7 +394,7 @@ class Debugger(Pdb):
|
|
|
394
394
|
else:
|
|
395
395
|
return None
|
|
396
396
|
return Pdb.dispatch_line(self, frame)
|
|
397
|
-
|
|
397
|
+
|
|
398
398
|
def dispatch_call(self, frame, arg):
|
|
399
399
|
"""Invoke user function and return trace function for call event.
|
|
400
400
|
|
|
@@ -412,7 +412,7 @@ class Debugger(Pdb):
|
|
|
412
412
|
else:
|
|
413
413
|
return None
|
|
414
414
|
return Pdb.dispatch_call(self, frame, arg)
|
|
415
|
-
|
|
415
|
+
|
|
416
416
|
def dispatch_return(self, frame, arg):
|
|
417
417
|
"""Invoke user function and return trace function for return event.
|
|
418
418
|
|
|
@@ -421,7 +421,7 @@ class Debugger(Pdb):
|
|
|
421
421
|
if self.__hookpoint:
|
|
422
422
|
return None
|
|
423
423
|
return Pdb.dispatch_return(self, frame, arg)
|
|
424
|
-
|
|
424
|
+
|
|
425
425
|
def dispatch_exception(self, frame, arg):
|
|
426
426
|
"""Invoke user function and return trace function for exception event.
|
|
427
427
|
|
|
@@ -430,7 +430,7 @@ class Debugger(Pdb):
|
|
|
430
430
|
if self.__hookpoint:
|
|
431
431
|
return None
|
|
432
432
|
return Pdb.dispatch_exception(self, frame, arg)
|
|
433
|
-
|
|
433
|
+
|
|
434
434
|
def set_trace(self, frame=None):
|
|
435
435
|
if self.busy:
|
|
436
436
|
wx.MessageBox("Debugger is running.\n\n"
|
|
@@ -440,22 +440,22 @@ class Debugger(Pdb):
|
|
|
440
440
|
frame = inspect.currentframe().f_back
|
|
441
441
|
self.handler('debug_begin', frame)
|
|
442
442
|
Pdb.set_trace(self, frame)
|
|
443
|
-
|
|
443
|
+
|
|
444
444
|
def set_break(self, filename, lineno, *args, **kwargs):
|
|
445
445
|
self._markbp(lineno, 1)
|
|
446
446
|
return Pdb.set_break(self, filename, lineno, *args, **kwargs)
|
|
447
|
-
|
|
447
|
+
|
|
448
448
|
def set_quit(self):
|
|
449
449
|
try:
|
|
450
450
|
Pdb.set_quit(self)
|
|
451
451
|
finally:
|
|
452
|
-
if self.parent: # Check if
|
|
452
|
+
if self.parent: # Check if the parent is being deleted.
|
|
453
453
|
self.handler('debug_end', self.curframe)
|
|
454
|
-
|
|
454
|
+
|
|
455
455
|
## --------------------------------
|
|
456
456
|
## Override Pdb methods
|
|
457
457
|
## --------------------------------
|
|
458
|
-
|
|
458
|
+
|
|
459
459
|
@echo
|
|
460
460
|
def print_stack_entry(self, frame_lineno, prompt_prefix=None):
|
|
461
461
|
"""Print the stack entry frame_lineno (frame, lineno).
|
|
@@ -467,7 +467,7 @@ class Debugger(Pdb):
|
|
|
467
467
|
Pdb.print_stack_entry(self, frame_lineno,
|
|
468
468
|
prompt_prefix or "\n{}-> ".format(self.indents))
|
|
469
469
|
self.handler('debug_mark', frame_lineno[0])
|
|
470
|
-
|
|
470
|
+
|
|
471
471
|
@echo
|
|
472
472
|
def user_call(self, frame, argument_list):
|
|
473
473
|
"""--Call--
|
|
@@ -479,13 +479,13 @@ class Debugger(Pdb):
|
|
|
479
479
|
self.message("> {}".format(where(frame)), indent=0)
|
|
480
480
|
self.indents += ' ' * 2
|
|
481
481
|
Pdb.user_call(self, frame, argument_list)
|
|
482
|
-
|
|
482
|
+
|
|
483
483
|
@echo
|
|
484
484
|
def user_line(self, frame):
|
|
485
485
|
"""--Next--
|
|
486
486
|
"""
|
|
487
487
|
Pdb.user_line(self, frame)
|
|
488
|
-
|
|
488
|
+
|
|
489
489
|
@echo
|
|
490
490
|
def user_return(self, frame, return_value):
|
|
491
491
|
"""--Return--
|
|
@@ -503,7 +503,7 @@ class Debugger(Pdb):
|
|
|
503
503
|
self.indents = self.indents[:-2] # remove ' '
|
|
504
504
|
self.interaction(frame, None)
|
|
505
505
|
## Pdb.user_return(self, frame, return_value)
|
|
506
|
-
|
|
506
|
+
|
|
507
507
|
@echo
|
|
508
508
|
def user_exception(self, frame, exc_info):
|
|
509
509
|
"""--Exception--
|
|
@@ -514,7 +514,7 @@ class Debugger(Pdb):
|
|
|
514
514
|
self._markbp(tb.tb_lineno, 2)
|
|
515
515
|
self.message(tb.tb_frame, indent=0)
|
|
516
516
|
Pdb.user_exception(self, frame, exc_info)
|
|
517
|
-
|
|
517
|
+
|
|
518
518
|
@echo
|
|
519
519
|
def bp_commands(self, frame):
|
|
520
520
|
"""--Break--
|
|
@@ -527,13 +527,13 @@ class Debugger(Pdb):
|
|
|
527
527
|
for lineno in breakpoints:
|
|
528
528
|
self._markbp(lineno, 1)
|
|
529
529
|
return Pdb.bp_commands(self, frame)
|
|
530
|
-
|
|
530
|
+
|
|
531
531
|
@echo
|
|
532
532
|
def preloop(self):
|
|
533
533
|
"""Hook method executed once when the cmdloop() method is called."""
|
|
534
534
|
Pdb.preloop(self)
|
|
535
535
|
self.handler('debug_next', self.curframe)
|
|
536
|
-
|
|
536
|
+
|
|
537
537
|
@echo
|
|
538
538
|
def postloop(self):
|
|
539
539
|
"""Hook method executed once when the cmdloop() method is about to return."""
|
mwx/wxwil.py
CHANGED
|
@@ -17,7 +17,7 @@ def _repr(value):
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
20
|
-
"""Locals info watcher
|
|
20
|
+
"""Locals info watcher.
|
|
21
21
|
|
|
22
22
|
Attributes:
|
|
23
23
|
parent: shellframe
|
|
@@ -59,13 +59,13 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
59
59
|
self.copy()
|
|
60
60
|
|
|
61
61
|
dispatcher.connect(receiver=self._update, signal='Interpreter.push')
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
def _update(self, *args, **kwargs):
|
|
64
64
|
if not self:
|
|
65
65
|
dispatcher.disconnect(receiver=self._update, signal='Interpreter.push')
|
|
66
66
|
return
|
|
67
67
|
self.update()
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
def watch(self, locals):
|
|
70
70
|
self.clear()
|
|
71
71
|
if not isinstance(locals, dict):
|
|
@@ -86,18 +86,18 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
86
86
|
self.blink(i)
|
|
87
87
|
finally:
|
|
88
88
|
self.Thaw()
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
def unwatch(self):
|
|
91
91
|
self.target = None
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
## --------------------------------
|
|
94
94
|
## Actions on list items
|
|
95
95
|
## --------------------------------
|
|
96
|
-
|
|
96
|
+
|
|
97
97
|
def clear(self):
|
|
98
98
|
self.DeleteAllItems()
|
|
99
99
|
del self.__items[:]
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
def update(self):
|
|
102
102
|
if not self.target:
|
|
103
103
|
return
|
|
@@ -125,7 +125,7 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
125
125
|
self.SetItem(i, 1, vstr)
|
|
126
126
|
self.blink(i)
|
|
127
127
|
self.EnsureVisible(i)
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
def blink(self, i):
|
|
130
130
|
if self.GetItemBackgroundColour(i) != wx.Colour('yellow'):
|
|
131
131
|
self.SetItemBackgroundColour(i, "yellow")
|
|
@@ -133,7 +133,7 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
133
133
|
if self and i < self.ItemCount:
|
|
134
134
|
self.SetItemBackgroundColour(i, 'white')
|
|
135
135
|
wx.CallAfter(wx.CallLater, 1000, _reset_color)
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
def copy(self):
|
|
138
138
|
if not self.SelectedItemCount:
|
|
139
139
|
return
|
|
@@ -143,7 +143,7 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
143
143
|
key, vstr = self.__items[i]
|
|
144
144
|
text += "{} = {}\n".format(key, vstr)
|
|
145
145
|
Clipboard.write(text)
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
def OnSortItems(self, evt): #<wx._controls.ListEvent>
|
|
148
148
|
n = self.ItemCount
|
|
149
149
|
if n < 2:
|
|
@@ -163,7 +163,7 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
163
163
|
self.Select(i, item in ls)
|
|
164
164
|
if item == fi:
|
|
165
165
|
self.Focus(i)
|
|
166
|
-
|
|
166
|
+
|
|
167
167
|
def OnContextMenu(self, evt):
|
|
168
168
|
Menu.Popup(self, [
|
|
169
169
|
(1, "Copy data", Icon('copy'),
|
mwx/wxwit.py
CHANGED
|
@@ -12,7 +12,7 @@ from .framework import CtrlInterface, Menu
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Inspector(it.InspectionTree, CtrlInterface):
|
|
15
|
-
"""Widget inspection tool
|
|
15
|
+
"""Widget inspection tool.
|
|
16
16
|
|
|
17
17
|
Attributes:
|
|
18
18
|
parent: shellframe
|
|
@@ -61,21 +61,21 @@ class Inspector(it.InspectionTree, CtrlInterface):
|
|
|
61
61
|
@self.handler.bind('f5 pressed')
|
|
62
62
|
def _refresh(evt):
|
|
63
63
|
self.BuildTree(self.target)
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
def OnDestroy(self, evt):
|
|
66
66
|
if evt.EventObject is self:
|
|
67
67
|
self.timer.Stop()
|
|
68
68
|
evt.Skip()
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
def OnSetFocus(self, evt):
|
|
71
71
|
title = self.__class__.__name__
|
|
72
72
|
self.parent.handler('title_window', title)
|
|
73
73
|
evt.Skip()
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
## --------------------------------
|
|
76
76
|
## InspectionTree wrapper interface
|
|
77
77
|
## --------------------------------
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
def SetObj(self, obj):
|
|
80
80
|
"""Called from tree.toolFrame -> SetObj."""
|
|
81
81
|
if self.target is obj:
|
|
@@ -87,7 +87,7 @@ class Inspector(it.InspectionTree, CtrlInterface):
|
|
|
87
87
|
self.SelectItem(item)
|
|
88
88
|
elif obj:
|
|
89
89
|
self.BuildTree(obj) # If the item for obj is missing, rebuild the tree.
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
def GetTextForWidget(self, obj):
|
|
92
92
|
"""Return the string to be used in the tree for a widget.
|
|
93
93
|
|
|
@@ -97,7 +97,7 @@ class Inspector(it.InspectionTree, CtrlInterface):
|
|
|
97
97
|
if hasattr(obj, 'Name'):
|
|
98
98
|
return "{} ({!r} {})".format(clsname, obj.Name, obj.Id)
|
|
99
99
|
return clsname
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
def highlight(self, obj, msec=2000):
|
|
102
102
|
self.highlighter.highlightTime = msec
|
|
103
103
|
if isinstance(obj, wx.Window):
|
|
@@ -106,12 +106,12 @@ class Inspector(it.InspectionTree, CtrlInterface):
|
|
|
106
106
|
self.highlighter.HighlightSizer(obj)
|
|
107
107
|
elif isinstance(obj, wx.SizerItem):
|
|
108
108
|
self.highlighter.HighlightSizer(obj.Sizer)
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
def set_colour(self, obj, col):
|
|
111
111
|
item = self.FindWidgetItem(obj)
|
|
112
112
|
if item:
|
|
113
113
|
self.SetItemTextColour(item, col)
|
|
114
|
-
|
|
114
|
+
|
|
115
115
|
def watch(self, obj=None):
|
|
116
116
|
if obj is None:
|
|
117
117
|
item = self.Selection
|
|
@@ -124,15 +124,15 @@ class Inspector(it.InspectionTree, CtrlInterface):
|
|
|
124
124
|
return
|
|
125
125
|
self.SetObj(obj)
|
|
126
126
|
self.timer.Start(500)
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
def unwatch(self):
|
|
129
129
|
self.target = None
|
|
130
130
|
self.timer.Stop()
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
## --------------------------------
|
|
133
133
|
## Actions on tree items
|
|
134
134
|
## --------------------------------
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
def OnTimer(self, evt):
|
|
137
137
|
## wnd, pt = wx.FindWindowAtPointer() # as HitTest
|
|
138
138
|
wnd = wx.Window.FindFocus()
|
|
@@ -140,21 +140,21 @@ class Inspector(it.InspectionTree, CtrlInterface):
|
|
|
140
140
|
and wnd not in self._noWatchList):
|
|
141
141
|
self.SetObj(wnd)
|
|
142
142
|
evt.Skip()
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
def OnShow(self, evt):
|
|
145
145
|
if evt.IsShown():
|
|
146
146
|
if not self.built:
|
|
147
147
|
self.BuildTree(self.target)
|
|
148
148
|
self._noWatchList = [w for w in self._noWatchList if w]
|
|
149
149
|
evt.Skip()
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
def OnItemTooltip(self, evt):
|
|
152
152
|
item = evt.GetItem()
|
|
153
153
|
if item:
|
|
154
154
|
obj = self.GetItemData(item)
|
|
155
155
|
evt.SetToolTip("id=0x{:X}".format(id(obj)))
|
|
156
156
|
evt.Skip()
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
def OnRightDown(self, evt):
|
|
159
159
|
item, flags = self.HitTest(evt.Position)
|
|
160
160
|
if item: # and flags & (0x10 | 0x20 | 0x40 | 0x80):
|