mwxlib 1.5.0__py3-none-any.whl → 1.5.10__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 +19 -13
- mwx/controls.py +10 -10
- mwx/framework.py +85 -71
- mwx/graphman.py +114 -112
- mwx/matplot2.py +13 -12
- mwx/matplot2g.py +22 -30
- mwx/matplot2lg.py +10 -10
- mwx/mgplt.py +1 -1
- mwx/nutshell.py +110 -79
- mwx/plugins/ffmpeg_view.py +3 -4
- mwx/plugins/fft_view.py +2 -2
- mwx/plugins/frame_listview.py +12 -7
- mwx/testsuite.py +10 -10
- mwx/utilus.py +17 -11
- mwx/wxpdb.py +3 -3
- {mwxlib-1.5.0.dist-info → mwxlib-1.5.10.dist-info}/METADATA +1 -1
- mwxlib-1.5.10.dist-info/RECORD +28 -0
- {mwxlib-1.5.0.dist-info → mwxlib-1.5.10.dist-info}/WHEEL +1 -1
- mwxlib-1.5.0.dist-info/RECORD +0 -28
- {mwxlib-1.5.0.dist-info → mwxlib-1.5.10.dist-info}/top_level.txt +0 -0
mwx/bookshelf.py
CHANGED
|
@@ -35,7 +35,7 @@ class MyDropTarget(wx.DropTarget):
|
|
|
35
35
|
def OnData(self, x, y, result):
|
|
36
36
|
item = self.tree.Selection
|
|
37
37
|
name = self.tree.GetItemText(item)
|
|
38
|
-
editor = self.tree.
|
|
38
|
+
editor = self.tree._find_editor(name)
|
|
39
39
|
self.GetData()
|
|
40
40
|
if self.datado.Data:
|
|
41
41
|
fn = self.datado.Data.tobytes().decode()
|
|
@@ -95,7 +95,7 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
95
95
|
'*button* released' : [ None, dispatch ],
|
|
96
96
|
},
|
|
97
97
|
0 : {
|
|
98
|
-
'delete pressed' : (0, self.
|
|
98
|
+
'delete pressed' : (0, self.on_delete_buffer),
|
|
99
99
|
},
|
|
100
100
|
})
|
|
101
101
|
self.context = { # DNA<EditorBook>
|
|
@@ -109,6 +109,7 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
109
109
|
'buffer_caption_updated' : [ None, self.on_buffer_filename ],
|
|
110
110
|
},
|
|
111
111
|
}
|
|
112
|
+
|
|
112
113
|
def _attach():
|
|
113
114
|
if self and self.parent:
|
|
114
115
|
for editor in self.parent.get_all_editors():
|
|
@@ -123,16 +124,8 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
123
124
|
editor.handler.remove(self.context)
|
|
124
125
|
evt.Skip()
|
|
125
126
|
|
|
126
|
-
def _delete(self, evt):
|
|
127
|
-
item = self.Selection
|
|
128
|
-
if item:
|
|
129
|
-
data = self.GetItemData(item)
|
|
130
|
-
if data:
|
|
131
|
-
data.parent.kill_buffer(data) # the focus moves
|
|
132
|
-
wx.CallAfter(self.SetFocus)
|
|
133
|
-
|
|
134
127
|
## --------------------------------
|
|
135
|
-
## TreeList/Ctrl wrapper interface
|
|
128
|
+
## TreeList/Ctrl wrapper interface
|
|
136
129
|
## --------------------------------
|
|
137
130
|
|
|
138
131
|
def build_tree(self, clear=True):
|
|
@@ -200,6 +193,18 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
200
193
|
if self and buf:
|
|
201
194
|
self.SetItemText(buf.__itemId, buf.caption_prefix + buf.name)
|
|
202
195
|
|
|
196
|
+
def on_delete_buffer(self, evt):
|
|
197
|
+
item = self.Selection
|
|
198
|
+
if item:
|
|
199
|
+
data = self.GetItemData(item)
|
|
200
|
+
if data:
|
|
201
|
+
data.parent.kill_buffer(data) # the focus moves
|
|
202
|
+
wx.CallAfter(self.SetFocus)
|
|
203
|
+
|
|
204
|
+
def _find_editor(self, name):
|
|
205
|
+
## return self.Parent.FindWindow(name) # window.Name (not page.caption)
|
|
206
|
+
return next(editor for editor in self.parent.get_all_editors() if editor.Name == name)
|
|
207
|
+
|
|
203
208
|
def OnSelChanged(self, evt):
|
|
204
209
|
if self and self.HasFocus():
|
|
205
210
|
data = self.GetItemData(evt.Item)
|
|
@@ -207,9 +212,10 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
207
212
|
data.SetFocus()
|
|
208
213
|
else:
|
|
209
214
|
name = self.GetItemText(evt.Item)
|
|
210
|
-
editor = self.
|
|
215
|
+
editor = self._find_editor(name)
|
|
211
216
|
if not editor.IsShown():
|
|
212
|
-
|
|
217
|
+
nb = self.Parent
|
|
218
|
+
nb.Selection = nb.FindPage(editor)
|
|
213
219
|
wx.CallAfter(self.SetFocus)
|
|
214
220
|
evt.Skip()
|
|
215
221
|
|
mwx/controls.py
CHANGED
|
@@ -283,7 +283,7 @@ class LParam(Param):
|
|
|
283
283
|
|
|
284
284
|
|
|
285
285
|
## --------------------------------
|
|
286
|
-
## Knob unit for Parameter Control
|
|
286
|
+
## Knob unit for Parameter Control
|
|
287
287
|
## --------------------------------
|
|
288
288
|
|
|
289
289
|
class Knob(wx.Panel):
|
|
@@ -390,7 +390,7 @@ class Knob(wx.Panel):
|
|
|
390
390
|
self._ctrl.Bind(wx.EVT_KEY_DOWN, self.OnCtrlKeyDown)
|
|
391
391
|
self._ctrl.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
|
|
392
392
|
|
|
393
|
-
elif type == 'spin' or type =='hspin':
|
|
393
|
+
elif type == 'spin' or type == 'hspin':
|
|
394
394
|
self._ctrl = wx.SpinButton(self, size=(cw,h), style=wx.SP_HORIZONTAL)
|
|
395
395
|
self._ctrl.Bind(wx.EVT_SPIN, self.OnScroll)
|
|
396
396
|
self._ctrl.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
|
|
@@ -503,7 +503,7 @@ class Knob(wx.Panel):
|
|
|
503
503
|
evt.Skip()
|
|
504
504
|
|
|
505
505
|
def OnMouseWheel(self, evt): #<wx._core.MouseEvent>
|
|
506
|
-
self.shift_ctrl(evt, 1 if evt.WheelRotation>0 else -1)
|
|
506
|
+
self.shift_ctrl(evt, (1 if evt.WheelRotation > 0 else -1))
|
|
507
507
|
evt.Skip(False)
|
|
508
508
|
|
|
509
509
|
def OnCtrlKeyDown(self, evt): #<wx._core.KeyEvent>
|
|
@@ -859,7 +859,7 @@ class Clipboard:
|
|
|
859
859
|
|
|
860
860
|
|
|
861
861
|
## --------------------------------
|
|
862
|
-
## Wx custom controls and bitmaps
|
|
862
|
+
## Wx custom controls and bitmaps
|
|
863
863
|
## --------------------------------
|
|
864
864
|
|
|
865
865
|
class Icon(wx.Bitmap):
|
|
@@ -906,8 +906,8 @@ class Icon(wx.Bitmap):
|
|
|
906
906
|
'->|' : wx.ART_GOTO_LAST,
|
|
907
907
|
}
|
|
908
908
|
custom_images = {
|
|
909
|
-
k:v for k, v in vars(images).items()
|
|
910
|
-
|
|
909
|
+
k: v for k, v in vars(images).items()
|
|
910
|
+
if isinstance(v, wx.lib.embeddedimage.PyEmbeddedImage)
|
|
911
911
|
}
|
|
912
912
|
|
|
913
913
|
def __init__(self, *args, **kwargs):
|
|
@@ -1085,7 +1085,7 @@ class TextBox(wx.Control):
|
|
|
1085
1085
|
"""
|
|
1086
1086
|
Value = property(
|
|
1087
1087
|
lambda self: self._ctrl.GetValue(),
|
|
1088
|
-
lambda self,v: self._ctrl.SetValue(v),
|
|
1088
|
+
lambda self, v: self._ctrl.SetValue(v),
|
|
1089
1089
|
doc="textctrl value:str")
|
|
1090
1090
|
|
|
1091
1091
|
value = Value #: internal use only
|
|
@@ -1154,19 +1154,19 @@ class Choice(wx.Control):
|
|
|
1154
1154
|
"""
|
|
1155
1155
|
Value = property(
|
|
1156
1156
|
lambda self: self._ctrl.GetValue(),
|
|
1157
|
-
lambda self,v: self._ctrl.SetValue(v),
|
|
1157
|
+
lambda self, v: self._ctrl.SetValue(v),
|
|
1158
1158
|
doc="combobox value:str")
|
|
1159
1159
|
|
|
1160
1160
|
value = Value #: internal use only
|
|
1161
1161
|
|
|
1162
1162
|
Selection = property(
|
|
1163
1163
|
lambda self: self._ctrl.GetSelection(),
|
|
1164
|
-
lambda self,v: self._ctrl.SetSelection(v),
|
|
1164
|
+
lambda self, v: self._ctrl.SetSelection(v), # int or NOT_FOUND(-1)
|
|
1165
1165
|
doc="combobox selection:int")
|
|
1166
1166
|
|
|
1167
1167
|
Items = property(
|
|
1168
1168
|
lambda self: self._ctrl.GetItems(),
|
|
1169
|
-
lambda self,v: self._ctrl.SetItems(v),
|
|
1169
|
+
lambda self, v: self._ctrl.SetItems(v),
|
|
1170
1170
|
doc="combobox items:list")
|
|
1171
1171
|
|
|
1172
1172
|
button = property(lambda self: self._btn)
|
mwx/framework.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#! python3
|
|
2
2
|
"""mwxlib framework.
|
|
3
3
|
"""
|
|
4
|
-
__version__ = "1.5.
|
|
4
|
+
__version__ = "1.5.10"
|
|
5
5
|
__author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
|
|
6
6
|
|
|
7
7
|
from contextlib import contextmanager
|
|
@@ -36,7 +36,7 @@ def deb(target=None, loop=True, locals=None, **kwargs):
|
|
|
36
36
|
**kwargs: ShellFrame and Nautilus arguments
|
|
37
37
|
|
|
38
38
|
- session : file name of the session. Defaults to None.
|
|
39
|
-
-
|
|
39
|
+
- standalone : True => EVT_CLOSE will close the window.
|
|
40
40
|
False => EVT_CLOSE will hide the window.
|
|
41
41
|
- introText : introductory of the shell
|
|
42
42
|
- startupScript : startup script file (default None)
|
|
@@ -47,7 +47,7 @@ def deb(target=None, loop=True, locals=None, **kwargs):
|
|
|
47
47
|
"""
|
|
48
48
|
kwargs.setdefault("introText", f"mwx {__version__}\n")
|
|
49
49
|
kwargs.setdefault("execStartupScript", True)
|
|
50
|
-
kwargs.setdefault("
|
|
50
|
+
kwargs.setdefault("standalone", True)
|
|
51
51
|
|
|
52
52
|
if "debrc" in kwargs: # for backward compatibility
|
|
53
53
|
warn("Deprecated keyword: 'debrc'. Use 'session' instead.", DeprecationWarning)
|
|
@@ -243,7 +243,7 @@ class KeyCtrlInterfaceMixin:
|
|
|
243
243
|
|
|
244
244
|
def _Pass(evt):
|
|
245
245
|
self.message("{} {}".format(keymap, evt.key))
|
|
246
|
-
_Pass.__name__ = str(
|
|
246
|
+
_Pass.__name__ = str("pass")
|
|
247
247
|
|
|
248
248
|
state = self.handler.default_state
|
|
249
249
|
event = keymap + ' pressed'
|
|
@@ -264,9 +264,6 @@ class KeyCtrlInterfaceMixin:
|
|
|
264
264
|
},
|
|
265
265
|
})
|
|
266
266
|
|
|
267
|
-
builtins.enter = "Enter extension mode."
|
|
268
|
-
builtins.exit = "Exit extension mode."
|
|
269
|
-
|
|
270
267
|
def pre_command_hook(self, evt):
|
|
271
268
|
## """Called when entering extension mode (internal use only)."""
|
|
272
269
|
## Check text selection for [C-c/C-x].
|
|
@@ -277,7 +274,7 @@ class KeyCtrlInterfaceMixin:
|
|
|
277
274
|
else:
|
|
278
275
|
self.message(evt.key + '-')
|
|
279
276
|
evt.Skip()
|
|
280
|
-
pre_command_hook.__name__ = str(
|
|
277
|
+
pre_command_hook.__name__ = str("enter")
|
|
281
278
|
|
|
282
279
|
def post_command_hook(self, evt):
|
|
283
280
|
## """Called when exiting extension mode (internal use only)."""
|
|
@@ -290,7 +287,7 @@ class KeyCtrlInterfaceMixin:
|
|
|
290
287
|
else:
|
|
291
288
|
self.message(evt.key)
|
|
292
289
|
evt.Skip()
|
|
293
|
-
post_command_hook.__name__ = str(
|
|
290
|
+
post_command_hook.__name__ = str("exit")
|
|
294
291
|
|
|
295
292
|
def define_key(self, keymap, action=None, /, *args, **kwargs):
|
|
296
293
|
"""Define [map key (pressed)] action.
|
|
@@ -325,6 +322,7 @@ class KeyCtrlInterfaceMixin:
|
|
|
325
322
|
return lambda f: self.define_key(keymap, f, *args, **kwargs)
|
|
326
323
|
|
|
327
324
|
F = _F(action, *args, **kwargs)
|
|
325
|
+
|
|
328
326
|
@wraps(F)
|
|
329
327
|
def f(*v, **kw):
|
|
330
328
|
self.message(f.__name__)
|
|
@@ -468,7 +466,7 @@ class CtrlInterface(KeyCtrlInterfaceMixin):
|
|
|
468
466
|
kbtn = self.__key + self.__button
|
|
469
467
|
self.handler('{}drag end'.format(kbtn), evt)
|
|
470
468
|
|
|
471
|
-
k = evt.GetButton() #{1:L, 2:M, 3:R, 4:X1, 5:X2}
|
|
469
|
+
k = evt.GetButton() # {1:L, 2:M, 3:R, 4:X1, 5:X2}
|
|
472
470
|
if action == 'pressed' and k in (1,2,3):
|
|
473
471
|
self.__button = 'LMR'[k-1]
|
|
474
472
|
else:
|
|
@@ -582,7 +580,7 @@ class Menu(wx.Menu):
|
|
|
582
580
|
continue
|
|
583
581
|
id = item[0]
|
|
584
582
|
handlers = [x for x in item if callable(x)]
|
|
585
|
-
icons =
|
|
583
|
+
icons = [x for x in item if isinstance(x, wx.Bitmap)]
|
|
586
584
|
argv = [x for x in item if x not in handlers and x not in icons]
|
|
587
585
|
if isinstance(id, int):
|
|
588
586
|
menu_item = wx.MenuItem(self, *argv) # <- menu_item.Id
|
|
@@ -1062,7 +1060,7 @@ class ShellFrame(MiniFrame):
|
|
|
1062
1060
|
session : file name of the session. Defaults to None.
|
|
1063
1061
|
If None, no session will be created or saved.
|
|
1064
1062
|
If `''`, the default session (.debrc) will be loaded.
|
|
1065
|
-
|
|
1063
|
+
standalone : flag for the shell standalone.
|
|
1066
1064
|
If True, EVT_CLOSE will close the window.
|
|
1067
1065
|
Otherwise the window will be only hidden.
|
|
1068
1066
|
**kwargs : Nautilus arguments
|
|
@@ -1098,17 +1096,17 @@ class ShellFrame(MiniFrame):
|
|
|
1098
1096
|
"""
|
|
1099
1097
|
rootshell = property(lambda self: self.__shell) #: the root shell
|
|
1100
1098
|
|
|
1101
|
-
def __init__(self, parent, target=None, session=None,
|
|
1099
|
+
def __init__(self, parent, target=None, session=None, standalone=False, **kwargs):
|
|
1102
1100
|
MiniFrame.__init__(self, parent, size=(1280,720), style=wx.DEFAULT_FRAME_STYLE)
|
|
1103
1101
|
|
|
1104
1102
|
self.statusbar.resize((-1,120))
|
|
1105
1103
|
self.statusbar.Show(1)
|
|
1106
1104
|
|
|
1107
|
-
self.__standalone = bool(
|
|
1105
|
+
self.__standalone = bool(standalone)
|
|
1108
1106
|
|
|
1109
1107
|
self.Init()
|
|
1110
1108
|
|
|
1111
|
-
from .nutshell import Nautilus, EditorBook
|
|
1109
|
+
from .nutshell import Nautilus, EditorBook, Stylus
|
|
1112
1110
|
from .bookshelf import EditorTreeCtrl
|
|
1113
1111
|
|
|
1114
1112
|
self.__shell = Nautilus(self,
|
|
@@ -1123,6 +1121,28 @@ class ShellFrame(MiniFrame):
|
|
|
1123
1121
|
self.Bookshelf = EditorTreeCtrl(self, name="Bookshelf",
|
|
1124
1122
|
style=wx.TR_DEFAULT_STYLE|wx.TR_HIDE_ROOT)
|
|
1125
1123
|
|
|
1124
|
+
## Set shell and editor styles.
|
|
1125
|
+
self.Scratch.set_attributes(Style=Stylus.py_shell_mode)
|
|
1126
|
+
|
|
1127
|
+
self.Log.set_attributes(ReadOnly=True,
|
|
1128
|
+
Style=Stylus.py_log_mode)
|
|
1129
|
+
|
|
1130
|
+
self.Help.set_attributes(ReadOnly=False,
|
|
1131
|
+
Style=Stylus.py_log_mode)
|
|
1132
|
+
|
|
1133
|
+
self.set_hookable(self.Scratch)
|
|
1134
|
+
self.set_hookable(self.Log)
|
|
1135
|
+
|
|
1136
|
+
@self.Scratch.define_key('C-j')
|
|
1137
|
+
def eval_line(evt):
|
|
1138
|
+
self.Scratch.buffer.eval_line()
|
|
1139
|
+
evt.Skip(False) # Don't skip explicitly.
|
|
1140
|
+
|
|
1141
|
+
@self.Scratch.define_key('M-j')
|
|
1142
|
+
def eval_buffer(evt):
|
|
1143
|
+
self.Scratch.buffer.exec_region()
|
|
1144
|
+
evt.Skip(False) # Don't skip explicitly.
|
|
1145
|
+
|
|
1126
1146
|
from .wxpdb import Debugger
|
|
1127
1147
|
from .wxwit import Inspector
|
|
1128
1148
|
from .wxmon import EventMonitor
|
|
@@ -1203,6 +1223,8 @@ class ShellFrame(MiniFrame):
|
|
|
1203
1223
|
|
|
1204
1224
|
self.Bind(wx.EVT_FIND, self.OnFindNext)
|
|
1205
1225
|
self.Bind(wx.EVT_FIND_NEXT, self.OnFindNext)
|
|
1226
|
+
self.Bind(wx.EVT_FIND_REPLACE, self.OnFindNext)
|
|
1227
|
+
self.Bind(wx.EVT_FIND_REPLACE_ALL, self.OnFindNext)
|
|
1206
1228
|
self.Bind(wx.EVT_FIND_CLOSE, self.OnFindClose)
|
|
1207
1229
|
|
|
1208
1230
|
self.indicator = Indicator(self.statusbar, value=1)
|
|
@@ -1255,6 +1277,7 @@ class ShellFrame(MiniFrame):
|
|
|
1255
1277
|
'C-g pressed' : (0, self.Quit, fork_debugger),
|
|
1256
1278
|
'f1 pressed' : (0, self.About),
|
|
1257
1279
|
'C-f pressed' : (0, self.on_search_dialog),
|
|
1280
|
+
'C-S-f pressed' : (0, self.on_replace_dialog),
|
|
1258
1281
|
'f3 pressed' : (0, self.repeat_forward_search),
|
|
1259
1282
|
'S-f3 pressed' : (0, self.repeat_backward_search),
|
|
1260
1283
|
'f11 pressed' : (0, _F(self.toggle_window, win=self.ghost, alias='toggle_ghost')),
|
|
@@ -1273,8 +1296,6 @@ class ShellFrame(MiniFrame):
|
|
|
1273
1296
|
self.load_session(session or self.SESSION_FILE)
|
|
1274
1297
|
else:
|
|
1275
1298
|
self.SESSION_FILE = None
|
|
1276
|
-
|
|
1277
|
-
self.postInit()
|
|
1278
1299
|
|
|
1279
1300
|
def load_session(self, filename):
|
|
1280
1301
|
"""Load session from file.
|
|
@@ -1299,6 +1320,8 @@ class ShellFrame(MiniFrame):
|
|
|
1299
1320
|
exec(i.read())
|
|
1300
1321
|
except FileNotFoundError:
|
|
1301
1322
|
pass
|
|
1323
|
+
except Exception as e:
|
|
1324
|
+
print("- Failed to load session:", e)
|
|
1302
1325
|
self.SESSION_FILE = session
|
|
1303
1326
|
|
|
1304
1327
|
## Reposition the window if it is not on the desktop.
|
|
@@ -1342,34 +1365,6 @@ class ShellFrame(MiniFrame):
|
|
|
1342
1365
|
"self._mgr.Update()\n",
|
|
1343
1366
|
)))
|
|
1344
1367
|
|
|
1345
|
-
def postInit(self):
|
|
1346
|
-
"""Set shell and editor styles.
|
|
1347
|
-
Note:
|
|
1348
|
-
This is called after loading session.
|
|
1349
|
-
"""
|
|
1350
|
-
from .nutshell import Stylus
|
|
1351
|
-
|
|
1352
|
-
self.Scratch.set_attributes(Style=Stylus.py_shell_mode)
|
|
1353
|
-
|
|
1354
|
-
self.Log.set_attributes(ReadOnly=True,
|
|
1355
|
-
Style=Stylus.py_log_mode)
|
|
1356
|
-
|
|
1357
|
-
self.Help.set_attributes(ReadOnly=False,
|
|
1358
|
-
Style=Stylus.py_log_mode)
|
|
1359
|
-
|
|
1360
|
-
self.set_hookable(self.Scratch)
|
|
1361
|
-
self.set_hookable(self.Log)
|
|
1362
|
-
|
|
1363
|
-
@self.Scratch.define_key('C-j')
|
|
1364
|
-
def eval_line(evt):
|
|
1365
|
-
self.Scratch.buffer.eval_line()
|
|
1366
|
-
evt.Skip(False) # Don't skip explicitly.
|
|
1367
|
-
|
|
1368
|
-
@self.Scratch.define_key('M-j')
|
|
1369
|
-
def eval_buffer(evt):
|
|
1370
|
-
self.Scratch.buffer.exec_region()
|
|
1371
|
-
evt.Skip(False) # Don't skip explicitly.
|
|
1372
|
-
|
|
1373
1368
|
def Init(self):
|
|
1374
1369
|
"""Initialize self-specific builtins.
|
|
1375
1370
|
Note:
|
|
@@ -1418,6 +1413,12 @@ class ShellFrame(MiniFrame):
|
|
|
1418
1413
|
self._mgr.UnInit()
|
|
1419
1414
|
return MiniFrame.Destroy(self)
|
|
1420
1415
|
|
|
1416
|
+
def Close(self):
|
|
1417
|
+
if self.__standalone:
|
|
1418
|
+
MiniFrame.Close(self)
|
|
1419
|
+
else:
|
|
1420
|
+
self.Show(not self.Shown)
|
|
1421
|
+
|
|
1421
1422
|
def OnClose(self, evt):
|
|
1422
1423
|
if self.debugger.busy:
|
|
1423
1424
|
if wx.MessageBox( # Confirm closing the debugger.
|
|
@@ -1428,7 +1429,7 @@ class ShellFrame(MiniFrame):
|
|
|
1428
1429
|
self.message("The close has been canceled.")
|
|
1429
1430
|
evt.Veto()
|
|
1430
1431
|
return
|
|
1431
|
-
|
|
1432
|
+
## RuntimeError('wrapped C/C++ object ... has been deleted')
|
|
1432
1433
|
self.Quit()
|
|
1433
1434
|
|
|
1434
1435
|
if self.debugger.tracing:
|
|
@@ -1671,7 +1672,7 @@ class ShellFrame(MiniFrame):
|
|
|
1671
1672
|
except Exception as e:
|
|
1672
1673
|
print(e)
|
|
1673
1674
|
else:
|
|
1674
|
-
print("- obj
|
|
1675
|
+
print("- obj must be either a string or a callable.")
|
|
1675
1676
|
|
|
1676
1677
|
def profile(self, obj, *args, **kwargs):
|
|
1677
1678
|
"""Profile a single function call."""
|
|
@@ -1692,7 +1693,7 @@ class ShellFrame(MiniFrame):
|
|
|
1692
1693
|
except TypeError as e:
|
|
1693
1694
|
print(e)
|
|
1694
1695
|
else:
|
|
1695
|
-
print("- obj must be callable or
|
|
1696
|
+
print("- obj must be callable, or a string, bytes, or code object.")
|
|
1696
1697
|
|
|
1697
1698
|
## Note: history に余計な文字列が入らないようにする
|
|
1698
1699
|
@postcall
|
|
@@ -1869,7 +1870,7 @@ class ShellFrame(MiniFrame):
|
|
|
1869
1870
|
shell = next(self.get_all_shells(target))
|
|
1870
1871
|
except StopIteration:
|
|
1871
1872
|
shell = self.rootshell.__class__(self, target, name="clone",
|
|
1872
|
-
|
|
1873
|
+
style=wx.CLIP_CHILDREN|wx.BORDER_NONE)
|
|
1873
1874
|
self.console.AddPage(shell, typename(shell.target))
|
|
1874
1875
|
self.handler('shell_new', shell)
|
|
1875
1876
|
self.popup_window(shell)
|
|
@@ -1948,7 +1949,7 @@ class ShellFrame(MiniFrame):
|
|
|
1948
1949
|
|
|
1949
1950
|
__find_target = None
|
|
1950
1951
|
|
|
1951
|
-
def on_search_dialog(self, evt):
|
|
1952
|
+
def on_search_dialog(self, evt, flags=0):
|
|
1952
1953
|
if self.findDlg is not None:
|
|
1953
1954
|
self.findDlg.SetFocus()
|
|
1954
1955
|
return
|
|
@@ -1957,39 +1958,52 @@ class ShellFrame(MiniFrame):
|
|
|
1957
1958
|
if not isinstance(wnd, stc.StyledTextCtrl):
|
|
1958
1959
|
return
|
|
1959
1960
|
self.__find_target = wnd
|
|
1960
|
-
|
|
1961
|
+
topic = wnd.topic_at_caret
|
|
1962
|
+
if topic:
|
|
1963
|
+
self.findData.FindString = topic
|
|
1961
1964
|
self.findData.Flags |= wx.FR_DOWN
|
|
1962
|
-
self.findDlg = wx.FindReplaceDialog(wnd, self.findData, "Find")
|
|
1965
|
+
self.findDlg = wx.FindReplaceDialog(wnd, self.findData, "Find", flags)
|
|
1963
1966
|
self.findDlg.Show()
|
|
1964
1967
|
|
|
1968
|
+
def on_replace_dialog(self, evt):
|
|
1969
|
+
self.on_search_dialog(evt, flags=wx.FR_REPLACEDIALOG)
|
|
1970
|
+
|
|
1965
1971
|
def repeat_forward_search(self, evt):
|
|
1966
|
-
self.OnFindNext(evt,
|
|
1972
|
+
self.OnFindNext(evt, backward=False)
|
|
1967
1973
|
|
|
1968
1974
|
def repeat_backward_search(self, evt):
|
|
1969
|
-
self.OnFindNext(evt,
|
|
1975
|
+
self.OnFindNext(evt, backward=True)
|
|
1970
1976
|
|
|
1971
|
-
def OnFindNext(self, evt,
|
|
1977
|
+
def OnFindNext(self, evt, backward=None): #<wx._core.FindDialogEvent>
|
|
1972
1978
|
if not self.findData.FindString:
|
|
1973
1979
|
self.message("No last search.")
|
|
1974
1980
|
return
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
else:
|
|
1981
|
+
if isinstance(evt, wx.FindDialogEvent):
|
|
1982
|
+
wnd = self.findDlg.Parent
|
|
1983
|
+
else:
|
|
1984
|
+
wnd = evt.EventObject
|
|
1985
|
+
if not isinstance(wnd, stc.StyledTextCtrl):
|
|
1986
|
+
wnd = self.__find_target
|
|
1987
|
+
if backward:
|
|
1983
1988
|
self.findData.Flags &= ~wx.FR_DOWN
|
|
1989
|
+
else:
|
|
1990
|
+
self.findData.Flags |= wx.FR_DOWN
|
|
1984
1991
|
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
if
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
self.
|
|
1992
|
+
if evt.EventType == wx.EVT_FIND_REPLACE_ALL.typeId: # replace-all
|
|
1993
|
+
n = wnd.DoReplaceAll(self.findData)
|
|
1994
|
+
self.message(f"Replaced {n} strings.")
|
|
1995
|
+
if self.findDlg:
|
|
1996
|
+
self.OnFindClose(None)
|
|
1997
|
+
return
|
|
1998
|
+
elif evt.EventType == wx.EVT_FIND_REPLACE.typeId: # replace
|
|
1999
|
+
loc = wnd.DoReplaceNext(self.findData)
|
|
2000
|
+
else:
|
|
2001
|
+
loc = wnd.DoFindNext(self.findData)
|
|
2002
|
+
if self.findDlg:
|
|
2003
|
+
if not (self.findDlg.WindowStyle & wx.FR_REPLACEDIALOG): # for search-dialog
|
|
2004
|
+
self.OnFindClose(None)
|
|
2005
|
+
if loc < 0:
|
|
2006
|
+
self.message("Unable to find the search text.")
|
|
1993
2007
|
|
|
1994
2008
|
def OnFindClose(self, evt): #<wx._core.FindDialogEvent>
|
|
1995
2009
|
self.findDlg.Destroy()
|