mwxlib 1.0.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 +6 -4
- mwx/bookshelf.py +133 -57
- mwx/controls.py +441 -375
- mwx/framework.py +531 -513
- mwx/graphman.py +683 -677
- mwx/images.py +16 -0
- mwx/matplot2.py +225 -216
- mwx/matplot2g.py +735 -652
- mwx/matplot2lg.py +192 -183
- mwx/mgplt.py +20 -22
- mwx/nutshell.py +1063 -939
- mwx/plugins/ffmpeg_view.py +74 -75
- mwx/plugins/fft_view.py +13 -15
- mwx/plugins/frame_listview.py +55 -52
- mwx/plugins/line_profile.py +1 -1
- mwx/py/filling.py +9 -8
- mwx/testsuite.py +38 -0
- mwx/utilus.py +273 -210
- mwx/wxmon.py +39 -38
- mwx/wxpdb.py +81 -83
- mwx/wxwil.py +18 -18
- mwx/wxwit.py +32 -35
- {mwxlib-1.0.0.dist-info → mwxlib-1.7.13.dist-info}/METADATA +12 -5
- mwxlib-1.7.13.dist-info/RECORD +28 -0
- {mwxlib-1.0.0.dist-info → mwxlib-1.7.13.dist-info}/WHEEL +1 -1
- mwxlib-1.0.0.dist-info/LICENSE +0 -21
- mwxlib-1.0.0.dist-info/RECORD +0 -28
- {mwxlib-1.0.0.dist-info → mwxlib-1.7.13.dist-info}/top_level.txt +0 -0
mwx/wxpdb.py
CHANGED
|
@@ -27,17 +27,18 @@ 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
|
-
parent
|
|
34
|
-
stdin
|
|
35
|
-
stdout
|
|
33
|
+
parent: shellframe
|
|
34
|
+
stdin: shell.interp.stdin
|
|
35
|
+
stdout: shell.interp.stdout
|
|
36
36
|
|
|
37
37
|
Attributes:
|
|
38
|
-
editor
|
|
38
|
+
editor: Notebook to show the stack frames
|
|
39
|
+
|
|
40
|
+
Key bindings::
|
|
39
41
|
|
|
40
|
-
Key bindings:
|
|
41
42
|
C-g : quit
|
|
42
43
|
C-q : quit
|
|
43
44
|
C-n : next (step-over)
|
|
@@ -46,27 +47,26 @@ class Debugger(Pdb):
|
|
|
46
47
|
C-b : Set a breakpoint at the current line.
|
|
47
48
|
C-@ : Jump to the first lineno of the code.
|
|
48
49
|
C-S-j : Jump to the lineno of the code.
|
|
49
|
-
C-S-
|
|
50
|
+
C-S-n : Continue execution until the lineno of the code.
|
|
50
51
|
C-w : Stamp current where(frame) message.
|
|
51
52
|
"""
|
|
52
53
|
verbose = False
|
|
53
54
|
use_rawinput = False
|
|
54
55
|
prompt = property(lambda self: self.indents + '(Pdb) ',
|
|
55
|
-
lambda self,v: None)
|
|
56
|
-
parent = property(lambda self: self.__shellframe)
|
|
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
|
-
## Don't use rawinput
|
|
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,32 +79,32 @@ 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
|
|
|
93
|
-
self.
|
|
94
|
-
self.__hookpoint = None
|
|
93
|
+
self.parent = parent
|
|
95
94
|
self.indents = ' ' * 2
|
|
96
95
|
self.interactive_shell = parent.rootshell
|
|
97
96
|
self.editor = None
|
|
98
97
|
self.code = None
|
|
98
|
+
self.__hookpoint = None
|
|
99
99
|
|
|
100
100
|
def _input(msg):
|
|
101
|
-
##
|
|
101
|
+
## Redirects input such as cl(ear).
|
|
102
102
|
self.message(msg, indent=0)
|
|
103
103
|
return self.stdin.readline()
|
|
104
104
|
pdb.input = _input
|
|
105
105
|
|
|
106
106
|
def _help():
|
|
107
|
-
self.parent.handler('add_help', pdb.__doc__)
|
|
107
|
+
self.parent.handler('add_help', pdb.__doc__, "pdb")
|
|
108
108
|
pdb.help = _help
|
|
109
109
|
|
|
110
110
|
def dispatch(evt):
|
|
@@ -129,7 +129,7 @@ class Debugger(Pdb):
|
|
|
129
129
|
'C-b pressed' : (1, lambda v: self.set_breakpoint()),
|
|
130
130
|
'C-@ pressed' : (1, lambda v: self.jump_to_entry()),
|
|
131
131
|
'C-S-j pressed' : (1, lambda v: self.jump_to_lineno()),
|
|
132
|
-
'C-S-
|
|
132
|
+
'C-S-n pressed' : (1, lambda v: self.exec_until_lineno()),
|
|
133
133
|
'C-w pressed' : (1, lambda v: self.stamp_where()),
|
|
134
134
|
},
|
|
135
135
|
2 : {
|
|
@@ -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,41 +185,41 @@ 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
|
-
if self.busy:
|
|
198
|
+
if self.busy: # don't set while debugging
|
|
199
199
|
return
|
|
200
200
|
self.__hookpoint = bp
|
|
201
201
|
self.reset()
|
|
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
|
-
if self.busy:
|
|
208
|
+
if self.busy: # don't unset while debugging
|
|
209
209
|
return
|
|
210
210
|
bp = self.__hookpoint
|
|
211
211
|
self.reset()
|
|
212
212
|
sys.settrace(None)
|
|
213
213
|
threading.settrace(None)
|
|
214
|
-
##
|
|
214
|
+
## Delete bp *after* setting dispatcher -> None.
|
|
215
215
|
self.__hookpoint = None
|
|
216
216
|
if bp:
|
|
217
217
|
self.handler('trace_end', bp)
|
|
218
218
|
else:
|
|
219
|
-
## Called to abort when the debugger is invalid status
|
|
220
|
-
## e.g., (self.handler.current_state > 0 but not busy)
|
|
219
|
+
## Called to abort when the debugger is invalid status.
|
|
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
|
"""
|
|
@@ -241,11 +241,10 @@ class Debugger(Pdb):
|
|
|
241
241
|
except Exception as e:
|
|
242
242
|
## Note: post-call to avoid crashing by a kill-focus event.
|
|
243
243
|
wx.CallAfter(wx.MessageBox,
|
|
244
|
-
f"Debugger
|
|
244
|
+
f"Debugger has been closed.\n\n{e}")
|
|
245
245
|
finally:
|
|
246
246
|
self.set_quit()
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
|
|
249
248
|
def run(self, cmd, filename="<string>"):
|
|
250
249
|
"""Debug a statement executed via the exec() function.
|
|
251
250
|
"""
|
|
@@ -268,34 +267,33 @@ class Debugger(Pdb):
|
|
|
268
267
|
except Exception as e:
|
|
269
268
|
## Note: post-call to avoid crashing by a kill-focus event.
|
|
270
269
|
wx.CallAfter(wx.MessageBox,
|
|
271
|
-
f"Debugger
|
|
270
|
+
f"Debugger has been closed.\n\n{e}")
|
|
272
271
|
finally:
|
|
273
272
|
self.set_quit()
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
|
|
276
274
|
## --------------------------------
|
|
277
|
-
## Actions for handler
|
|
275
|
+
## Actions for handler.
|
|
278
276
|
## --------------------------------
|
|
279
|
-
|
|
277
|
+
|
|
280
278
|
def _markbp(self, lineno, style):
|
|
281
279
|
"""Add a marker to lineno, with the following style markers:
|
|
282
|
-
[1]
|
|
283
|
-
[2]
|
|
280
|
+
[1] white_arrow for breakpoints
|
|
281
|
+
[2] red_arrow for exceptions
|
|
284
282
|
"""
|
|
285
283
|
if self.editor:
|
|
286
284
|
if lineno:
|
|
287
285
|
self.editor.buffer.MarkerAdd(lineno - 1, style)
|
|
288
286
|
else:
|
|
289
287
|
self.editor.buffer.MarkerDeleteAll(style)
|
|
290
|
-
|
|
288
|
+
|
|
291
289
|
def on_debug_begin(self, frame):
|
|
292
290
|
"""Called before set_trace.
|
|
293
291
|
Note: self.busy -> False or None
|
|
294
292
|
"""
|
|
295
293
|
self.__hookpoint = None
|
|
296
294
|
self.indents = ' ' * 2
|
|
297
|
-
self.stdin.input = ''
|
|
298
|
-
|
|
295
|
+
self.stdin.input = '' # clear stdin buffer
|
|
296
|
+
|
|
299
297
|
def on_debug_mark(self, frame):
|
|
300
298
|
"""Called when interaction."""
|
|
301
299
|
code = frame.f_code
|
|
@@ -307,8 +305,8 @@ class Debugger(Pdb):
|
|
|
307
305
|
module = import_module(m.group(1))
|
|
308
306
|
filename = inspect.getfile(module)
|
|
309
307
|
|
|
310
|
-
editor = self.parent.
|
|
311
|
-
|
|
308
|
+
editor = next(self.parent.get_all_editors(code),
|
|
309
|
+
next(self.parent.get_all_editors(filename), None))
|
|
312
310
|
if not editor:
|
|
313
311
|
editor = self.parent.Log
|
|
314
312
|
## Note: Need a post-call for a thread debugging.
|
|
@@ -319,21 +317,21 @@ class Debugger(Pdb):
|
|
|
319
317
|
self.editor.buffer.SetFocus()
|
|
320
318
|
|
|
321
319
|
for ln in self.get_file_breaks(filename):
|
|
322
|
-
self._markbp(ln, 1)
|
|
320
|
+
self._markbp(ln, 1) # (>>) bp:white-arrow
|
|
323
321
|
|
|
324
322
|
def _mark():
|
|
325
323
|
buffer = self.editor.buffer
|
|
326
324
|
if filename == buffer.filename:
|
|
327
325
|
if code != self.code:
|
|
328
|
-
buffer.markline = firstlineno - 1
|
|
326
|
+
buffer.markline = firstlineno - 1 # (o) entry:mark
|
|
329
327
|
buffer.goto_marker(1)
|
|
330
328
|
buffer.recenter(3)
|
|
331
329
|
buffer.goto_line(lineno - 1)
|
|
332
|
-
buffer.pointer = lineno - 1
|
|
333
|
-
buffer.
|
|
330
|
+
buffer.pointer = lineno - 1 # (->) pointer:mark
|
|
331
|
+
buffer.ensureLineMoreOnScreen(lineno - 1)
|
|
334
332
|
self.code = code
|
|
335
333
|
wx.CallAfter(_mark)
|
|
336
|
-
|
|
334
|
+
|
|
337
335
|
def on_debug_next(self, frame):
|
|
338
336
|
"""Called in preloop (cmdloop)."""
|
|
339
337
|
shell = self.interactive_shell
|
|
@@ -343,13 +341,13 @@ class Debugger(Pdb):
|
|
|
343
341
|
pos = self.__cpos
|
|
344
342
|
out = shell.GetTextRange(pos, shell.cpos)
|
|
345
343
|
if out.strip(' ') == self.prompt.strip(' ') and pos > shell.bol:
|
|
346
|
-
shell.cpos = pos
|
|
344
|
+
shell.cpos = pos # backward selection
|
|
347
345
|
shell.ReplaceSelection('')
|
|
348
346
|
shell.prompt()
|
|
349
347
|
shell.EnsureCaretVisible()
|
|
350
348
|
self.__cpos = shell.cpos
|
|
351
349
|
wx.CallAfter(_next)
|
|
352
|
-
|
|
350
|
+
|
|
353
351
|
def on_debug_end(self, frame):
|
|
354
352
|
"""Called after set_quit.
|
|
355
353
|
Note: self.busy -> True (until this stage)
|
|
@@ -361,23 +359,23 @@ class Debugger(Pdb):
|
|
|
361
359
|
|
|
362
360
|
## Note: Required to terminate the reader of threading pdb.
|
|
363
361
|
self.send_input('\n')
|
|
364
|
-
|
|
362
|
+
|
|
365
363
|
def on_trace_hook(self, frame):
|
|
366
364
|
"""Called when a breakppoint is reached."""
|
|
367
365
|
self.__hookpoint = None
|
|
368
|
-
self.interactive_shell.write('\n', -1)
|
|
366
|
+
self.interactive_shell.write('\n', -1) # move to eolc and insert LFD
|
|
369
367
|
self.message(where(frame.f_code), indent=0)
|
|
370
|
-
|
|
368
|
+
|
|
371
369
|
## --------------------------------
|
|
372
|
-
## Override Bdb methods
|
|
370
|
+
## Override Bdb methods.
|
|
373
371
|
## --------------------------------
|
|
374
|
-
|
|
372
|
+
|
|
375
373
|
def break_anywhere(self, frame):
|
|
376
374
|
"""Return False (override)
|
|
377
375
|
even if there is any breakpoint for frame's filename.
|
|
378
376
|
"""
|
|
379
377
|
return False
|
|
380
|
-
|
|
378
|
+
|
|
381
379
|
def dispatch_line(self, frame):
|
|
382
380
|
"""Invoke user function and return trace function for line event.
|
|
383
381
|
|
|
@@ -396,7 +394,7 @@ class Debugger(Pdb):
|
|
|
396
394
|
else:
|
|
397
395
|
return None
|
|
398
396
|
return Pdb.dispatch_line(self, frame)
|
|
399
|
-
|
|
397
|
+
|
|
400
398
|
def dispatch_call(self, frame, arg):
|
|
401
399
|
"""Invoke user function and return trace function for call event.
|
|
402
400
|
|
|
@@ -407,14 +405,14 @@ class Debugger(Pdb):
|
|
|
407
405
|
filename = frame.f_code.co_filename
|
|
408
406
|
lineno = frame.f_lineno
|
|
409
407
|
if target == filename:
|
|
410
|
-
if lineno <= line:
|
|
408
|
+
if lineno <= line: # continue to dispatch_line
|
|
411
409
|
return self.trace_dispatch
|
|
412
410
|
else:
|
|
413
411
|
return None
|
|
414
412
|
else:
|
|
415
413
|
return None
|
|
416
414
|
return Pdb.dispatch_call(self, frame, arg)
|
|
417
|
-
|
|
415
|
+
|
|
418
416
|
def dispatch_return(self, frame, arg):
|
|
419
417
|
"""Invoke user function and return trace function for return event.
|
|
420
418
|
|
|
@@ -423,7 +421,7 @@ class Debugger(Pdb):
|
|
|
423
421
|
if self.__hookpoint:
|
|
424
422
|
return None
|
|
425
423
|
return Pdb.dispatch_return(self, frame, arg)
|
|
426
|
-
|
|
424
|
+
|
|
427
425
|
def dispatch_exception(self, frame, arg):
|
|
428
426
|
"""Invoke user function and return trace function for exception event.
|
|
429
427
|
|
|
@@ -432,7 +430,7 @@ class Debugger(Pdb):
|
|
|
432
430
|
if self.__hookpoint:
|
|
433
431
|
return None
|
|
434
432
|
return Pdb.dispatch_exception(self, frame, arg)
|
|
435
|
-
|
|
433
|
+
|
|
436
434
|
def set_trace(self, frame=None):
|
|
437
435
|
if self.busy:
|
|
438
436
|
wx.MessageBox("Debugger is running.\n\n"
|
|
@@ -442,34 +440,34 @@ class Debugger(Pdb):
|
|
|
442
440
|
frame = inspect.currentframe().f_back
|
|
443
441
|
self.handler('debug_begin', frame)
|
|
444
442
|
Pdb.set_trace(self, frame)
|
|
445
|
-
|
|
443
|
+
|
|
446
444
|
def set_break(self, filename, lineno, *args, **kwargs):
|
|
447
445
|
self._markbp(lineno, 1)
|
|
448
446
|
return Pdb.set_break(self, filename, lineno, *args, **kwargs)
|
|
449
|
-
|
|
447
|
+
|
|
450
448
|
def set_quit(self):
|
|
451
449
|
try:
|
|
452
450
|
Pdb.set_quit(self)
|
|
453
451
|
finally:
|
|
454
|
-
if self.parent:
|
|
452
|
+
if self.parent: # Check if the parent is being deleted.
|
|
455
453
|
self.handler('debug_end', self.curframe)
|
|
456
|
-
|
|
454
|
+
|
|
457
455
|
## --------------------------------
|
|
458
|
-
## Override Pdb methods
|
|
456
|
+
## Override Pdb methods.
|
|
459
457
|
## --------------------------------
|
|
460
|
-
|
|
458
|
+
|
|
461
459
|
@echo
|
|
462
460
|
def print_stack_entry(self, frame_lineno, prompt_prefix=None):
|
|
463
461
|
"""Print the stack entry frame_lineno (frame, lineno).
|
|
464
462
|
|
|
465
463
|
(override) Change prompt_prefix.
|
|
466
|
-
Add pointer:
|
|
464
|
+
Add pointer:mark when step next or jump.
|
|
467
465
|
"""
|
|
468
466
|
if self.verbose:
|
|
469
467
|
Pdb.print_stack_entry(self, frame_lineno,
|
|
470
468
|
prompt_prefix or "\n{}-> ".format(self.indents))
|
|
471
469
|
self.handler('debug_mark', frame_lineno[0])
|
|
472
|
-
|
|
470
|
+
|
|
473
471
|
@echo
|
|
474
472
|
def user_call(self, frame, argument_list):
|
|
475
473
|
"""--Call--
|
|
@@ -481,13 +479,13 @@ class Debugger(Pdb):
|
|
|
481
479
|
self.message("> {}".format(where(frame)), indent=0)
|
|
482
480
|
self.indents += ' ' * 2
|
|
483
481
|
Pdb.user_call(self, frame, argument_list)
|
|
484
|
-
|
|
482
|
+
|
|
485
483
|
@echo
|
|
486
484
|
def user_line(self, frame):
|
|
487
485
|
"""--Next--
|
|
488
486
|
"""
|
|
489
487
|
Pdb.user_line(self, frame)
|
|
490
|
-
|
|
488
|
+
|
|
491
489
|
@echo
|
|
492
490
|
def user_return(self, frame, return_value):
|
|
493
491
|
"""--Return--
|
|
@@ -502,10 +500,10 @@ class Debugger(Pdb):
|
|
|
502
500
|
frame.f_locals['__return__'] = return_value
|
|
503
501
|
self.message('--Return--')
|
|
504
502
|
if len(self.indents) > 2:
|
|
505
|
-
self.indents = self.indents[:-2]
|
|
503
|
+
self.indents = self.indents[:-2] # remove ' '
|
|
506
504
|
self.interaction(frame, None)
|
|
507
505
|
## Pdb.user_return(self, frame, return_value)
|
|
508
|
-
|
|
506
|
+
|
|
509
507
|
@echo
|
|
510
508
|
def user_exception(self, frame, exc_info):
|
|
511
509
|
"""--Exception--
|
|
@@ -516,7 +514,7 @@ class Debugger(Pdb):
|
|
|
516
514
|
self._markbp(tb.tb_lineno, 2)
|
|
517
515
|
self.message(tb.tb_frame, indent=0)
|
|
518
516
|
Pdb.user_exception(self, frame, exc_info)
|
|
519
|
-
|
|
517
|
+
|
|
520
518
|
@echo
|
|
521
519
|
def bp_commands(self, frame):
|
|
522
520
|
"""--Break--
|
|
@@ -529,13 +527,13 @@ class Debugger(Pdb):
|
|
|
529
527
|
for lineno in breakpoints:
|
|
530
528
|
self._markbp(lineno, 1)
|
|
531
529
|
return Pdb.bp_commands(self, frame)
|
|
532
|
-
|
|
530
|
+
|
|
533
531
|
@echo
|
|
534
532
|
def preloop(self):
|
|
535
533
|
"""Hook method executed once when the cmdloop() method is called."""
|
|
536
534
|
Pdb.preloop(self)
|
|
537
535
|
self.handler('debug_next', self.curframe)
|
|
538
|
-
|
|
536
|
+
|
|
539
537
|
@echo
|
|
540
538
|
def postloop(self):
|
|
541
539
|
"""Hook method executed once when the cmdloop() method is about to return."""
|
mwx/wxwil.py
CHANGED
|
@@ -17,11 +17,11 @@ 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
|
-
parent
|
|
24
|
-
target
|
|
23
|
+
parent: shellframe
|
|
24
|
+
target: locals:dict to watch
|
|
25
25
|
"""
|
|
26
26
|
def __init__(self, parent, **kwargs):
|
|
27
27
|
wx.ListCtrl.__init__(self, parent,
|
|
@@ -34,8 +34,8 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
34
34
|
|
|
35
35
|
self.Font = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
|
|
36
36
|
|
|
37
|
-
self.__dir = True
|
|
38
|
-
self.__items = []
|
|
37
|
+
self.__dir = True # sort direction
|
|
38
|
+
self.__items = [] # list of data:str
|
|
39
39
|
|
|
40
40
|
_alist = (
|
|
41
41
|
("key", 140),
|
|
@@ -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
|
-
## Actions on list items
|
|
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
|
|
@@ -116,7 +116,7 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
116
116
|
if i is not None:
|
|
117
117
|
if data[i][1] == vstr:
|
|
118
118
|
continue
|
|
119
|
-
data[i][1] = vstr
|
|
119
|
+
data[i][1] = vstr # Update data to locals
|
|
120
120
|
else:
|
|
121
121
|
i = len(data)
|
|
122
122
|
item = [key, vstr]
|
|
@@ -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,8 +143,8 @@ 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
|
-
|
|
147
|
-
def OnSortItems(self, evt):
|
|
146
|
+
|
|
147
|
+
def OnSortItems(self, evt): #<wx._controls.ListEvent>
|
|
148
148
|
n = self.ItemCount
|
|
149
149
|
if n < 2:
|
|
150
150
|
return
|
|
@@ -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'),
|