mwxlib 1.2.9__py3-none-any.whl → 1.3.3__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 -15
- mwx/controls.py +1 -0
- mwx/framework.py +78 -65
- mwx/graphman.py +9 -8
- mwx/matplot2g.py +6 -2
- mwx/nutshell.py +46 -40
- mwx/testsuite.py +1 -1
- mwx/wxpdb.py +1 -1
- {mwxlib-1.2.9.dist-info → mwxlib-1.3.3.dist-info}/METADATA +1 -1
- {mwxlib-1.2.9.dist-info → mwxlib-1.3.3.dist-info}/RECORD +13 -13
- {mwxlib-1.2.9.dist-info → mwxlib-1.3.3.dist-info}/LICENSE +0 -0
- {mwxlib-1.2.9.dist-info → mwxlib-1.3.3.dist-info}/WHEEL +0 -0
- {mwxlib-1.2.9.dist-info → mwxlib-1.3.3.dist-info}/top_level.txt +0 -0
mwx/bookshelf.py
CHANGED
|
@@ -13,9 +13,11 @@ class MyDropTarget(wx.DropTarget):
|
|
|
13
13
|
|
|
14
14
|
self.tree = tree
|
|
15
15
|
self.datado = wx.CustomDataObject("TreeItem")
|
|
16
|
+
self.textdo = wx.TextDataObject()
|
|
16
17
|
self.filedo = wx.FileDataObject()
|
|
17
18
|
self.do = wx.DataObjectComposite()
|
|
18
19
|
self.do.Add(self.datado)
|
|
20
|
+
self.do.Add(self.textdo)
|
|
19
21
|
self.do.Add(self.filedo)
|
|
20
22
|
self.SetDataObject(self.do)
|
|
21
23
|
|
|
@@ -31,20 +33,22 @@ class MyDropTarget(wx.DropTarget):
|
|
|
31
33
|
def OnData(self, x, y, result):
|
|
32
34
|
item = self.tree.Selection
|
|
33
35
|
name = self.tree.GetItemText(item)
|
|
34
|
-
editor = self.tree.Parent.FindWindow(name) # window.Name
|
|
35
|
-
def _load(f):
|
|
36
|
-
if editor.load_file(f):
|
|
37
|
-
editor.buffer.SetFocus()
|
|
38
|
-
editor.message(f"Loaded {f!r} successfully.")
|
|
36
|
+
editor = self.tree.Parent.FindWindow(name) # window.Name
|
|
39
37
|
self.GetData()
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_load(f)
|
|
38
|
+
if self.datado.Data:
|
|
39
|
+
fn = self.datado.Data.tobytes().decode()
|
|
40
|
+
editor.load_file(fn)
|
|
44
41
|
self.datado.SetData(b"")
|
|
42
|
+
elif self.textdo.Text:
|
|
43
|
+
fn = self.textdo.Text.strip()
|
|
44
|
+
res = editor.parent.handler("text_dropped", fn)
|
|
45
|
+
if res is None or not any(res):
|
|
46
|
+
editor.load_file(fn)
|
|
47
|
+
result = wx.DragCopy
|
|
48
|
+
self.textdo.SetText("")
|
|
45
49
|
else:
|
|
46
|
-
for
|
|
47
|
-
|
|
50
|
+
for fn in self.filedo.Filenames:
|
|
51
|
+
editor.load_file(fn)
|
|
48
52
|
self.filedo.SetData(wx.DF_FILENAME, None)
|
|
49
53
|
return result
|
|
50
54
|
|
|
@@ -99,14 +103,14 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
99
103
|
}
|
|
100
104
|
def _attach():
|
|
101
105
|
if self and self.parent:
|
|
102
|
-
for editor in self.parent.
|
|
106
|
+
for editor in self.parent.get_all_editors():
|
|
103
107
|
editor.handler.append(self.context)
|
|
104
108
|
self.build_tree()
|
|
105
109
|
wx.CallAfter(_attach)
|
|
106
110
|
|
|
107
111
|
def OnDestroy(self, evt):
|
|
108
112
|
if self and self.parent:
|
|
109
|
-
for editor in self.parent.
|
|
113
|
+
for editor in self.parent.get_all_editors():
|
|
110
114
|
editor.handler.remove(self.context)
|
|
111
115
|
evt.Skip()
|
|
112
116
|
|
|
@@ -129,8 +133,8 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
129
133
|
if clear:
|
|
130
134
|
self.DeleteAllItems()
|
|
131
135
|
self.AddRoot(self.Name)
|
|
132
|
-
for editor in self.parent.
|
|
133
|
-
self._set_item(self.RootItem, editor.Name, editor.
|
|
136
|
+
for editor in self.parent.get_all_editors():
|
|
137
|
+
self._set_item(self.RootItem, editor.Name, editor.get_all_buffers())
|
|
134
138
|
self.Refresh()
|
|
135
139
|
|
|
136
140
|
def _gen_items(self, root, key=None):
|
mwx/controls.py
CHANGED
mwx/framework.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#! python3
|
|
2
2
|
"""mwxlib framework.
|
|
3
3
|
"""
|
|
4
|
-
__version__ = "1.
|
|
4
|
+
__version__ = "1.3.3"
|
|
5
5
|
__author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
|
|
6
6
|
|
|
7
7
|
from contextlib import contextmanager
|
|
@@ -872,18 +872,18 @@ class AuiNotebook(aui.AuiNotebook):
|
|
|
872
872
|
self.Bind(aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN, tab_menu)
|
|
873
873
|
|
|
874
874
|
@property
|
|
875
|
-
def all_pages(self):
|
|
876
|
-
"""Returns all window pages."""
|
|
875
|
+
def all_pages(self): # (deprecated) internal use only
|
|
876
|
+
"""Returns all window pages (internal use only)."""
|
|
877
877
|
return [self.GetPage(i) for i in range(self.PageCount)]
|
|
878
878
|
|
|
879
879
|
@property
|
|
880
|
-
def all_tabs(self):
|
|
881
|
-
"""Returns all AuiTabCtrl objects."""
|
|
880
|
+
def all_tabs(self): # (deprecated) internal use only
|
|
881
|
+
"""Returns all AuiTabCtrl objects (internal use only)."""
|
|
882
882
|
return [x for x in self.Children if isinstance(x, aui.AuiTabCtrl)]
|
|
883
883
|
|
|
884
884
|
@property
|
|
885
|
-
def all_panes(self):
|
|
886
|
-
"""Returns all AuiPaneInfo excluding `dummy` one."""
|
|
885
|
+
def all_panes(self): # (deprecated) internal use only
|
|
886
|
+
"""Returns all AuiPaneInfo excluding `dummy` one (internal use only)."""
|
|
887
887
|
return list(self._mgr.AllPanes)[1:]
|
|
888
888
|
|
|
889
889
|
def get_pages(self, type=None):
|
|
@@ -1033,30 +1033,24 @@ class FileDropLoader(wx.DropTarget):
|
|
|
1033
1033
|
index, flags = self.target.HitTest((x, y))
|
|
1034
1034
|
if index != -1:
|
|
1035
1035
|
self.target.Selection = index
|
|
1036
|
+
result = wx.DragCopy
|
|
1037
|
+
else:
|
|
1038
|
+
result = wx.DragNone
|
|
1036
1039
|
return result
|
|
1037
1040
|
|
|
1038
1041
|
def OnData(self, x, y, result):
|
|
1039
1042
|
editor = self.target.Parent.current_editor
|
|
1040
1043
|
self.GetData()
|
|
1041
|
-
if self.textdo.
|
|
1042
|
-
|
|
1043
|
-
res = editor.
|
|
1044
|
-
if res:
|
|
1045
|
-
editor.
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
elif res is None:
|
|
1049
|
-
editor.message(f"Loading {f!r} canceled.")
|
|
1050
|
-
result = wx.DragCancel
|
|
1051
|
-
else:
|
|
1052
|
-
editor.message(f"Loading {f!r} failed.")
|
|
1053
|
-
result = wx.DragNone
|
|
1054
|
-
self.textdo.SetText('')
|
|
1044
|
+
if self.textdo.Text:
|
|
1045
|
+
fn = self.textdo.Text.strip()
|
|
1046
|
+
res = editor.parent.handler("text_dropped", fn)
|
|
1047
|
+
if res is None or not any(res):
|
|
1048
|
+
editor.load_file(fn)
|
|
1049
|
+
result = wx.DragCopy
|
|
1050
|
+
self.textdo.SetText("")
|
|
1055
1051
|
else:
|
|
1056
|
-
for
|
|
1057
|
-
|
|
1058
|
-
editor.buffer.SetFocus()
|
|
1059
|
-
editor.message(f"Loaded {f!r} successfully.")
|
|
1052
|
+
for fn in self.filedo.Filenames:
|
|
1053
|
+
editor.load_file(fn)
|
|
1060
1054
|
self.filedo.SetData(wx.DF_FILENAME, None)
|
|
1061
1055
|
return result
|
|
1062
1056
|
|
|
@@ -1337,8 +1331,8 @@ class ShellFrame(MiniFrame):
|
|
|
1337
1331
|
o.write("self.SetSize({})\n".format(self.Size))
|
|
1338
1332
|
o.write("self.SetPosition({})\n".format(self.Position))
|
|
1339
1333
|
|
|
1340
|
-
for book in self.
|
|
1341
|
-
for buf in book.
|
|
1334
|
+
for book in self.get_all_editors():
|
|
1335
|
+
for buf in book.get_all_buffers():
|
|
1342
1336
|
if buf.mtdelta is not None:
|
|
1343
1337
|
o.write("self.{}.load_file({!r}, {})\n"
|
|
1344
1338
|
.format(book.Name, buf.filename, buf.markline+1))
|
|
@@ -1446,8 +1440,8 @@ class ShellFrame(MiniFrame):
|
|
|
1446
1440
|
"The trace pointer will be cleared.")
|
|
1447
1441
|
self.debugger.unwatch() # cf. [pointer_unset] stop_trace
|
|
1448
1442
|
|
|
1449
|
-
for book in self.
|
|
1450
|
-
for buf in book.
|
|
1443
|
+
for book in self.get_all_editors():
|
|
1444
|
+
for buf in book.get_all_buffers():
|
|
1451
1445
|
if buf.need_buffer_save:
|
|
1452
1446
|
self.popup_window(book)
|
|
1453
1447
|
buf.SetFocus()
|
|
@@ -1473,8 +1467,8 @@ class ShellFrame(MiniFrame):
|
|
|
1473
1467
|
elif evt.GetActivationReason() == evt.Reason_Mouse\
|
|
1474
1468
|
and self.__autoload:
|
|
1475
1469
|
## Check all buffers that need to be loaded.
|
|
1476
|
-
for book in self.
|
|
1477
|
-
for buf in book.
|
|
1470
|
+
for book in self.get_all_editors():
|
|
1471
|
+
for buf in book.get_all_buffers():
|
|
1478
1472
|
if buf.need_buffer_load:
|
|
1479
1473
|
if wx.MessageBox( # Confirm load.
|
|
1480
1474
|
"The file has been modified externally.\n\n"
|
|
@@ -1535,7 +1529,7 @@ class ShellFrame(MiniFrame):
|
|
|
1535
1529
|
|
|
1536
1530
|
def OnConsolePageClose(self, evt): #<wx._aui.AuiNotebookEvent>
|
|
1537
1531
|
nb = evt.EventObject
|
|
1538
|
-
win = nb.
|
|
1532
|
+
win = list(nb.get_pages())[evt.Selection]
|
|
1539
1533
|
if win is self.rootshell:
|
|
1540
1534
|
## self.message("Don't close the root shell.")
|
|
1541
1535
|
nb.WindowStyle &= ~aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
|
|
@@ -1550,22 +1544,20 @@ class ShellFrame(MiniFrame):
|
|
|
1550
1544
|
def About(self, evt=None):
|
|
1551
1545
|
self.add_help(
|
|
1552
1546
|
'\n\n'.join((
|
|
1553
|
-
"#<module 'mwx' from {!r}>"
|
|
1554
|
-
"Author: {!r}"
|
|
1555
|
-
"Version: {!s}"
|
|
1547
|
+
f"#<module 'mwx' from {__file__!r}>",
|
|
1548
|
+
f"Author: {__author__!r}",
|
|
1549
|
+
f"Version: {__version__!s}",
|
|
1556
1550
|
self.__class__.__doc__,
|
|
1557
1551
|
self.rootshell.__class__.__doc__,
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
"
|
|
1561
|
-
"
|
|
1562
|
-
"Version: {!s}".format(wx.py.version.VERSION),
|
|
1552
|
+
## --- Thanks to <wx.py.shell> ---
|
|
1553
|
+
f"#{wx.py!r}",
|
|
1554
|
+
f"Author: {wx.py.version.__author__!r}",
|
|
1555
|
+
f"Version: {wx.py.version.VERSION!s}",
|
|
1563
1556
|
wx.py.shell.Shell.__doc__,
|
|
1564
1557
|
textwrap.indent("*original" + wx.py.shell.HELP_TEXT, ' '*4),
|
|
1565
|
-
|
|
1566
|
-
##
|
|
1567
|
-
"#
|
|
1568
|
-
"To show the credit, press C-M-Mbutton.\n",
|
|
1558
|
+
## --- Thanks are also due to <wx> ---
|
|
1559
|
+
## f"#{wx!r}".format(wx),
|
|
1560
|
+
## f"To show the credit, press [C-M-Mbutton].", # cf. wx.InfoMessageBox(None)
|
|
1569
1561
|
))
|
|
1570
1562
|
)
|
|
1571
1563
|
|
|
@@ -1846,7 +1838,7 @@ class ShellFrame(MiniFrame):
|
|
|
1846
1838
|
|
|
1847
1839
|
def add_log(self, text, noerr=None):
|
|
1848
1840
|
"""Add text to the logging buffer.
|
|
1849
|
-
If noerr
|
|
1841
|
+
If noerr:bool is specified, add a line-marker.
|
|
1850
1842
|
"""
|
|
1851
1843
|
buf = self.Log.default_buffer or self.Log.new_buffer()
|
|
1852
1844
|
with buf.off_readonly():
|
|
@@ -1861,11 +1853,18 @@ class ShellFrame(MiniFrame):
|
|
|
1861
1853
|
## with open(self.LOGGING_FILE, 'a', encoding='utf-8', newline='') as o:
|
|
1862
1854
|
## o.write(text)
|
|
1863
1855
|
|
|
1864
|
-
def add_help(self, text):
|
|
1865
|
-
"""Add text to the help buffer.
|
|
1856
|
+
def add_help(self, text, title=None):
|
|
1857
|
+
"""Add text to the help buffer.
|
|
1858
|
+
If title:str is specified, create a new buffer with that title.
|
|
1859
|
+
"""
|
|
1866
1860
|
buf = self.Help.default_buffer or self.Help.new_buffer()
|
|
1861
|
+
if title is not None:
|
|
1862
|
+
self.Help.find_file(f"*{title}*")
|
|
1863
|
+
buf = self.Help.buffer
|
|
1867
1864
|
with buf.off_readonly():
|
|
1868
|
-
buf.
|
|
1865
|
+
buf.Text = text
|
|
1866
|
+
buf.EmptyUndoBuffer()
|
|
1867
|
+
buf.SetSavePoint()
|
|
1869
1868
|
## Overwrite text and popup the window.
|
|
1870
1869
|
self.popup_window(self.Help)
|
|
1871
1870
|
self.Help.swap_page(buf)
|
|
@@ -1874,12 +1873,14 @@ class ShellFrame(MiniFrame):
|
|
|
1874
1873
|
if not hasattr(target, '__dict__'):
|
|
1875
1874
|
raise TypeError("primitive objects cannot be targeted")
|
|
1876
1875
|
|
|
1877
|
-
shell = self.
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1876
|
+
shell = self.find_shell(target)
|
|
1877
|
+
if not shell:
|
|
1878
|
+
shell = self.rootshell.__class__(self, target, name="clone",
|
|
1879
|
+
style=wx.CLIP_CHILDREN|wx.BORDER_NONE)
|
|
1880
|
+
self.console.AddPage(shell, typename(shell.target))
|
|
1881
|
+
self.handler('shell_new', shell)
|
|
1882
1882
|
self.popup_window(shell)
|
|
1883
|
+
self.Show()
|
|
1883
1884
|
shell.SetFocus()
|
|
1884
1885
|
return shell
|
|
1885
1886
|
|
|
@@ -1905,8 +1906,16 @@ class ShellFrame(MiniFrame):
|
|
|
1905
1906
|
yield from self.console.get_pages(type)
|
|
1906
1907
|
yield from self.ghost.get_pages(type)
|
|
1907
1908
|
|
|
1909
|
+
def get_all_shells(self):
|
|
1910
|
+
"""Yields all shells in the notebooks."""
|
|
1911
|
+
yield from self.console.get_pages(type(self.rootshell))
|
|
1912
|
+
|
|
1913
|
+
def get_all_editors(self):
|
|
1914
|
+
"""Yields all editors in the notebooks."""
|
|
1915
|
+
yield from self.ghost.get_pages(type(self.Log))
|
|
1916
|
+
|
|
1908
1917
|
@property
|
|
1909
|
-
def all_shells(self):
|
|
1918
|
+
def all_shells(self): # (deprecated) for backward compatibility
|
|
1910
1919
|
"""Yields all books in the notebooks."""
|
|
1911
1920
|
return self.console.get_pages(type(self.rootshell))
|
|
1912
1921
|
|
|
@@ -1915,8 +1924,17 @@ class ShellFrame(MiniFrame):
|
|
|
1915
1924
|
"""Currently selected shell or rootshell."""
|
|
1916
1925
|
return self.console.CurrentPage
|
|
1917
1926
|
|
|
1927
|
+
def find_shell(self, target):
|
|
1928
|
+
"""Find a shell targeting the specified object.
|
|
1929
|
+
If found, switch to the corresponding page.
|
|
1930
|
+
"""
|
|
1931
|
+
for shell in self.get_all_shells():
|
|
1932
|
+
if shell.target is target:
|
|
1933
|
+
self.console.swap_page(shell)
|
|
1934
|
+
return shell
|
|
1935
|
+
|
|
1918
1936
|
@property
|
|
1919
|
-
def all_editors(self):
|
|
1937
|
+
def all_editors(self): # (deprecated) for backward compatibility
|
|
1920
1938
|
"""Yields all editors in the notebooks."""
|
|
1921
1939
|
return self.ghost.get_pages(type(self.Log))
|
|
1922
1940
|
|
|
@@ -1926,22 +1944,17 @@ class ShellFrame(MiniFrame):
|
|
|
1926
1944
|
editor = self.ghost.CurrentPage
|
|
1927
1945
|
if isinstance(editor, type(self.Log)):
|
|
1928
1946
|
return editor
|
|
1929
|
-
return next((x for x in self.
|
|
1947
|
+
return next((x for x in self.get_all_editors() if x.IsShown()), self.Scratch)
|
|
1930
1948
|
|
|
1931
1949
|
def find_editor(self, fn):
|
|
1932
|
-
"""Find an editor
|
|
1933
|
-
If found, switch to the
|
|
1950
|
+
"""Find an editor containing the specified fn:filename or code.
|
|
1951
|
+
If found, switch to the corresponding page.
|
|
1934
1952
|
"""
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
def find_editors(self, fn):
|
|
1938
|
-
"""Yields all editors with the specified fn:filename or code."""
|
|
1939
|
-
def _f(book):
|
|
1953
|
+
for book in self.get_all_editors():
|
|
1940
1954
|
buf = book.find_buffer(fn)
|
|
1941
1955
|
if buf:
|
|
1942
1956
|
book.swap_page(buf)
|
|
1943
|
-
|
|
1944
|
-
return filter(_f, self.all_editors)
|
|
1957
|
+
return book
|
|
1945
1958
|
|
|
1946
1959
|
## --------------------------------
|
|
1947
1960
|
## Find text dialog
|
mwx/graphman.py
CHANGED
|
@@ -887,7 +887,7 @@ class Frame(mwx.Frame):
|
|
|
887
887
|
return
|
|
888
888
|
self.Quit()
|
|
889
889
|
break
|
|
890
|
-
for frame in self.graph.
|
|
890
|
+
for frame in self.graph.get_all_frames():
|
|
891
891
|
if frame.pathname is None:
|
|
892
892
|
if wx.MessageBox( # Confirm close.
|
|
893
893
|
"You are closing unsaved frame.\n\n"
|
|
@@ -970,7 +970,7 @@ class Frame(mwx.Frame):
|
|
|
970
970
|
win.handler('page_shown', win)
|
|
971
971
|
elif not show and shown:
|
|
972
972
|
if isinstance(win, aui.AuiNotebook):
|
|
973
|
-
for plug in win.
|
|
973
|
+
for plug in win.get_pages():
|
|
974
974
|
plug.handler('page_closed', plug)
|
|
975
975
|
else:
|
|
976
976
|
win.handler('page_closed', win)
|
|
@@ -1016,7 +1016,7 @@ class Frame(mwx.Frame):
|
|
|
1016
1016
|
pane = evt.GetPane()
|
|
1017
1017
|
win = pane.window
|
|
1018
1018
|
if isinstance(win, aui.AuiNotebook):
|
|
1019
|
-
for plug in win.
|
|
1019
|
+
for plug in win.get_pages():
|
|
1020
1020
|
plug.handler('page_closed', plug)
|
|
1021
1021
|
else:
|
|
1022
1022
|
win.handler('page_closed', win)
|
|
@@ -1103,6 +1103,7 @@ class Frame(mwx.Frame):
|
|
|
1103
1103
|
else:
|
|
1104
1104
|
module = import_module(name)
|
|
1105
1105
|
except Exception as e:
|
|
1106
|
+
traceback.print_exc()
|
|
1106
1107
|
print(f"- Unable to load {root!r}.", e)
|
|
1107
1108
|
return False
|
|
1108
1109
|
|
|
@@ -1328,7 +1329,7 @@ class Frame(mwx.Frame):
|
|
|
1328
1329
|
self.load_plug(plug.__module__, force=1, session=session)
|
|
1329
1330
|
|
|
1330
1331
|
## Update shell.target --> new plug
|
|
1331
|
-
for shell in self.shellframe.
|
|
1332
|
+
for shell in self.shellframe.get_all_shells():
|
|
1332
1333
|
if shell.target is plug:
|
|
1333
1334
|
shell.handler('shell_activated', shell)
|
|
1334
1335
|
|
|
@@ -1425,7 +1426,7 @@ class Frame(mwx.Frame):
|
|
|
1425
1426
|
"""
|
|
1426
1427
|
view = self.selected_view
|
|
1427
1428
|
if not frames:
|
|
1428
|
-
frames = view.
|
|
1429
|
+
frames = view.get_all_frames()
|
|
1429
1430
|
if not frames:
|
|
1430
1431
|
return None
|
|
1431
1432
|
|
|
@@ -1492,7 +1493,7 @@ class Frame(mwx.Frame):
|
|
|
1492
1493
|
else:
|
|
1493
1494
|
fn = attr.get('pathname') # if not found, try pathname
|
|
1494
1495
|
if fn.startswith(r'\\'):
|
|
1495
|
-
warn(f"The
|
|
1496
|
+
warn(f"The pathname of {fn!r} contains network path, "
|
|
1496
1497
|
f"so the search may take long time.", stacklevel=3)
|
|
1497
1498
|
if not os.path.exists(fn):
|
|
1498
1499
|
mis[name] = res.pop(name) # pop missing items
|
|
@@ -1691,7 +1692,7 @@ class Frame(mwx.Frame):
|
|
|
1691
1692
|
def save_buffers_as_tiffs(self, path=None, frames=None):
|
|
1692
1693
|
"""Save buffers to a file as a multi-page tiff."""
|
|
1693
1694
|
if not frames:
|
|
1694
|
-
frames = self.selected_view.
|
|
1695
|
+
frames = self.selected_view.get_all_frames()
|
|
1695
1696
|
if not frames:
|
|
1696
1697
|
return None
|
|
1697
1698
|
|
|
@@ -1810,7 +1811,7 @@ class Frame(mwx.Frame):
|
|
|
1810
1811
|
|
|
1811
1812
|
def _save(view):
|
|
1812
1813
|
name = view.Name
|
|
1813
|
-
paths = [x.pathname for x in view.
|
|
1814
|
+
paths = [x.pathname for x in view.get_all_frames() if x.pathname]
|
|
1814
1815
|
o.write(f"self.{name}.unit = {view.unit:g}\n")
|
|
1815
1816
|
o.write(f"self.load_frame({paths!r}, self.{name})\n")
|
|
1816
1817
|
try:
|
mwx/matplot2g.py
CHANGED
|
@@ -772,6 +772,10 @@ class GraphPlot(MatplotPanel):
|
|
|
772
772
|
return next((art for art in self.__Arts if art.name == j), None)
|
|
773
773
|
return self.__Arts[j]
|
|
774
774
|
|
|
775
|
+
def get_all_frames(self):
|
|
776
|
+
"""List of arts <matplotlib.image.AxesImage>."""
|
|
777
|
+
return self.__Arts
|
|
778
|
+
|
|
775
779
|
## --------------------------------
|
|
776
780
|
## Property of frame / drawer
|
|
777
781
|
## --------------------------------
|
|
@@ -780,10 +784,10 @@ class GraphPlot(MatplotPanel):
|
|
|
780
784
|
nbytes_threshold = 24e6
|
|
781
785
|
|
|
782
786
|
#: image cutoff score percentiles
|
|
783
|
-
score_percentile = 0.
|
|
787
|
+
score_percentile = 0.005
|
|
784
788
|
|
|
785
789
|
@property
|
|
786
|
-
def all_frames(self):
|
|
790
|
+
def all_frames(self): # (deprecated) for backward compatibility
|
|
787
791
|
"""List of arts <matplotlib.image.AxesImage>."""
|
|
788
792
|
return self.__Arts
|
|
789
793
|
|
mwx/nutshell.py
CHANGED
|
@@ -27,14 +27,14 @@ from wx.py.shell import Shell
|
|
|
27
27
|
from wx.py.editwindow import EditWindow
|
|
28
28
|
|
|
29
29
|
from .utilus import funcall as _F
|
|
30
|
-
from .utilus import ignore
|
|
30
|
+
from .utilus import ignore, typename
|
|
31
31
|
from .utilus import split_words, split_paren, split_tokens, find_modules
|
|
32
32
|
from .framework import CtrlInterface, AuiNotebook, Menu
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
## URL pattern (flag = re.M | re.A)
|
|
36
36
|
## url_re = r"https?://[\w/:%#$&?()~.=+-]+"
|
|
37
|
-
url_re = r"https?://[\w
|
|
37
|
+
url_re = r"https?://[\w/:%#$&?!@~.,;=+-]+" # excluding ()
|
|
38
38
|
|
|
39
39
|
## no-file pattern
|
|
40
40
|
nofile_re = r'[\/:*?"<>|]'
|
|
@@ -629,7 +629,7 @@ class EditorInterface(AutoCompInterfaceMixin, CtrlInterface):
|
|
|
629
629
|
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_VLINE, *v)
|
|
630
630
|
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_VLINE, *v)
|
|
631
631
|
|
|
632
|
-
## Custom indicators ([BUG] indicator=1 is reset when the buffer is
|
|
632
|
+
## Custom indicators ([BUG] indicator=1 is reset when the buffer is updated.)
|
|
633
633
|
## [10-11] filter_text
|
|
634
634
|
## [2] URL
|
|
635
635
|
## [3] match_paren
|
|
@@ -2022,12 +2022,11 @@ class Buffer(EditorInterface, EditWindow):
|
|
|
2022
2022
|
## File I/O
|
|
2023
2023
|
## --------------------------------
|
|
2024
2024
|
|
|
2025
|
-
def _load_textfile(self, text
|
|
2025
|
+
def _load_textfile(self, text):
|
|
2026
2026
|
with self.off_readonly():
|
|
2027
2027
|
self.Text = text
|
|
2028
2028
|
self.EmptyUndoBuffer()
|
|
2029
2029
|
self.SetSavePoint()
|
|
2030
|
-
self.update_filestamp(filename)
|
|
2031
2030
|
self.handler('buffer_loaded', self)
|
|
2032
2031
|
|
|
2033
2032
|
def _load_file(self, filename):
|
|
@@ -2214,7 +2213,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2214
2213
|
|
|
2215
2214
|
def OnPageClose(self, evt): #<wx._aui.AuiNotebookEvent>
|
|
2216
2215
|
nb = evt.EventObject
|
|
2217
|
-
buf = nb.
|
|
2216
|
+
buf = list(nb.get_pages())[evt.Selection]
|
|
2218
2217
|
if buf.need_buffer_save:
|
|
2219
2218
|
if wx.MessageBox( # Confirm close.
|
|
2220
2219
|
"You are closing unsaved content.\n\n"
|
|
@@ -2258,7 +2257,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2258
2257
|
_setattribute(buf, kwargs)
|
|
2259
2258
|
else:
|
|
2260
2259
|
self.defaultBufferStyle.update(kwargs)
|
|
2261
|
-
for buf in self.
|
|
2260
|
+
for buf in self.get_all_buffers():
|
|
2262
2261
|
_setattribute(buf, self.defaultBufferStyle)
|
|
2263
2262
|
|
|
2264
2263
|
def on_activated(self, buf):
|
|
@@ -2275,12 +2274,24 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2275
2274
|
## --------------------------------
|
|
2276
2275
|
|
|
2277
2276
|
@property
|
|
2278
|
-
def all_buffers(self):
|
|
2279
|
-
"""Returns all
|
|
2280
|
-
cf. equiv. AuiNotebook.all_pages
|
|
2281
|
-
"""
|
|
2277
|
+
def all_buffers(self): # (deprecated) for backward compatibility
|
|
2278
|
+
"""Returns all buffers."""
|
|
2282
2279
|
return [self.GetPage(j) for j in range(self.PageCount)]
|
|
2283
2280
|
|
|
2281
|
+
def get_all_buffers(self, fn=None):
|
|
2282
|
+
"""Yields all buffers with specified fn:filename or code."""
|
|
2283
|
+
if fn is None:
|
|
2284
|
+
yield from self.get_pages(Buffer)
|
|
2285
|
+
elif isinstance(fn, str):
|
|
2286
|
+
g = os.path.realpath(fn)
|
|
2287
|
+
for buf in self.get_pages(Buffer):
|
|
2288
|
+
if fn == buf.filename or g == os.path.realpath(buf.filename):
|
|
2289
|
+
yield buf
|
|
2290
|
+
else:
|
|
2291
|
+
for buf in self.get_pages(Buffer):
|
|
2292
|
+
if fn is buf or fn in buf: # check code
|
|
2293
|
+
yield buf
|
|
2294
|
+
|
|
2284
2295
|
@property
|
|
2285
2296
|
def menu(self):
|
|
2286
2297
|
"""Yields context menu."""
|
|
@@ -2290,7 +2301,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2290
2301
|
lambda v: buf.SetFocus(),
|
|
2291
2302
|
lambda v: v.Check(buf is self.buffer))
|
|
2292
2303
|
|
|
2293
|
-
return (_menu(j+1, x) for j, x in enumerate(self.
|
|
2304
|
+
return (_menu(j+1, x) for j, x in enumerate(self.get_all_buffers()))
|
|
2294
2305
|
|
|
2295
2306
|
@property
|
|
2296
2307
|
def buffer(self):
|
|
@@ -2298,16 +2309,8 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2298
2309
|
return self.CurrentPage
|
|
2299
2310
|
|
|
2300
2311
|
def find_buffer(self, fn):
|
|
2301
|
-
"""Find buffer with specified fn:filename or code."""
|
|
2302
|
-
|
|
2303
|
-
g = os.path.realpath(fn)
|
|
2304
|
-
for buf in self.all_buffers:
|
|
2305
|
-
if fn == buf.filename or g == os.path.realpath(buf.filename):
|
|
2306
|
-
return buf
|
|
2307
|
-
else:
|
|
2308
|
-
for buf in self.all_buffers:
|
|
2309
|
-
if fn is buf or fn in buf: # check code
|
|
2310
|
-
return buf
|
|
2312
|
+
"""Find a buffer with specified fn:filename or code."""
|
|
2313
|
+
return next(self.get_all_buffers(fn), None)
|
|
2311
2314
|
|
|
2312
2315
|
def swap_buffer(self, buf, lineno=0):
|
|
2313
2316
|
self.swap_page(buf)
|
|
@@ -2385,7 +2388,8 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2385
2388
|
elif not buf.need_buffer_load:
|
|
2386
2389
|
self.swap_buffer(buf, lineno)
|
|
2387
2390
|
return True
|
|
2388
|
-
buf._load_textfile(''.join(lines)
|
|
2391
|
+
buf._load_textfile(''.join(lines))
|
|
2392
|
+
buf.update_filestamp(filename)
|
|
2389
2393
|
self.swap_buffer(buf, lineno)
|
|
2390
2394
|
return True
|
|
2391
2395
|
return False
|
|
@@ -2415,7 +2419,8 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2415
2419
|
kwargs.setdefault('timeout', 3.0)
|
|
2416
2420
|
res = requests.get(filename, **kwargs)
|
|
2417
2421
|
if res.status_code == requests.codes.OK:
|
|
2418
|
-
buf._load_textfile(res.text
|
|
2422
|
+
buf._load_textfile(res.text)
|
|
2423
|
+
buf.update_filestamp(filename)
|
|
2419
2424
|
self.swap_buffer(buf, lineno)
|
|
2420
2425
|
return True
|
|
2421
2426
|
res.raise_for_status() # raise HTTP error; don't catch here.
|
|
@@ -2436,13 +2441,14 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2436
2441
|
wildcard='|'.join(self.wildcards),
|
|
2437
2442
|
style=wx.FD_OPEN|wx.FD_MULTIPLE) as dlg:
|
|
2438
2443
|
if dlg.ShowModal() == wx.ID_OK:
|
|
2439
|
-
for fn in dlg.Paths
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
if
|
|
2444
|
+
return all([self.find_file(fn) for fn in dlg.Paths])
|
|
2445
|
+
return None
|
|
2446
|
+
retval = self.load_file(filename)
|
|
2447
|
+
if retval == False: # noqa: not None
|
|
2443
2448
|
buf = self.create_buffer(filename)
|
|
2444
2449
|
self.swap_buffer(buf)
|
|
2445
2450
|
self.post_message("New file.")
|
|
2451
|
+
return retval
|
|
2446
2452
|
|
|
2447
2453
|
def save_file(self, filename, buf=None, verbose=True):
|
|
2448
2454
|
"""Save the current buffer to a file.
|
|
@@ -2506,7 +2512,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2506
2512
|
return self.save_file(dlg.Path, buf)
|
|
2507
2513
|
|
|
2508
2514
|
def save_all_buffers(self):
|
|
2509
|
-
for buf in self.
|
|
2515
|
+
for buf in self.get_all_buffers():
|
|
2510
2516
|
if buf.need_buffer_save:
|
|
2511
2517
|
self.save_buffer(buf)
|
|
2512
2518
|
|
|
@@ -2525,7 +2531,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2525
2531
|
wx.CallAfter(self.delete_buffer, buf)
|
|
2526
2532
|
|
|
2527
2533
|
def kill_all_buffers(self):
|
|
2528
|
-
for buf in self.
|
|
2534
|
+
for buf in self.get_all_buffers():
|
|
2529
2535
|
if buf.need_buffer_save:
|
|
2530
2536
|
if wx.MessageBox( # Confirm close.
|
|
2531
2537
|
"You are closing unsaved content.\n\n"
|
|
@@ -2646,7 +2652,7 @@ class Nautilus(EditorInterface, Shell):
|
|
|
2646
2652
|
|
|
2647
2653
|
C-up : [0] retrieve previous history
|
|
2648
2654
|
C-down : [0] retrieve next history
|
|
2649
|
-
C-j
|
|
2655
|
+
C-j : [0] tooltip of eval (for the selected or focused word)
|
|
2650
2656
|
C-h, M-h : [0] calltip of help (for the selected or focused func)
|
|
2651
2657
|
TAB : [1] history-comp
|
|
2652
2658
|
M-p : [1] retrieve previous history in history-comp mode
|
|
@@ -2839,8 +2845,8 @@ class Nautilus(EditorInterface, Shell):
|
|
|
2839
2845
|
'C-S-v pressed' : (0, _F(self.Paste, rectangle=1)),
|
|
2840
2846
|
'S-insert pressed' : (0, _F(self.Paste)),
|
|
2841
2847
|
'C-S-insert pressed' : (0, _F(self.Paste, rectangle=1)),
|
|
2842
|
-
'C-j pressed' : (0, self.eval_line),
|
|
2843
|
-
'M-j pressed' : (0, self.exec_region),
|
|
2848
|
+
'C-j pressed' : (0, _F(self.eval_line)),
|
|
2849
|
+
'M-j pressed' : (0, _F(self.exec_region)),
|
|
2844
2850
|
'C-h pressed' : (0, self.call_helpTip),
|
|
2845
2851
|
'M-h pressed' : (0, self.call_helpDoc),
|
|
2846
2852
|
'. pressed' : (2, self.OnEnterDot),
|
|
@@ -2898,7 +2904,7 @@ class Nautilus(EditorInterface, Shell):
|
|
|
2898
2904
|
'*backspace pressed' : (2, self.OnBackspace),
|
|
2899
2905
|
'*backspace released' : (2, self.call_word_autocomp),
|
|
2900
2906
|
'C-S-backspace pressed' : (2, ),
|
|
2901
|
-
'C-j pressed' : (2, self.eval_line),
|
|
2907
|
+
'C-j pressed' : (2, _F(self.eval_line)),
|
|
2902
2908
|
'*alt pressed' : (2, ),
|
|
2903
2909
|
'*ctrl pressed' : (2, ),
|
|
2904
2910
|
'*shift pressed' : (2, ),
|
|
@@ -2926,7 +2932,7 @@ class Nautilus(EditorInterface, Shell):
|
|
|
2926
2932
|
'*backspace pressed' : (3, self.OnBackspace),
|
|
2927
2933
|
'*backspace released' : (3, self.call_apropos_autocomp),
|
|
2928
2934
|
'C-S-backspace pressed' : (3, ),
|
|
2929
|
-
'C-j pressed' : (3, self.eval_line),
|
|
2935
|
+
'C-j pressed' : (3, _F(self.eval_line)),
|
|
2930
2936
|
'*alt pressed' : (3, ),
|
|
2931
2937
|
'*ctrl pressed' : (3, ),
|
|
2932
2938
|
'*shift pressed' : (3, ),
|
|
@@ -2954,7 +2960,7 @@ class Nautilus(EditorInterface, Shell):
|
|
|
2954
2960
|
'*backspace pressed' : (4, self.OnBackspace),
|
|
2955
2961
|
'*backspace released' : (4, self.call_text_autocomp),
|
|
2956
2962
|
'C-S-backspace pressed' : (4, ),
|
|
2957
|
-
'C-j pressed' : (4, self.eval_line),
|
|
2963
|
+
'C-j pressed' : (4, _F(self.eval_line)),
|
|
2958
2964
|
'*alt pressed' : (4, ),
|
|
2959
2965
|
'*ctrl pressed' : (4, ),
|
|
2960
2966
|
'*shift pressed' : (4, ),
|
|
@@ -3513,13 +3519,13 @@ class Nautilus(EditorInterface, Shell):
|
|
|
3513
3519
|
"""Short information."""
|
|
3514
3520
|
doc = inspect.getdoc(obj)\
|
|
3515
3521
|
or "No information about {}".format(obj)
|
|
3516
|
-
self.parent.handler('add_help', doc) or print(doc)
|
|
3522
|
+
self.parent.handler('add_help', doc, typename(obj)) or print(doc)
|
|
3517
3523
|
|
|
3518
3524
|
def help(self, obj):
|
|
3519
3525
|
"""Full description."""
|
|
3520
3526
|
doc = pydoc.plain(pydoc.render_doc(obj))\
|
|
3521
3527
|
or "No description about {}".format(obj)
|
|
3522
|
-
self.parent.handler('add_help', doc) or print(doc)
|
|
3528
|
+
self.parent.handler('add_help', doc, typename(obj)) or print(doc)
|
|
3523
3529
|
|
|
3524
3530
|
def eval(self, text):
|
|
3525
3531
|
return eval(text, self.globals, self.locals)
|
|
@@ -3594,7 +3600,7 @@ class Nautilus(EditorInterface, Shell):
|
|
|
3594
3600
|
self.cpos, self.anchor = self.anchor, self.cpos
|
|
3595
3601
|
self.EnsureCaretVisible()
|
|
3596
3602
|
|
|
3597
|
-
def eval_line(self
|
|
3603
|
+
def eval_line(self):
|
|
3598
3604
|
"""Evaluate the selected word or line."""
|
|
3599
3605
|
if self.CallTipActive():
|
|
3600
3606
|
self.CallTipCancel()
|
|
@@ -3614,7 +3620,7 @@ class Nautilus(EditorInterface, Shell):
|
|
|
3614
3620
|
else:
|
|
3615
3621
|
self.message("No words")
|
|
3616
3622
|
|
|
3617
|
-
def exec_region(self
|
|
3623
|
+
def exec_region(self):
|
|
3618
3624
|
"""Execute the the selected region."""
|
|
3619
3625
|
if self.CallTipActive():
|
|
3620
3626
|
self.CallTipCancel()
|
mwx/testsuite.py
CHANGED
mwx/wxpdb.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=pS7ZG8QKRypiFFiaWAq_opBB6I_1viZ0zUMk2TbjzE0,667
|
|
2
|
-
mwx/bookshelf.py,sha256=
|
|
3
|
-
mwx/controls.py,sha256=
|
|
4
|
-
mwx/framework.py,sha256=
|
|
5
|
-
mwx/graphman.py,sha256=
|
|
2
|
+
mwx/bookshelf.py,sha256=SFT_08Us0d0tjwlKX9HWaRdbZpcBBK4sCkP2DSetRbE,7747
|
|
3
|
+
mwx/controls.py,sha256=ojMUTl-1YRVVEH32WBIK_NUED6UWAil6EGAYigqh5ak,48090
|
|
4
|
+
mwx/framework.py,sha256=6TtB58J5aYE5R3zNLC7xlhT77FkxKV4cq48jwH8AnrY,76906
|
|
5
|
+
mwx/graphman.py,sha256=jZvSH5SPV_L_cTbYCG2JHN1phuvTpe-UjXmcyJz0QX0,70398
|
|
6
6
|
mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
|
|
7
7
|
mwx/matplot2.py,sha256=Zwte-wwzCg_OHzsBniVgKdaNLzsvJaa1gc0n7VdAqxw,33150
|
|
8
|
-
mwx/matplot2g.py,sha256=
|
|
8
|
+
mwx/matplot2g.py,sha256=yloFQCVjR2r4pDBJeKh3uqbdOxoeKO5Z5lhmjVwdRac,64361
|
|
9
9
|
mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
|
|
10
10
|
mwx/mgplt.py,sha256=8mXbHpCmm7lz3XbAxOg7IVC7DaSGBEby1UfTlMl9kjk,5604
|
|
11
|
-
mwx/nutshell.py,sha256=
|
|
12
|
-
mwx/testsuite.py,sha256=
|
|
11
|
+
mwx/nutshell.py,sha256=8U40niudjo2EjAoSzaZ2g9W-uSlrfcNqfo4A0s2GiaU,141577
|
|
12
|
+
mwx/testsuite.py,sha256=Zk75onPSEn2tf0swS3l-vIn6yTXGB7allIyvJsPHj20,1229
|
|
13
13
|
mwx/utilus.py,sha256=bDeooo2bOcZwvkIdi0ElkT-qoblqzHNFsIveb72NFOo,37528
|
|
14
14
|
mwx/wxmon.py,sha256=yzWqrbY6LzpfRwQeytYUeqFhFuLVm_XEvrVAL_k0HBQ,12756
|
|
15
|
-
mwx/wxpdb.py,sha256=
|
|
15
|
+
mwx/wxpdb.py,sha256=KkTQKwsr7g0uJeN8qdgMz7P2a-I859G1XJyPibAOUDI,18821
|
|
16
16
|
mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
|
|
17
17
|
mwx/wxwit.py,sha256=1hHtMi2YEy2T_LnUpwdmrIdtCuvxMOFyykqnbq6jLP0,7294
|
|
18
18
|
mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
|
|
@@ -22,8 +22,8 @@ mwx/plugins/frame_listview.py,sha256=gowjQ-ARNonMkDSXkQgPKq4U9YBJ-vQ0jK2krBVOdCs
|
|
|
22
22
|
mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
|
|
23
23
|
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
24
24
|
mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
|
|
25
|
-
mwxlib-1.
|
|
26
|
-
mwxlib-1.
|
|
27
|
-
mwxlib-1.
|
|
28
|
-
mwxlib-1.
|
|
29
|
-
mwxlib-1.
|
|
25
|
+
mwxlib-1.3.3.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
26
|
+
mwxlib-1.3.3.dist-info/METADATA,sha256=wyWGjSDomWzGvIQGyxsVLhdBd1xLwoaX54A0aDFdNUU,7456
|
|
27
|
+
mwxlib-1.3.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
28
|
+
mwxlib-1.3.3.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
29
|
+
mwxlib-1.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|