mwxlib 0.80.0__py3-none-any.whl → 0.80.2__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/framework.py +23 -17
- mwx/graphman.py +2 -1
- mwx/nutshell.py +31 -25
- mwx/wxpdb.py +31 -1
- {mwxlib-0.80.0.dist-info → mwxlib-0.80.2.dist-info}/METADATA +1 -1
- {mwxlib-0.80.0.dist-info → mwxlib-0.80.2.dist-info}/RECORD +9 -9
- {mwxlib-0.80.0.dist-info → mwxlib-0.80.2.dist-info}/LICENSE +0 -0
- {mwxlib-0.80.0.dist-info → mwxlib-0.80.2.dist-info}/WHEEL +0 -0
- {mwxlib-0.80.0.dist-info → mwxlib-0.80.2.dist-info}/top_level.txt +0 -0
mwx/framework.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Author: Kazuya O'moto <komoto@jeol.co.jp>
|
|
6
6
|
"""
|
|
7
|
-
__version__ = "0.80.
|
|
7
|
+
__version__ = "0.80.2"
|
|
8
8
|
__author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
|
|
9
9
|
|
|
10
10
|
from functools import wraps, partial
|
|
@@ -1204,7 +1204,7 @@ class ShellFrame(MiniFrame):
|
|
|
1204
1204
|
for buf in book.all_buffers:
|
|
1205
1205
|
if book.need_buffer_save_p(buf):
|
|
1206
1206
|
self.popup_window(book)
|
|
1207
|
-
|
|
1207
|
+
buf.SetFocus()
|
|
1208
1208
|
if wx.MessageBox(
|
|
1209
1209
|
"You are closing unsaved content.\n\n"
|
|
1210
1210
|
"Changes to the content will be discarded.\n"
|
|
@@ -1324,12 +1324,12 @@ class ShellFrame(MiniFrame):
|
|
|
1324
1324
|
if x > 2*w or y > h:
|
|
1325
1325
|
pane.floating_pos = wx.GetMousePosition()
|
|
1326
1326
|
|
|
1327
|
+
if wnd and win.IsShown(): # restore focus
|
|
1328
|
+
wnd.SetFocus()
|
|
1329
|
+
|
|
1327
1330
|
nb.Show(show)
|
|
1328
1331
|
pane.Show(show)
|
|
1329
1332
|
self._mgr.Update()
|
|
1330
|
-
|
|
1331
|
-
if wnd and win.IsShown(): # restore focus
|
|
1332
|
-
wnd.SetFocus()
|
|
1333
1333
|
|
|
1334
1334
|
## --------------------------------
|
|
1335
1335
|
## Actions for handler
|
|
@@ -1352,13 +1352,11 @@ class ShellFrame(MiniFrame):
|
|
|
1352
1352
|
self.message("Quit")
|
|
1353
1353
|
evt.Skip()
|
|
1354
1354
|
|
|
1355
|
-
def load(self, obj,
|
|
1355
|
+
def load(self, obj, focus=False):
|
|
1356
1356
|
"""Load file @where the object is defined.
|
|
1357
1357
|
|
|
1358
1358
|
Args:
|
|
1359
1359
|
obj : target object.
|
|
1360
|
-
show : Popup window when success.
|
|
1361
|
-
The window will not be hidden even if no show.
|
|
1362
1360
|
focus : Set the focus if the window is displayed.
|
|
1363
1361
|
"""
|
|
1364
1362
|
if not isinstance(obj, str):
|
|
@@ -1384,16 +1382,11 @@ class ShellFrame(MiniFrame):
|
|
|
1384
1382
|
|
|
1385
1383
|
wnd = wx.Window.FindFocus() # original focus
|
|
1386
1384
|
try:
|
|
1387
|
-
|
|
1388
|
-
self.popup_window(book, show, focus)
|
|
1385
|
+
self.popup_window(book, focus=focus)
|
|
1389
1386
|
if buf and book.need_buffer_save_p(buf): # exists and need save?
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
if not book.load_file(filename, lineno, show):
|
|
1394
|
-
book.remove_buffer()
|
|
1395
|
-
return False
|
|
1396
|
-
return True
|
|
1387
|
+
buf.SetFocus()
|
|
1388
|
+
return book.load_buffer()
|
|
1389
|
+
return book.load_file(filename, lineno)
|
|
1397
1390
|
finally:
|
|
1398
1391
|
if not focus:
|
|
1399
1392
|
wx.CallAfter(wnd.SetFocus) # restore focus with delay
|
|
@@ -1431,6 +1424,19 @@ class ShellFrame(MiniFrame):
|
|
|
1431
1424
|
self.debugger.debug(obj, *args, **kwargs)
|
|
1432
1425
|
finally:
|
|
1433
1426
|
self.debugger.interactive_shell = shell
|
|
1427
|
+
elif isinstance(obj, str):
|
|
1428
|
+
try:
|
|
1429
|
+
shell = self.debugger.interactive_shell
|
|
1430
|
+
self.debugger.interactive_shell = self.current_shell
|
|
1431
|
+
self.debugger.editor = self.Log # set default logger
|
|
1432
|
+
filename = "<string>"
|
|
1433
|
+
buf = self.Log.find_buffer(filename)\
|
|
1434
|
+
or self.Log.create_new_buffer(filename)
|
|
1435
|
+
with buf.off_readonly():
|
|
1436
|
+
buf.Text = obj
|
|
1437
|
+
self.debugger.run(obj)
|
|
1438
|
+
finally:
|
|
1439
|
+
self.debugger.interactive_shell = shell
|
|
1434
1440
|
elif hasattr(obj, '__dict__'):
|
|
1435
1441
|
self.message("Building locals info list...")
|
|
1436
1442
|
self.linfo.watch(obj.__dict__)
|
mwx/graphman.py
CHANGED
|
@@ -1088,7 +1088,8 @@ class Frame(mwx.Frame):
|
|
|
1088
1088
|
floating_pos : posision of floating window
|
|
1089
1089
|
floating_size : size of floating window
|
|
1090
1090
|
|
|
1091
|
-
|
|
1091
|
+
Returns:
|
|
1092
|
+
None if succeeded else False
|
|
1092
1093
|
|
|
1093
1094
|
Note:
|
|
1094
1095
|
The root module must have a class `Plugin` <mwx.graphman.Layer>
|
mwx/nutshell.py
CHANGED
|
@@ -1795,7 +1795,7 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1795
1795
|
"""Yields context menu."""
|
|
1796
1796
|
def _menu(j, buf):
|
|
1797
1797
|
return (j, str(buf), '', wx.ITEM_CHECK,
|
|
1798
|
-
lambda v:
|
|
1798
|
+
lambda v: buf.SetFocus(),
|
|
1799
1799
|
lambda v: v.Check(buf is self.buffer))
|
|
1800
1800
|
|
|
1801
1801
|
return (_menu(j+1, x) for j, x in enumerate(self.all_buffers))
|
|
@@ -1818,16 +1818,17 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1818
1818
|
|
|
1819
1819
|
def swap_buffer(self, buf):
|
|
1820
1820
|
"""Replace buffer with specified buffer."""
|
|
1821
|
-
|
|
1821
|
+
j = self.GetPageIndex(buf)
|
|
1822
|
+
if j != -1:
|
|
1822
1823
|
wnd = wx.Window.FindFocus() # original focus
|
|
1823
|
-
j = self.GetPageIndex(buf)
|
|
1824
1824
|
if j != self.Selection:
|
|
1825
1825
|
self.Selection = j # the focus is moved
|
|
1826
1826
|
if wnd and wnd not in self.all_buffers: # restore focus other window
|
|
1827
1827
|
wnd.SetFocus()
|
|
1828
|
-
|
|
1828
|
+
return buf
|
|
1829
1829
|
|
|
1830
1830
|
def create_new_buffer(self, filename, index=None):
|
|
1831
|
+
"""Create a new buffer (internal use only)."""
|
|
1831
1832
|
try:
|
|
1832
1833
|
self.Freeze()
|
|
1833
1834
|
buf = Buffer(self, filename)
|
|
@@ -1841,6 +1842,7 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1841
1842
|
self.Thaw()
|
|
1842
1843
|
|
|
1843
1844
|
def new_buffer(self):
|
|
1845
|
+
"""Create a new default buffer."""
|
|
1844
1846
|
buf = self.default_buffer
|
|
1845
1847
|
if not buf or buf.mtdelta is not None: # is saved?
|
|
1846
1848
|
buf = self.create_new_buffer(self.default_name, index=0)
|
|
@@ -1856,7 +1858,7 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1856
1858
|
if not buf:
|
|
1857
1859
|
buf = self.buffer
|
|
1858
1860
|
j = self.GetPageIndex(buf)
|
|
1859
|
-
self.DeletePage(j)
|
|
1861
|
+
self.DeletePage(j) # the focus is moved
|
|
1860
1862
|
|
|
1861
1863
|
if not self.buffer: # no buffers:
|
|
1862
1864
|
self.new_buffer()
|
|
@@ -1884,7 +1886,7 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1884
1886
|
"""Returns whether the buffer should be saved."""
|
|
1885
1887
|
return buf.mtdelta is not None and buf.IsModified()
|
|
1886
1888
|
|
|
1887
|
-
def load_cache(self, filename, lineno=0, globals=None
|
|
1889
|
+
def load_cache(self, filename, lineno=0, globals=None):
|
|
1888
1890
|
"""Load a file from cache.
|
|
1889
1891
|
Note:
|
|
1890
1892
|
The filename should be an absolute path.
|
|
@@ -1892,13 +1894,11 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1892
1894
|
"""
|
|
1893
1895
|
buf = self.find_buffer(filename) or self.create_new_buffer(filename)
|
|
1894
1896
|
if buf._load_cache(filename, lineno, globals):
|
|
1895
|
-
|
|
1896
|
-
if focus:
|
|
1897
|
-
buf.SetFocus()
|
|
1897
|
+
buf.SetFocus()
|
|
1898
1898
|
return True
|
|
1899
1899
|
return False
|
|
1900
1900
|
|
|
1901
|
-
def load_file(self, filename, lineno=0
|
|
1901
|
+
def load_file(self, filename, lineno=0):
|
|
1902
1902
|
"""Load a file into an existing or new buffer.
|
|
1903
1903
|
"""
|
|
1904
1904
|
buf = self.find_buffer(filename) or self.create_new_buffer(filename)
|
|
@@ -1913,16 +1913,16 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1913
1913
|
return None
|
|
1914
1914
|
try:
|
|
1915
1915
|
self.Freeze()
|
|
1916
|
-
self.
|
|
1917
|
-
if
|
|
1916
|
+
org = self.buffer
|
|
1917
|
+
if buf._load_file(buf.filename, lineno):
|
|
1918
1918
|
buf.SetFocus()
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
self.post_message("Failed to load {!r}: {}".format(buf.name, e))
|
|
1922
|
-
pass
|
|
1919
|
+
return True
|
|
1920
|
+
return False
|
|
1923
1921
|
except Exception as e:
|
|
1924
1922
|
self.post_message("Failed to load {!r}: {}".format(buf.name, e))
|
|
1925
1923
|
self.remove_buffer(buf)
|
|
1924
|
+
self.swap_buffer(org)
|
|
1925
|
+
return False
|
|
1926
1926
|
finally:
|
|
1927
1927
|
self.Thaw()
|
|
1928
1928
|
|
|
@@ -1943,6 +1943,7 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1943
1943
|
return buf._save_file(filename)
|
|
1944
1944
|
except Exception as e:
|
|
1945
1945
|
self.post_message("Failed to save {!r}: {}".format(buf.name, e))
|
|
1946
|
+
return False
|
|
1946
1947
|
|
|
1947
1948
|
def load_buffer(self):
|
|
1948
1949
|
"""Confirm the load with the dialog."""
|
|
@@ -1983,6 +1984,7 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
1983
1984
|
def save_all_buffers(self):
|
|
1984
1985
|
for buf in filter(self.need_buffer_save_p, self.all_buffers):
|
|
1985
1986
|
self.swap_buffer(buf)
|
|
1987
|
+
assert buf is self.buffer
|
|
1986
1988
|
self.save_buffer()
|
|
1987
1989
|
return True
|
|
1988
1990
|
|
|
@@ -2015,7 +2017,7 @@ class EditorBook(aui.AuiNotebook, CtrlInterface):
|
|
|
2015
2017
|
|
|
2016
2018
|
def kill_all_buffers(self):
|
|
2017
2019
|
for buf in filter(self.need_buffer_save_p, self.all_buffers):
|
|
2018
|
-
|
|
2020
|
+
buf.SetFocus()
|
|
2019
2021
|
if wx.MessageBox(
|
|
2020
2022
|
"You are closing unsaved content.\n\n"
|
|
2021
2023
|
"Changes to the content will be discarded.\n"
|
|
@@ -2698,8 +2700,8 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2698
2700
|
|
|
2699
2701
|
- quoteback : x`y --> y=x
|
|
2700
2702
|
- pullback : x@y --> y(x)
|
|
2701
|
-
- partial : x@(y1
|
|
2702
|
-
- apropos : x.y?p --> apropos(x,y
|
|
2703
|
+
- partial : x@(y1,,,yn) --> partial(y1,,,yn)(x)
|
|
2704
|
+
- apropos : x.y?p --> apropos(x,y,,,p)
|
|
2703
2705
|
|
|
2704
2706
|
Note:
|
|
2705
2707
|
This is called before run, execute, and original magic.
|
|
@@ -2725,22 +2727,26 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2725
2727
|
pass
|
|
2726
2728
|
|
|
2727
2729
|
elif c == '@':
|
|
2728
|
-
f = "{rhs}({lhs})"
|
|
2729
2730
|
lhs = lhs.strip() or '_'
|
|
2730
2731
|
rhs = _eats(rest, sep2).strip()
|
|
2732
|
+
|
|
2731
2733
|
if rhs in ("debug", "profile", "timeit"):
|
|
2732
2734
|
## func(a,b,c) @debug --> func,a,b,c @debug
|
|
2733
|
-
lhs = re.sub(r"([\w
|
|
2734
|
-
|
|
2735
|
+
lhs = re.sub(r"(.*[\w\)\]])\s*\((.*)\)$",
|
|
2736
|
+
r"\1, \2", lhs, flags=re.S)
|
|
2737
|
+
## obj[...] @debug --> obj.__getitem__, (...) @debug
|
|
2738
|
+
lhs = re.sub(r"(.*[\w\)\]])\s*\[(.*)\]$",
|
|
2739
|
+
r"\1.__getitem__, (\2)", lhs, flags=re.S)
|
|
2740
|
+
elif rhs.startswith('('):
|
|
2735
2741
|
## @(y1,,,yn) --> partial(y1,,,yn)
|
|
2736
2742
|
rhs = re.sub(r"^\((.*)\)", r"partial(\1)", rhs, flags=re.S)
|
|
2737
|
-
|
|
2743
|
+
|
|
2744
|
+
return self.magic_interpret([f"{rhs}({lhs})"] + rest)
|
|
2738
2745
|
|
|
2739
2746
|
if c == '`':
|
|
2740
|
-
f = "{rhs} = {lhs}"
|
|
2741
2747
|
lhs = lhs.strip() or '_'
|
|
2742
2748
|
rhs = _eats(rest, sep1).strip()
|
|
2743
|
-
return self.magic_interpret([f
|
|
2749
|
+
return self.magic_interpret([f"{rhs} = {lhs}"] + rest)
|
|
2744
2750
|
|
|
2745
2751
|
if c == '?':
|
|
2746
2752
|
head, sep, hint = lhs.rpartition('.')
|
mwx/wxpdb.py
CHANGED
|
@@ -235,6 +235,8 @@ class Debugger(Pdb):
|
|
|
235
235
|
self.handler('abort')
|
|
236
236
|
|
|
237
237
|
def debug(self, obj, *args, **kwargs):
|
|
238
|
+
"""Debug a callable object.
|
|
239
|
+
"""
|
|
238
240
|
if not callable(obj):
|
|
239
241
|
wx.MessageBox("Not a callable object.\n\n"
|
|
240
242
|
"Unable to debug {!r}.".format(obj))
|
|
@@ -258,6 +260,31 @@ class Debugger(Pdb):
|
|
|
258
260
|
self.set_quit()
|
|
259
261
|
return
|
|
260
262
|
|
|
263
|
+
def run(self, cmd):
|
|
264
|
+
"""Debug a statement executed via the exec() function.
|
|
265
|
+
"""
|
|
266
|
+
if self.busy:
|
|
267
|
+
wx.MessageBox("Debugger is running.\n\n"
|
|
268
|
+
"Enter [q]uit to exit debug mode.")
|
|
269
|
+
return
|
|
270
|
+
self.unwatch()
|
|
271
|
+
globals = self.interactive_shell.globals
|
|
272
|
+
locals = self.interactive_shell.locals
|
|
273
|
+
if isinstance(cmd, str):
|
|
274
|
+
cmd = compile(cmd, "<string>", "exec")
|
|
275
|
+
try:
|
|
276
|
+
frame = inspect.currentframe().f_back
|
|
277
|
+
self.set_trace(frame)
|
|
278
|
+
exec(cmd, globals, locals)
|
|
279
|
+
except BdbQuit:
|
|
280
|
+
pass
|
|
281
|
+
except Exception as e:
|
|
282
|
+
## Note: CallAfter to avoid crashing by a kill-focus event.
|
|
283
|
+
wx.CallAfter(wx.MessageBox,
|
|
284
|
+
"Debugger is closed.\n\n{}".format(e))
|
|
285
|
+
finally:
|
|
286
|
+
self.set_quit()
|
|
287
|
+
|
|
261
288
|
## --------------------------------
|
|
262
289
|
## Actions for handler
|
|
263
290
|
## --------------------------------
|
|
@@ -269,7 +296,10 @@ class Debugger(Pdb):
|
|
|
269
296
|
for editor in self.parent.get_pages(type(self.editor)):
|
|
270
297
|
buf = editor.find_buffer(f)
|
|
271
298
|
if buf:
|
|
272
|
-
|
|
299
|
+
wnd = wx.Window.FindFocus()
|
|
300
|
+
buf.SetFocus()
|
|
301
|
+
if wnd is self.interactive_shell:
|
|
302
|
+
wnd.SetFocus()
|
|
273
303
|
return editor
|
|
274
304
|
|
|
275
305
|
def on_debug_begin(self, frame):
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=CxhKHOhig62F8p6GvP5gii-VvQtSjp9yWJpHvC_Kans,2592
|
|
2
2
|
mwx/controls.py,sha256=d5ZRw21nXxV06QHV5Y9t85Lqm3pLZRoPS27YknC_H54,42455
|
|
3
|
-
mwx/framework.py,sha256=
|
|
4
|
-
mwx/graphman.py,sha256=
|
|
3
|
+
mwx/framework.py,sha256=3wkSURTcq751o30D5nq2OSHnM08Ng4uwUnANVzRVxs4,69327
|
|
4
|
+
mwx/graphman.py,sha256=2_0vEJB2hbIzeILufty6Dc_sCRg_3Abc0ZhXrfCkuo4,69226
|
|
5
5
|
mwx/images.py,sha256=9e8X7OpJ6Z3fF3ez17P_qk2D1NMO10-lN8TCtulAqT0,46248
|
|
6
6
|
mwx/matplot2.py,sha256=OnG33VYvNY9tPbTiUdhM1bibnMwx8Z91hq2Wv7az78s,36000
|
|
7
7
|
mwx/matplot2g.py,sha256=yfF4r6juclU1I1k41lGb_VwxRmp0ktuD8az-wQ26MsE,67727
|
|
8
8
|
mwx/matplot2lg.py,sha256=Dnz_U7K_QkPmsJd18WzZ6PkaTOtWu_IwOgkfEdJv4d0,27606
|
|
9
9
|
mwx/mgplt.py,sha256=49_wpFZUEKErQmtobqrlNKDjWlAsdLft-izlqSyGPD0,6878
|
|
10
|
-
mwx/nutshell.py,sha256=
|
|
10
|
+
mwx/nutshell.py,sha256=qhgrxO6UpOgxODtG1nppbrZWNFsd9Mg4Y6a0EWl5Xas,133784
|
|
11
11
|
mwx/utilus.py,sha256=3VaUX_hclVLYixOyDC-4gxxug9_4kMzCTQcDuHs3REA,34863
|
|
12
12
|
mwx/wxmon.py,sha256=Odmh13Ek4oJo9V5uFCTemoWlsPyZt4ITTmYZiKl_BKI,11405
|
|
13
|
-
mwx/wxpdb.py,sha256
|
|
13
|
+
mwx/wxpdb.py,sha256=-_rDNxk3S3z1PgDZ6AAhKksFp8wJL3NBKDxfOZ74E3c,19790
|
|
14
14
|
mwx/wxwil.py,sha256=BUfEF0Nc1E-mVC3Vdz6k1E-2s5J0PO6qEzRQ6lfyePI,5246
|
|
15
15
|
mwx/wxwit.py,sha256=M_jRGJOZge2B4Cq1OsAHqnGjeg56UI-v1BolDybPR-o,7246
|
|
16
16
|
mwx/py/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
mwx/py/filling.py,sha256=NnQnfUVol-Nz4QYZUKFIyRX-Yxp54m5n54Yxza3Iwho,16655
|
|
18
|
-
mwxlib-0.80.
|
|
19
|
-
mwxlib-0.80.
|
|
20
|
-
mwxlib-0.80.
|
|
21
|
-
mwxlib-0.80.
|
|
22
|
-
mwxlib-0.80.
|
|
18
|
+
mwxlib-0.80.2.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
19
|
+
mwxlib-0.80.2.dist-info/METADATA,sha256=TEZNsDZwMDlNd_kSeAUCSHbNdKm0rY_kVAP8kW9dghM,1995
|
|
20
|
+
mwxlib-0.80.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
21
|
+
mwxlib-0.80.2.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
22
|
+
mwxlib-0.80.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|