mwxlib 0.94.0__py3-none-any.whl → 0.94.4__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/__init__.py +1 -44
- mwx/bookshelf.py +51 -85
- mwx/controls.py +2 -2
- mwx/framework.py +61 -15
- mwx/matplot2g.py +0 -2
- mwx/nutshell.py +15 -20
- mwx/utilus.py +16 -3
- {mwxlib-0.94.0.dist-info → mwxlib-0.94.4.dist-info}/METADATA +1 -1
- {mwxlib-0.94.0.dist-info → mwxlib-0.94.4.dist-info}/RECORD +12 -12
- {mwxlib-0.94.0.dist-info → mwxlib-0.94.4.dist-info}/LICENSE +0 -0
- {mwxlib-0.94.0.dist-info → mwxlib-0.94.4.dist-info}/WHEEL +0 -0
- {mwxlib-0.94.0.dist-info → mwxlib-0.94.4.dist-info}/top_level.txt +0 -0
mwx/__init__.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
from .framework import __version__, __author__
|
|
5
5
|
from .framework import FSM
|
|
6
6
|
from .framework import Menu, MenuBar, StatusBar
|
|
7
|
-
from .framework import App, Frame, MiniFrame, ShellFrame
|
|
7
|
+
from .framework import deb, App, Frame, MiniFrame, ShellFrame
|
|
8
8
|
|
|
9
9
|
## Controls
|
|
10
10
|
## from . import controls
|
|
@@ -25,46 +25,3 @@ from .framework import App, Frame, MiniFrame, ShellFrame
|
|
|
25
25
|
## Gnuplot
|
|
26
26
|
## from .mgplt import Gnuplot
|
|
27
27
|
## from .mgplt import GnuplotFrame
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def deb(target=None, loop=True, locals=None, **kwargs):
|
|
31
|
-
"""Dive into the process.
|
|
32
|
-
|
|
33
|
-
Args:
|
|
34
|
-
target : Object or module (default None).
|
|
35
|
-
If None, the target is set to `__main__`.
|
|
36
|
-
loop : If True, the app and the mainloop will be created.
|
|
37
|
-
Otherwise, neither the app nor the mainloop will be created.
|
|
38
|
-
locals : Additional context of the shell
|
|
39
|
-
|
|
40
|
-
**kwargs: Nautilus arguments
|
|
41
|
-
|
|
42
|
-
- introText : introductory of the shell
|
|
43
|
-
- startupScript : startup script file (default None)
|
|
44
|
-
- execStartupScript : True => Execute the startup script.
|
|
45
|
-
- ensureClose : True => EVT_CLOSE will close the window.
|
|
46
|
-
False => EVT_CLOSE will hide the window.
|
|
47
|
-
|
|
48
|
-
Note:
|
|
49
|
-
This will execute the startup script $(PYTHONSTARTUP).
|
|
50
|
-
"""
|
|
51
|
-
import wx
|
|
52
|
-
|
|
53
|
-
quote_unqoute = """
|
|
54
|
-
Anything one man can imagine, other man can make real.
|
|
55
|
-
--- Jules Verne (1828--1905)
|
|
56
|
-
"""
|
|
57
|
-
kwargs.setdefault("introText",
|
|
58
|
-
"mwx {}".format(__version__) + quote_unqoute)
|
|
59
|
-
kwargs.setdefault("execStartupScript", True)
|
|
60
|
-
kwargs.setdefault("ensureClose", True)
|
|
61
|
-
|
|
62
|
-
app = wx.GetApp() or wx.App()
|
|
63
|
-
frame = ShellFrame(None, target, **kwargs)
|
|
64
|
-
frame.Show()
|
|
65
|
-
frame.rootshell.SetFocus()
|
|
66
|
-
if locals:
|
|
67
|
-
frame.rootshell.locals.update(locals)
|
|
68
|
-
if loop and not app.GetMainLoop():
|
|
69
|
-
app.MainLoop()
|
|
70
|
-
return frame
|
mwx/bookshelf.py
CHANGED
|
@@ -2,29 +2,17 @@
|
|
|
2
2
|
import re
|
|
3
3
|
import wx
|
|
4
4
|
|
|
5
|
-
from .
|
|
6
|
-
from .nutshell import EditorBook
|
|
7
|
-
from .framework import CtrlInterface
|
|
5
|
+
from .framework import CtrlInterface, postcall
|
|
8
6
|
|
|
9
7
|
|
|
10
|
-
class
|
|
11
|
-
"""
|
|
12
|
-
"""
|
|
13
|
-
def __init__(self, tree, buffer):
|
|
14
|
-
self.tree = tree
|
|
15
|
-
self.buffer = buffer
|
|
16
|
-
self._itemId = None #: reference <TreeItemId>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface, TreeList):
|
|
20
|
-
"""TreeList control
|
|
8
|
+
class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
9
|
+
"""TreeList/Ctrl
|
|
21
10
|
|
|
22
11
|
Construct treectrl in the order of tree:list.
|
|
23
12
|
"""
|
|
24
13
|
def __init__(self, parent, *args, **kwargs):
|
|
25
14
|
wx.TreeCtrl.__init__(self, parent, *args, **kwargs)
|
|
26
15
|
CtrlInterface.__init__(self)
|
|
27
|
-
TreeList.__init__(self)
|
|
28
16
|
|
|
29
17
|
self.Font = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
|
|
30
18
|
|
|
@@ -52,18 +40,20 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface, TreeList):
|
|
|
52
40
|
def enter(v):
|
|
53
41
|
data = self.GetItemData(self.Selection)
|
|
54
42
|
if data:
|
|
55
|
-
data.
|
|
43
|
+
data.SetFocus()
|
|
56
44
|
|
|
57
45
|
@self.handler.bind('f5 pressed')
|
|
58
46
|
def refresh(v):
|
|
59
|
-
self.
|
|
47
|
+
self.update(clear=0)
|
|
48
|
+
if self.target:
|
|
49
|
+
self.target.current_editor.SetFocus()
|
|
50
|
+
wx.CallAfter(self.SetFocus)
|
|
60
51
|
|
|
61
52
|
@self.handler.bind('delete pressed')
|
|
62
53
|
def delete(v):
|
|
63
54
|
data = self.GetItemData(self.Selection)
|
|
64
55
|
if data:
|
|
65
|
-
|
|
66
|
-
buf.parent.kill_buffer(buf) # -> focus moves
|
|
56
|
+
data.parent.kill_buffer(data) # -> focus moves
|
|
67
57
|
wx.CallAfter(self.SetFocus)
|
|
68
58
|
|
|
69
59
|
@self.handler.bind('*button* pressed')
|
|
@@ -75,28 +65,41 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface, TreeList):
|
|
|
75
65
|
|
|
76
66
|
def OnDestroy(self, evt):
|
|
77
67
|
if evt.EventObject is self:
|
|
78
|
-
self.
|
|
68
|
+
self.detach()
|
|
79
69
|
evt.Skip()
|
|
80
70
|
|
|
71
|
+
def attach(self, target):
|
|
72
|
+
self.detach()
|
|
73
|
+
self.target = target
|
|
74
|
+
for editor in self.target.all_editors:
|
|
75
|
+
editor.handler.append(self.context)
|
|
76
|
+
self.update()
|
|
77
|
+
|
|
78
|
+
def detach(self):
|
|
79
|
+
if not self.target:
|
|
80
|
+
return
|
|
81
|
+
for editor in self.target.all_editors:
|
|
82
|
+
editor.handler.remove(self.context)
|
|
83
|
+
self.target = None
|
|
84
|
+
self.update()
|
|
85
|
+
|
|
81
86
|
## --------------------------------
|
|
82
87
|
## TreeList/Ctrl wrapper interface
|
|
83
88
|
## --------------------------------
|
|
84
89
|
|
|
85
|
-
def
|
|
90
|
+
def update(self, clear=True):
|
|
86
91
|
"""Build tree control.
|
|
87
|
-
All items will be
|
|
92
|
+
All items will be cleared if specified.
|
|
88
93
|
"""
|
|
89
94
|
try:
|
|
90
95
|
self.Freeze()
|
|
91
|
-
wnd = wx.Window.FindFocus() # original focus
|
|
92
96
|
if clear:
|
|
93
97
|
self.DeleteAllItems()
|
|
94
98
|
self.AddRoot(self.Name)
|
|
95
|
-
|
|
96
|
-
self.
|
|
99
|
+
if self.target:
|
|
100
|
+
for editor in self.target.all_editors:
|
|
101
|
+
self._set_item(self.RootItem, editor.Name, editor.all_buffers)
|
|
97
102
|
finally:
|
|
98
|
-
if wnd:
|
|
99
|
-
wnd.SetFocus() # restore focus
|
|
100
103
|
self.Thaw()
|
|
101
104
|
|
|
102
105
|
def _get_item(self, root, key):
|
|
@@ -110,83 +113,46 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface, TreeList):
|
|
|
110
113
|
return item
|
|
111
114
|
item, cookie = self.GetNextChild(root, cookie)
|
|
112
115
|
|
|
113
|
-
def _set_item(self, root, key,
|
|
114
|
-
"""Set the item [root/key] with
|
|
116
|
+
def _set_item(self, root, key, data):
|
|
117
|
+
"""Set the item [root/key] with data recursively.
|
|
115
118
|
"""
|
|
116
119
|
item = self._get_item(root, key) or self.AppendItem(root, key)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
data._itemId = item
|
|
125
|
-
self.SetItemData(item, data)
|
|
126
|
-
buf = data.buffer
|
|
127
|
-
self.SetItemText(item, buf.caption_prefix + buf.name)
|
|
128
|
-
except AttributeError:
|
|
129
|
-
pass
|
|
130
|
-
for branch in branches:
|
|
131
|
-
self._set_item(item, *branch)
|
|
120
|
+
if isinstance(data, list):
|
|
121
|
+
for buf in data:
|
|
122
|
+
self._set_item(item, buf.name, buf)
|
|
123
|
+
else:
|
|
124
|
+
data.__itemId = item
|
|
125
|
+
self.SetItemData(item, data)
|
|
126
|
+
self.SetItemText(item, data.caption_prefix + data.name)
|
|
132
127
|
|
|
133
128
|
## --------------------------------
|
|
134
129
|
## Actions for bookshelf interfaces
|
|
135
130
|
## --------------------------------
|
|
136
131
|
|
|
137
|
-
|
|
138
|
-
"""Reset a branch for EditorBook/Buffer."""
|
|
139
|
-
self[editor.Name] = [
|
|
140
|
-
[buf.name, ItemData(self, buf)] for buf in editor.all_buffers
|
|
141
|
-
]
|
|
142
|
-
|
|
143
|
-
def watch(self, target):
|
|
144
|
-
self.unwatch()
|
|
145
|
-
self.target = target
|
|
146
|
-
if self.target:
|
|
147
|
-
for editor in self.target.get_pages(EditorBook):
|
|
148
|
-
editor.handler.append(self.context)
|
|
149
|
-
self.reset_tree(editor)
|
|
150
|
-
self.reset()
|
|
151
|
-
|
|
152
|
-
def unwatch(self):
|
|
153
|
-
if self.target:
|
|
154
|
-
for editor in self.target.get_pages(EditorBook):
|
|
155
|
-
editor.handler.remove(self.context)
|
|
156
|
-
self[:] = [] # clear tree
|
|
157
|
-
self.reset()
|
|
158
|
-
self.target = None
|
|
159
|
-
|
|
132
|
+
@postcall
|
|
160
133
|
def on_buffer_new(self, buf):
|
|
161
|
-
self
|
|
162
|
-
self.reset(clear=0)
|
|
134
|
+
self.update(clear=0)
|
|
163
135
|
|
|
136
|
+
@postcall
|
|
164
137
|
def on_buffer_deleted(self, buf):
|
|
165
|
-
|
|
166
|
-
self.reset()
|
|
138
|
+
self.Delete(buf.__itemId)
|
|
167
139
|
|
|
140
|
+
@postcall
|
|
168
141
|
def on_buffer_selected(self, buf):
|
|
169
|
-
|
|
170
|
-
self.SelectItem(data._itemId)
|
|
142
|
+
self.SelectItem(buf.__itemId)
|
|
171
143
|
|
|
144
|
+
@postcall
|
|
172
145
|
def on_buffer_caption(self, buf):
|
|
173
|
-
|
|
174
|
-
self.SetItemText(data._itemId, buf.caption_prefix + buf.name)
|
|
146
|
+
self.SetItemText(buf.__itemId, buf.caption_prefix + buf.name)
|
|
175
147
|
|
|
148
|
+
@postcall
|
|
176
149
|
def on_buffer_filename(self, buf):
|
|
177
|
-
self.
|
|
178
|
-
self.reset()
|
|
150
|
+
self.SetItemText(buf.__itemId, buf.caption_prefix + buf.name)
|
|
179
151
|
|
|
180
152
|
def OnSelChanged(self, evt):
|
|
181
153
|
if self and self.HasFocus():
|
|
182
154
|
data = self.GetItemData(evt.Item)
|
|
183
|
-
if data
|
|
184
|
-
data.
|
|
155
|
+
if data:
|
|
156
|
+
data.SetFocus()
|
|
185
157
|
self.SetFocus()
|
|
186
158
|
evt.Skip()
|
|
187
|
-
|
|
188
|
-
## def OnItemTooltip(self, evt):
|
|
189
|
-
## data = self.GetItemData(evt.Item)
|
|
190
|
-
## if data and data.buffer:
|
|
191
|
-
## evt.SetToolTip(data.buffer.filename)
|
|
192
|
-
## evt.Skip()
|
mwx/controls.py
CHANGED
|
@@ -1119,7 +1119,7 @@ class Choice(wx.Control):
|
|
|
1119
1119
|
|
|
1120
1120
|
Selection = property(
|
|
1121
1121
|
lambda self: self._ctrl.GetSelection(),
|
|
1122
|
-
lambda self,v: self._ctrl.SetSelection(v),
|
|
1122
|
+
lambda self,v: self._ctrl.SetSelection(v), # int or NOT_FOUND(-1)
|
|
1123
1123
|
doc="combobox selection:int")
|
|
1124
1124
|
|
|
1125
1125
|
Items = property(
|
|
@@ -1199,7 +1199,7 @@ class Indicator(wx.Control):
|
|
|
1199
1199
|
self.__value = int(v)
|
|
1200
1200
|
self.Refresh()
|
|
1201
1201
|
|
|
1202
|
-
def
|
|
1202
|
+
def update_design(self, **kwargs):
|
|
1203
1203
|
"""Update design attributes.
|
|
1204
1204
|
|
|
1205
1205
|
This method is useful for changing colors, spacing, radius, etc.
|
mwx/framework.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#! python3
|
|
2
2
|
"""mwxlib framework.
|
|
3
3
|
"""
|
|
4
|
-
__version__ = "0.94.
|
|
4
|
+
__version__ = "0.94.4"
|
|
5
5
|
__author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
|
|
6
6
|
|
|
7
7
|
from functools import wraps, partial
|
|
@@ -26,6 +26,47 @@ from .utilus import FSM, TreeList, apropos, typename, where, mro, pp
|
|
|
26
26
|
from .utilus import get_rootpath
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
def deb(target=None, loop=True, locals=None, **kwargs):
|
|
30
|
+
"""Dive into the process.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
target : Object or module (default None).
|
|
34
|
+
If None, the target is set to `__main__`.
|
|
35
|
+
loop : If True, the app and the mainloop will be created.
|
|
36
|
+
Otherwise, neither the app nor the mainloop will be created.
|
|
37
|
+
locals : Additional context of the shell
|
|
38
|
+
|
|
39
|
+
**kwargs: Nautilus arguments
|
|
40
|
+
|
|
41
|
+
- introText : introductory of the shell
|
|
42
|
+
- startupScript : startup script file (default None)
|
|
43
|
+
- execStartupScript : True => Execute the startup script.
|
|
44
|
+
- ensureClose : True => EVT_CLOSE will close the window.
|
|
45
|
+
False => EVT_CLOSE will hide the window.
|
|
46
|
+
|
|
47
|
+
Note:
|
|
48
|
+
This will execute the startup script $(PYTHONSTARTUP).
|
|
49
|
+
"""
|
|
50
|
+
import wx
|
|
51
|
+
|
|
52
|
+
quote_unqoute = """
|
|
53
|
+
Anything one man can imagine, other man can make real.
|
|
54
|
+
--- Jules Verne (1828--1905)
|
|
55
|
+
"""
|
|
56
|
+
kwargs.setdefault("introText",
|
|
57
|
+
"mwx {}".format(__version__) + quote_unqoute)
|
|
58
|
+
kwargs.setdefault("execStartupScript", True)
|
|
59
|
+
kwargs.setdefault("ensureClose", True)
|
|
60
|
+
|
|
61
|
+
with App(loop):
|
|
62
|
+
frame = ShellFrame(None, target, **kwargs)
|
|
63
|
+
frame.Show()
|
|
64
|
+
frame.rootshell.SetFocus()
|
|
65
|
+
if locals:
|
|
66
|
+
frame.rootshell.locals.update(locals)
|
|
67
|
+
return frame
|
|
68
|
+
|
|
69
|
+
|
|
29
70
|
@contextmanager
|
|
30
71
|
def App(loop=True):
|
|
31
72
|
app = wx.GetApp() or wx.App()
|
|
@@ -975,7 +1016,7 @@ class FileDropLoader(wx.DropTarget):
|
|
|
975
1016
|
def __init__(self, target):
|
|
976
1017
|
wx.DropTarget.__init__(self)
|
|
977
1018
|
|
|
978
|
-
self.
|
|
1019
|
+
self.editor = target
|
|
979
1020
|
self.textdo = wx.TextDataObject()
|
|
980
1021
|
self.filedo = wx.FileDataObject()
|
|
981
1022
|
self.DataObject = wx.DataObjectComposite()
|
|
@@ -983,7 +1024,7 @@ class FileDropLoader(wx.DropTarget):
|
|
|
983
1024
|
self.DataObject.Add(self.filedo, True)
|
|
984
1025
|
|
|
985
1026
|
def OnData(self, x, y, result):
|
|
986
|
-
editor = self.
|
|
1027
|
+
editor = self.editor
|
|
987
1028
|
self.GetData()
|
|
988
1029
|
if self.textdo.TextLength > 1:
|
|
989
1030
|
f = self.textdo.Text.strip()
|
|
@@ -1115,12 +1156,9 @@ class ShellFrame(MiniFrame):
|
|
|
1115
1156
|
|
|
1116
1157
|
self.Bookshelf = EditorTreeCtrl(self, name="Bookshelf",
|
|
1117
1158
|
style=wx.TR_DEFAULT_STYLE|wx.TR_HIDE_ROOT)
|
|
1118
|
-
self.Bookshelf.
|
|
1159
|
+
self.Bookshelf.attach(self)
|
|
1119
1160
|
|
|
1120
1161
|
self.ghost.AddPage(self.Bookshelf, "Bookshelf", bitmap=Icon('book'))
|
|
1121
|
-
## self._mgr.AddPane(self.Bookshelf,
|
|
1122
|
-
## aui.AuiPaneInfo().Name("bookshelf")
|
|
1123
|
-
## .Caption("Bookshelf").Right().Show(1))
|
|
1124
1162
|
|
|
1125
1163
|
self.ghost.SetDropTarget(FileDropLoader(self.Scratch))
|
|
1126
1164
|
|
|
@@ -1209,7 +1247,7 @@ class ShellFrame(MiniFrame):
|
|
|
1209
1247
|
'add_log' : [ None, self.add_log ],
|
|
1210
1248
|
'add_help' : [ None, self.add_help ],
|
|
1211
1249
|
'title_window' : [ None, self.on_title_window ],
|
|
1212
|
-
'buffer_caption_reset' : [ None, self.on_buffer_caption ],
|
|
1250
|
+
'buffer_caption_reset' : [ None, self.on_buffer_caption ], # => self.OnActivate
|
|
1213
1251
|
},
|
|
1214
1252
|
0 : {
|
|
1215
1253
|
'* pressed' : (0, fork_debugger),
|
|
@@ -1237,9 +1275,9 @@ class ShellFrame(MiniFrame):
|
|
|
1237
1275
|
shell = self.current_shell
|
|
1238
1276
|
self.Scratch.buffer.py_eval_line(shell.globals, shell.locals)
|
|
1239
1277
|
|
|
1240
|
-
@self.Scratch.define_key('
|
|
1278
|
+
@self.Scratch.define_key('C-S-j')
|
|
1241
1279
|
@postcall
|
|
1242
|
-
def
|
|
1280
|
+
def eval_buffer():
|
|
1243
1281
|
shell = self.current_shell
|
|
1244
1282
|
self.Scratch.buffer.py_exec_region(shell.globals, shell.locals)
|
|
1245
1283
|
|
|
@@ -1597,7 +1635,7 @@ class ShellFrame(MiniFrame):
|
|
|
1597
1635
|
filename, ln = m.groups()
|
|
1598
1636
|
lineno = int(ln)
|
|
1599
1637
|
editor = self.find_editor(filename) or self.Log
|
|
1600
|
-
ret =
|
|
1638
|
+
ret = editor.load_file(filename, lineno, verbose=1)
|
|
1601
1639
|
if ret:
|
|
1602
1640
|
self.popup_window(editor, show, focus)
|
|
1603
1641
|
return ret
|
|
@@ -1871,13 +1909,21 @@ class ShellFrame(MiniFrame):
|
|
|
1871
1909
|
"""Yields all editors in the notebooks."""
|
|
1872
1910
|
yield from self.ghost.get_pages(type(self.Log))
|
|
1873
1911
|
|
|
1912
|
+
@property
|
|
1913
|
+
def current_editor(self):
|
|
1914
|
+
"""Currently selected editor or scratch."""
|
|
1915
|
+
editor = self.ghost.CurrentPage
|
|
1916
|
+
if isinstance(editor, type(self.Log)):
|
|
1917
|
+
return editor
|
|
1918
|
+
return next((x for x in self.all_editors if x.IsShown()), self.Scratch)
|
|
1919
|
+
|
|
1874
1920
|
def find_editor(self, fn):
|
|
1875
1921
|
"""Find an editor which has the specified fn:filename or code."""
|
|
1876
|
-
for
|
|
1877
|
-
buf =
|
|
1922
|
+
for book in self.all_editors:
|
|
1923
|
+
buf = book.find_buffer(fn)
|
|
1878
1924
|
if buf:
|
|
1879
|
-
|
|
1880
|
-
return
|
|
1925
|
+
book.swap_page(buf)
|
|
1926
|
+
return book
|
|
1881
1927
|
|
|
1882
1928
|
## --------------------------------
|
|
1883
1929
|
## Find text dialog
|
mwx/matplot2g.py
CHANGED
|
@@ -946,8 +946,6 @@ class GraphPlot(MatplotPanel):
|
|
|
946
946
|
xr, yr = max(nx), max(ny) # bottom-right
|
|
947
947
|
self.message("[Region] "
|
|
948
948
|
"crop={}:{}:{}:{}".format(xr-xo, yr-yo, xo, yo)) # (W:H:left:top)
|
|
949
|
-
else:
|
|
950
|
-
return self.trace_point(x[[0,-1]], y[[0,-1]], type)
|
|
951
949
|
|
|
952
950
|
def writeln(self):
|
|
953
951
|
"""Puts (override) attributes of current frame to the modeline."""
|
mwx/nutshell.py
CHANGED
|
@@ -290,7 +290,7 @@ class EditorInterface(CtrlInterface):
|
|
|
290
290
|
self.__mark = -1
|
|
291
291
|
self.__stylus = {}
|
|
292
292
|
|
|
293
|
-
## Custom constants embedded in stc
|
|
293
|
+
## Custom constants embedded in wx.stc
|
|
294
294
|
stc.STC_P_WORD3 = 20
|
|
295
295
|
stc.STC_STYLE_CARETLINE = 40
|
|
296
296
|
stc.STC_STYLE_ANNOTATION = 41
|
|
@@ -986,7 +986,7 @@ class EditorInterface(CtrlInterface):
|
|
|
986
986
|
self.EnsureVisible(self.cline)
|
|
987
987
|
yield err
|
|
988
988
|
|
|
989
|
-
def
|
|
989
|
+
def grep_backward(self, pattern, flags=re.M):
|
|
990
990
|
text = self.GetTextRange(0, self.cpos)
|
|
991
991
|
errs = re.finditer(pattern, text, flags)
|
|
992
992
|
for err in reversed(list(errs)):
|
|
@@ -1965,7 +1965,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
1965
1965
|
"""
|
|
1966
1966
|
buf = self.find_buffer(filename)
|
|
1967
1967
|
if not buf:
|
|
1968
|
-
buf = self.create_buffer(
|
|
1968
|
+
buf = self.create_buffer("*temp file*")
|
|
1969
1969
|
elif buf.need_buffer_save and verbose:
|
|
1970
1970
|
if wx.MessageBox( # Confirm load.
|
|
1971
1971
|
"You are leaving unsaved content.\n\n"
|
|
@@ -2220,8 +2220,8 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2220
2220
|
|
|
2221
2221
|
C-up : [0] retrieve previous history
|
|
2222
2222
|
C-down : [0] retrieve next history
|
|
2223
|
-
C-j,
|
|
2224
|
-
C-h,
|
|
2223
|
+
C-j, C-S-j : [0] call tooltip of eval (for the word selected or focused)
|
|
2224
|
+
C-h, C-S-h : [0] call tooltip of help (for the func selected or focused)
|
|
2225
2225
|
TAB : [1] history-comp-mode
|
|
2226
2226
|
M-p : [1] retrieve previous history in comp-mode
|
|
2227
2227
|
M-n : [1] retrieve next history in comp-mode
|
|
@@ -2472,9 +2472,9 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2472
2472
|
'S-insert pressed' : (0, _F(self.Paste)),
|
|
2473
2473
|
'C-S-insert pressed' : (0, _F(self.Paste, rectangle=1)),
|
|
2474
2474
|
'C-j pressed' : (0, self.eval_line),
|
|
2475
|
-
|
|
2475
|
+
'C-S-j pressed' : (0, self.exec_region),
|
|
2476
2476
|
'C-h pressed' : (0, self.call_helpTip),
|
|
2477
|
-
|
|
2477
|
+
'C-S-h pressed' : (0, self.call_helpTip2),
|
|
2478
2478
|
'. pressed' : (2, self.OnEnterDot),
|
|
2479
2479
|
'tab pressed' : (1, self.call_history_comp),
|
|
2480
2480
|
'M-p pressed' : (1, self.call_history_comp),
|
|
@@ -2531,9 +2531,9 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2531
2531
|
'*backspace released' : (2, self.call_word_autocomp),
|
|
2532
2532
|
'C-S-backspace pressed' : (2, ),
|
|
2533
2533
|
'C-j pressed' : (2, self.eval_line),
|
|
2534
|
-
|
|
2534
|
+
'C-S-j pressed' : (2, self.exec_region),
|
|
2535
2535
|
'C-h pressed' : (2, self.call_helpTip),
|
|
2536
|
-
|
|
2536
|
+
'C-S-h pressed' : (2, self.call_helpTip2),
|
|
2537
2537
|
'*alt pressed' : (2, ),
|
|
2538
2538
|
'*ctrl pressed' : (2, ),
|
|
2539
2539
|
'*shift pressed' : (2, ),
|
|
@@ -2562,9 +2562,9 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2562
2562
|
'*backspace released' : (3, self.call_apropos_autocomp),
|
|
2563
2563
|
'C-S-backspace pressed' : (3, ),
|
|
2564
2564
|
'C-j pressed' : (3, self.eval_line),
|
|
2565
|
-
|
|
2565
|
+
'C-S-j pressed' : (3, self.exec_region),
|
|
2566
2566
|
'C-h pressed' : (3, self.call_helpTip),
|
|
2567
|
-
|
|
2567
|
+
'C-S-h pressed' : (3, self.call_helpTip2),
|
|
2568
2568
|
'*alt pressed' : (3, ),
|
|
2569
2569
|
'*ctrl pressed' : (3, ),
|
|
2570
2570
|
'*shift pressed' : (3, ),
|
|
@@ -2593,9 +2593,9 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2593
2593
|
'*backspace released' : (4, self.call_text_autocomp),
|
|
2594
2594
|
'C-S-backspace pressed' : (4, ),
|
|
2595
2595
|
'C-j pressed' : (4, self.eval_line),
|
|
2596
|
-
|
|
2596
|
+
'C-S-j pressed' : (4, self.exec_region),
|
|
2597
2597
|
'C-h pressed' : (4, self.call_helpTip),
|
|
2598
|
-
|
|
2598
|
+
'C-S-h pressed' : (4, self.call_helpTip2),
|
|
2599
2599
|
'*alt pressed' : (4, ),
|
|
2600
2600
|
'*ctrl pressed' : (4, ),
|
|
2601
2601
|
'*shift pressed' : (4, ),
|
|
@@ -3141,10 +3141,6 @@ class Nautilus(Shell, EditorInterface):
|
|
|
3141
3141
|
|
|
3142
3142
|
def help(self, obj):
|
|
3143
3143
|
"""Full description."""
|
|
3144
|
-
## if obj is None:
|
|
3145
|
-
## self.message("Currently redirected to stdin/stdout.")
|
|
3146
|
-
## wx.CallAfter(pydoc.help)
|
|
3147
|
-
## return
|
|
3148
3144
|
doc = pydoc.plain(pydoc.render_doc(obj))\
|
|
3149
3145
|
or "No description about {}".format(obj)
|
|
3150
3146
|
self.parent.handler('add_help', doc) or print(doc)
|
|
@@ -3307,13 +3303,12 @@ class Nautilus(Shell, EditorInterface):
|
|
|
3307
3303
|
|
|
3308
3304
|
text = self.SelectedText or self.Command or self.expr_at_caret
|
|
3309
3305
|
if text:
|
|
3306
|
+
text = introspect.getRoot(text, terminator='(')
|
|
3310
3307
|
try:
|
|
3311
|
-
text = introspect.getRoot(text, terminator='(')
|
|
3312
3308
|
obj = self.eval(text)
|
|
3309
|
+
self.help(obj)
|
|
3313
3310
|
except Exception as e:
|
|
3314
3311
|
self.message("- {} : {!r}".format(e, text))
|
|
3315
|
-
else:
|
|
3316
|
-
self.help(obj)
|
|
3317
3312
|
|
|
3318
3313
|
def call_helpTip(self, evt):
|
|
3319
3314
|
"""Show tooltips for the selected topic."""
|
mwx/utilus.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"""
|
|
4
4
|
from functools import wraps
|
|
5
5
|
from bdb import BdbQuit
|
|
6
|
+
from contextlib import contextmanager
|
|
6
7
|
import traceback
|
|
7
8
|
import warnings
|
|
8
9
|
import time
|
|
@@ -20,6 +21,20 @@ from inspect import (isclass, ismodule, ismethod, isbuiltin,
|
|
|
20
21
|
from pprint import pprint
|
|
21
22
|
|
|
22
23
|
|
|
24
|
+
@contextmanager
|
|
25
|
+
def ignore(*category):
|
|
26
|
+
"""Ignore warnings.
|
|
27
|
+
|
|
28
|
+
It can be used as decorators as well as in with statements.
|
|
29
|
+
cf. contextlib.suppress
|
|
30
|
+
|
|
31
|
+
Note:
|
|
32
|
+
ignore() does not ignore warnings.
|
|
33
|
+
ignore(Warning) ignores all warnings.
|
|
34
|
+
"""
|
|
35
|
+
with warnings.catch_warnings():
|
|
36
|
+
warnings.simplefilter("ignore", category)
|
|
37
|
+
yield
|
|
23
38
|
def atom(v):
|
|
24
39
|
return not hasattr(v, '__name__')
|
|
25
40
|
|
|
@@ -126,9 +141,7 @@ def apropos(obj, rexpr='', ignorecase=True, alias=None, pred=None, locals=None):
|
|
|
126
141
|
except (TypeError, ValueError):
|
|
127
142
|
pass
|
|
128
143
|
|
|
129
|
-
with
|
|
130
|
-
warnings.simplefilter('ignore', DeprecationWarning)
|
|
131
|
-
|
|
144
|
+
with ignore(DeprecationWarning):
|
|
132
145
|
print("matching to {!r} in {} {} :{}".format(
|
|
133
146
|
rexpr, name, type(obj), pred and pred.__name__))
|
|
134
147
|
try:
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
mwx/__init__.py,sha256=
|
|
2
|
-
mwx/bookshelf.py,sha256=
|
|
3
|
-
mwx/controls.py,sha256=
|
|
4
|
-
mwx/framework.py,sha256=
|
|
1
|
+
mwx/__init__.py,sha256=zLsXDgqyC5NsPCjRxjS2huvZ3uDyeOJ1vapotqe2ULM,834
|
|
2
|
+
mwx/bookshelf.py,sha256=OWeEXMqdSF1IqAKV15TnZ_R5578AV5VDyaB7CWd2sjs,5258
|
|
3
|
+
mwx/controls.py,sha256=1eguX5eofsA6hmS2y7R4hvlFjFikVoZ8v2S1ES7rjEU,47196
|
|
4
|
+
mwx/framework.py,sha256=3Yn4lK7_qnafFitJGTtdRHetZmdxFms-PVDpOdX4kWY,75522
|
|
5
5
|
mwx/graphman.py,sha256=UsNBo5Z1eiuXj3VkxCZds_Uy8R0cQV7mXoCwLtejbCE,70001
|
|
6
6
|
mwx/images.py,sha256=mrnUYH12I3XLVSZcEXlpVltX0XMxufbl2yRvDIQJZqc,49957
|
|
7
7
|
mwx/matplot2.py,sha256=qaF_gvLoLn-TimLbRR59KUavNr1ZpZQdSMqjzJk47rk,32682
|
|
8
|
-
mwx/matplot2g.py,sha256=
|
|
8
|
+
mwx/matplot2g.py,sha256=mDaD367wjq6xsyIDX9ot8jLwYYGayoavWMhqsQVBHac,65442
|
|
9
9
|
mwx/matplot2lg.py,sha256=tg8u7w4DxiJdPN-E197NOmbQpc_1gZkgDHYv_xUhbFA,27224
|
|
10
10
|
mwx/mgplt.py,sha256=ITzxA97yDwr_35BUk5OqnyskSuKVDbpf2AQCKY1jHTI,5671
|
|
11
|
-
mwx/nutshell.py,sha256=
|
|
12
|
-
mwx/utilus.py,sha256=
|
|
11
|
+
mwx/nutshell.py,sha256=tlpYJEpe9sRSnILZBHqu85kQ0VGzTGeLT4PpRDcJPno,135647
|
|
12
|
+
mwx/utilus.py,sha256=5GVSNKyvNWxsDftIrTJUhBlnQAh3zvrW5BuQSGasJv8,37395
|
|
13
13
|
mwx/wxmon.py,sha256=Qk86VbuuW2rR46pqEYLur13G_aloWz5SVv6sib30YY0,12717
|
|
14
14
|
mwx/wxpdb.py,sha256=2z3ZD9Oo1H-ONBHlaprkB9hrTmAI7o03sqO46ppEFE4,19129
|
|
15
15
|
mwx/wxwil.py,sha256=JK1du4i1RVMbDLqN8jLRDSu_JhKEp4mhHVMElzo4yoE,5578
|
|
@@ -21,8 +21,8 @@ mwx/plugins/frame_listview.py,sha256=T-2xSv_D2bk9fJ64aiSEe1rJRTeqaIpLVAYEUXW5vz8
|
|
|
21
21
|
mwx/plugins/line_profile.py,sha256=WJB5z7F53yg4dII2R36IFZvtkSOGWT669b1HmAAXSnQ,816
|
|
22
22
|
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
23
23
|
mwx/py/filling.py,sha256=KaHooM32hrGGgqw75Cbt8lAvACwC6RXadob9LGgNnEc,16806
|
|
24
|
-
mwxlib-0.94.
|
|
25
|
-
mwxlib-0.94.
|
|
26
|
-
mwxlib-0.94.
|
|
27
|
-
mwxlib-0.94.
|
|
28
|
-
mwxlib-0.94.
|
|
24
|
+
mwxlib-0.94.4.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
25
|
+
mwxlib-0.94.4.dist-info/METADATA,sha256=kgPD9dBMgo_dMK-YF1Fye0nl2LqFpduWFVt9EgdXn7c,1925
|
|
26
|
+
mwxlib-0.94.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
27
|
+
mwxlib-0.94.4.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
28
|
+
mwxlib-0.94.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|