mwxlib 0.94.8__py3-none-any.whl → 0.95.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/__init__.py +5 -6
- mwx/bookshelf.py +9 -7
- mwx/controls.py +42 -29
- mwx/framework.py +29 -24
- mwx/graphman.py +53 -38
- mwx/matplot2.py +5 -3
- mwx/matplot2g.py +4 -4
- mwx/matplot2lg.py +18 -17
- mwx/nutshell.py +83 -81
- mwx/plugins/frame_listview.py +7 -8
- mwx/plugins/line_profile.py +2 -2
- mwx/utilus.py +2 -2
- mwx/wxmon.py +6 -6
- mwx/wxpdb.py +2 -2
- mwx/wxwil.py +6 -6
- mwx/wxwit.py +5 -5
- {mwxlib-0.94.8.dist-info → mwxlib-0.95.2.dist-info}/METADATA +1 -1
- mwxlib-0.95.2.dist-info/RECORD +28 -0
- mwxlib-0.94.8.dist-info/RECORD +0 -28
- {mwxlib-0.94.8.dist-info → mwxlib-0.95.2.dist-info}/LICENSE +0 -0
- {mwxlib-0.94.8.dist-info → mwxlib-0.95.2.dist-info}/WHEEL +0 -0
- {mwxlib-0.94.8.dist-info → mwxlib-0.95.2.dist-info}/top_level.txt +0 -0
mwx/__init__.py
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
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
|
|
7
|
+
from .framework import Frame, MiniFrame, ShellFrame, deb
|
|
8
8
|
|
|
9
9
|
## Controls
|
|
10
10
|
## from . import controls
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
from .controls import Param, LParam, Knob, ControlPanel, Clipboard, Icon
|
|
12
|
+
from .controls import Button, ToggleButton, TextCtrl, Choice, Gauge, Indicator
|
|
13
13
|
|
|
14
14
|
## Plugman
|
|
15
15
|
## from . import graphman
|
|
16
|
-
## from .graphman import Frame, Layer, Thread, Graph
|
|
16
|
+
## from .graphman import Frame as GraphFrame, Layer, Thread, Graph
|
|
17
17
|
|
|
18
18
|
## Matplot
|
|
19
19
|
## from .matplot2 import MatplotPanel
|
|
@@ -23,5 +23,4 @@ from .framework import deb, App, Frame, MiniFrame, ShellFrame
|
|
|
23
23
|
## from .matplot2lg import LineProfile
|
|
24
24
|
|
|
25
25
|
## Gnuplot
|
|
26
|
-
## from .mgplt import Gnuplot
|
|
27
|
-
## from .mgplt import GnuplotFrame
|
|
26
|
+
## from .mgplt import Gnuplot, GnuplotFrame
|
mwx/bookshelf.py
CHANGED
|
@@ -36,20 +36,22 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
36
36
|
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
|
37
37
|
|
|
38
38
|
@self.handler.bind('enter pressed')
|
|
39
|
-
def enter(
|
|
39
|
+
def enter(evt):
|
|
40
40
|
data = self.GetItemData(self.Selection)
|
|
41
41
|
if data:
|
|
42
42
|
data.SetFocus()
|
|
43
43
|
|
|
44
44
|
@self.handler.bind('f5 pressed')
|
|
45
|
-
def refresh(
|
|
46
|
-
self.build_tree(clear
|
|
45
|
+
def refresh(evt, clear=False):
|
|
46
|
+
self.build_tree(clear)
|
|
47
47
|
if self.target:
|
|
48
48
|
self.target.current_editor.SetFocus()
|
|
49
49
|
wx.CallAfter(self.SetFocus)
|
|
50
50
|
|
|
51
|
+
self.handler.bind('S-f5 pressed', partial(refresh, clear=1))
|
|
52
|
+
|
|
51
53
|
@self.handler.bind('delete pressed')
|
|
52
|
-
def delete(
|
|
54
|
+
def delete(evt):
|
|
53
55
|
data = self.GetItemData(self.Selection)
|
|
54
56
|
if data:
|
|
55
57
|
data.parent.kill_buffer(data) # -> focus moves
|
|
@@ -57,10 +59,10 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
57
59
|
|
|
58
60
|
@self.handler.bind('*button* pressed')
|
|
59
61
|
@self.handler.bind('*button* released')
|
|
60
|
-
def dispatch(
|
|
62
|
+
def dispatch(evt):
|
|
61
63
|
"""Fork mouse events to the parent."""
|
|
62
|
-
self.parent.handler(self.handler.current_event,
|
|
63
|
-
|
|
64
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
65
|
+
evt.Skip()
|
|
64
66
|
|
|
65
67
|
def OnDestroy(self, evt):
|
|
66
68
|
if evt.EventObject is self:
|
mwx/controls.py
CHANGED
|
@@ -688,21 +688,21 @@ class ControlPanel(scrolled.ScrolledPanel):
|
|
|
688
688
|
self.Sizer.Add(sizer, expand>1, p | wx.ALL, border)
|
|
689
689
|
|
|
690
690
|
## Register object and parameter groups
|
|
691
|
-
def
|
|
691
|
+
def _flatiter(a):
|
|
692
692
|
for c in a:
|
|
693
693
|
if isinstance(c, tuple):
|
|
694
|
-
yield from
|
|
694
|
+
yield from _flatiter(c)
|
|
695
695
|
elif isinstance(c, wx.Object):
|
|
696
696
|
yield c
|
|
697
|
-
self.__groups.append(list(
|
|
697
|
+
self.__groups.append(list(_flatiter(objs)))
|
|
698
698
|
|
|
699
|
-
def
|
|
699
|
+
def _variter(a):
|
|
700
700
|
for c in a:
|
|
701
701
|
if isinstance(c, Knob):
|
|
702
702
|
yield c.param
|
|
703
703
|
elif hasattr(c, 'value'):
|
|
704
704
|
yield c
|
|
705
|
-
self.__params.append(list(
|
|
705
|
+
self.__params.append(list(_variter(objs)))
|
|
706
706
|
|
|
707
707
|
## Set appearance of the layout group
|
|
708
708
|
self.show(-1, visible)
|
|
@@ -877,12 +877,44 @@ if 1:
|
|
|
877
877
|
if isinstance(v, wx.lib.embeddedimage.PyEmbeddedImage)
|
|
878
878
|
}
|
|
879
879
|
|
|
880
|
-
|
|
881
|
-
"""Returns an iconic bitmap with the specified size (w,h).
|
|
880
|
+
class Icon(wx.Bitmap):
|
|
881
|
+
"""Returns an iconic bitmap with the specified size (w, h).
|
|
882
882
|
|
|
883
883
|
The key is either Icon.provided_arts or Icon.custom_images key.
|
|
884
884
|
If the key is empty it returns a transparent bitmap, otherwise NullBitmap.
|
|
885
|
+
|
|
886
|
+
Note:
|
|
887
|
+
A null (0-shaped) bitmap fails with AssertionError from 4.1.1
|
|
885
888
|
"""
|
|
889
|
+
provided_arts = _provided_arts
|
|
890
|
+
custom_images = _custom_images
|
|
891
|
+
|
|
892
|
+
def __init__(self, *args, **kwargs):
|
|
893
|
+
try:
|
|
894
|
+
bmp = _getBitmap1(*args, **kwargs)
|
|
895
|
+
except TypeError:
|
|
896
|
+
bmp = _getBitmap2(*args, **kwargs)
|
|
897
|
+
wx.Bitmap.__init__(self, bmp)
|
|
898
|
+
|
|
899
|
+
@staticmethod
|
|
900
|
+
def iconify(icon, w, h):
|
|
901
|
+
## if wx.VERSION >= (4,1,0):
|
|
902
|
+
try:
|
|
903
|
+
import wx.svg
|
|
904
|
+
import requests
|
|
905
|
+
url = "https://api.iconify.design/{}.svg".format(icon.replace(':', '/'))
|
|
906
|
+
res = requests.get(url, timeout=3.0)
|
|
907
|
+
img = wx.svg.SVGimage.CreateFromBytes(res.content)
|
|
908
|
+
bmp = img.ConvertToScaledBitmap(wx.Size(w, h))
|
|
909
|
+
except Exception:
|
|
910
|
+
print("- Failed to load iconify.design/{}".format(icon))
|
|
911
|
+
bmp = wx.NullBitmap
|
|
912
|
+
return bmp
|
|
913
|
+
|
|
914
|
+
Icon2 = Icon # for backward compatibility
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
def _getBitmap1(key, size=None):
|
|
886
918
|
if key:
|
|
887
919
|
try:
|
|
888
920
|
art = _custom_images.get(key) # None => AttributeError
|
|
@@ -907,20 +939,16 @@ def Icon(key, size=None):
|
|
|
907
939
|
del dc
|
|
908
940
|
bmp.SetMaskColour('black') # return dummy-sized blank bitmap
|
|
909
941
|
return bmp
|
|
910
|
-
|
|
911
942
|
return wx.NullBitmap # The standard wx controls accept this,
|
|
912
943
|
|
|
913
|
-
Icon.provided_arts = _provided_arts
|
|
914
|
-
Icon.custom_images = _custom_images
|
|
915
944
|
|
|
916
|
-
|
|
917
|
-
def Icon2(back, fore, size=None, subsize=0.6):
|
|
945
|
+
def _getBitmap2(back, fore, size=None, subsize=3/4):
|
|
918
946
|
if not size:
|
|
919
947
|
size = (16,16)
|
|
920
948
|
if isinstance(subsize, float):
|
|
921
949
|
subsize = wx.Size(size) * subsize
|
|
922
|
-
back =
|
|
923
|
-
fore =
|
|
950
|
+
back = _getBitmap1(back, size)
|
|
951
|
+
fore = _getBitmap1(fore, subsize)
|
|
924
952
|
x = size[0] - subsize[0]
|
|
925
953
|
y = size[1] - subsize[1]
|
|
926
954
|
dc = wx.MemoryDC(back)
|
|
@@ -929,21 +957,6 @@ def Icon2(back, fore, size=None, subsize=0.6):
|
|
|
929
957
|
return back
|
|
930
958
|
|
|
931
959
|
|
|
932
|
-
def Iconify(icon, w, h):
|
|
933
|
-
## if wx.VERSION >= (4,1,0):
|
|
934
|
-
try:
|
|
935
|
-
import wx.svg
|
|
936
|
-
import requests
|
|
937
|
-
url = "https://api.iconify.design/{}.svg".format(icon.replace(':', '/'))
|
|
938
|
-
res = requests.get(url, timeout=3.0)
|
|
939
|
-
img = wx.svg.SVGimage.CreateFromBytes(res.content)
|
|
940
|
-
bmp = img.ConvertToScaledBitmap(wx.Size(w, h))
|
|
941
|
-
return bmp
|
|
942
|
-
except Exception:
|
|
943
|
-
print("- Failed to load iconify.design/{}".format(icon))
|
|
944
|
-
pass
|
|
945
|
-
|
|
946
|
-
|
|
947
960
|
def _Icon(v):
|
|
948
961
|
if isinstance(v, (str, bytes)):
|
|
949
962
|
return Icon(v)
|
mwx/framework.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#! python3
|
|
2
2
|
"""mwxlib framework.
|
|
3
3
|
"""
|
|
4
|
-
__version__ = "0.
|
|
4
|
+
__version__ = "0.95.2"
|
|
5
5
|
__author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
|
|
6
6
|
|
|
7
7
|
from functools import wraps, partial
|
|
@@ -55,21 +55,17 @@ def deb(target=None, loop=True, locals=None, **kwargs):
|
|
|
55
55
|
kwargs.setdefault("execStartupScript", True)
|
|
56
56
|
kwargs.setdefault("ensureClose", True)
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
app = wx.GetApp() or wx.App()
|
|
59
|
+
try:
|
|
59
60
|
frame = ShellFrame(None, target, **kwargs)
|
|
60
61
|
frame.Show()
|
|
61
62
|
frame.rootshell.SetFocus()
|
|
62
63
|
if locals:
|
|
63
64
|
frame.rootshell.locals.update(locals)
|
|
64
65
|
return frame
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def App(loop=True):
|
|
69
|
-
app = wx.GetApp() or wx.App()
|
|
70
|
-
yield app
|
|
71
|
-
if loop and not app.GetMainLoop():
|
|
72
|
-
app.MainLoop()
|
|
66
|
+
finally:
|
|
67
|
+
if loop and not app.GetMainLoop():
|
|
68
|
+
app.MainLoop()
|
|
73
69
|
|
|
74
70
|
|
|
75
71
|
def postcall(f):
|
|
@@ -229,8 +225,8 @@ class KeyCtrlInterfaceMixin:
|
|
|
229
225
|
"""
|
|
230
226
|
assert isinstance(keymap, str)
|
|
231
227
|
|
|
232
|
-
def _Pass(
|
|
233
|
-
self.message("{} {}".format(keymap,
|
|
228
|
+
def _Pass(evt):
|
|
229
|
+
self.message("{} {}".format(keymap, evt.key))
|
|
234
230
|
_Pass.__name__ = str('pass')
|
|
235
231
|
|
|
236
232
|
state = self.handler.default_state
|
|
@@ -762,7 +758,7 @@ class Frame(wx.Frame, KeyCtrlInterfaceMixin):
|
|
|
762
758
|
evt.Skip()
|
|
763
759
|
self.Bind(wx.EVT_CHAR_HOOK, hook_char)
|
|
764
760
|
|
|
765
|
-
def close(
|
|
761
|
+
def close(evt):
|
|
766
762
|
"""Close the window."""
|
|
767
763
|
self.Close()
|
|
768
764
|
|
|
@@ -828,7 +824,7 @@ class MiniFrame(wx.MiniFrame, KeyCtrlInterfaceMixin):
|
|
|
828
824
|
## To default close >>> self.Unbind(wx.EVT_CLOSE)
|
|
829
825
|
self.Bind(wx.EVT_CLOSE, lambda v: self.Show(0))
|
|
830
826
|
|
|
831
|
-
def close(
|
|
827
|
+
def close(evt):
|
|
832
828
|
"""Close the window."""
|
|
833
829
|
self.Close()
|
|
834
830
|
|
|
@@ -1226,16 +1222,16 @@ class ShellFrame(MiniFrame):
|
|
|
1226
1222
|
evt.Skip()
|
|
1227
1223
|
self.Bind(wx.EVT_SIZE, on_size)
|
|
1228
1224
|
|
|
1229
|
-
def fork_debugger(
|
|
1225
|
+
def fork_debugger(evt):
|
|
1230
1226
|
"""Fork key events to the debugger."""
|
|
1231
|
-
self.debugger.handler(self.handler.current_event,
|
|
1227
|
+
self.debugger.handler(self.handler.current_event, evt)
|
|
1232
1228
|
if self.debugger.handler.current_state:
|
|
1233
1229
|
if self.debugger.tracing:
|
|
1234
1230
|
self.message("Current status is tracing. Press [C-g] to quit.")
|
|
1235
1231
|
elif not self.debugger.busy:
|
|
1236
1232
|
self.message("Current status is inconsistent. Press [C-g] to quit.")
|
|
1237
1233
|
self.indicator.Value = 7
|
|
1238
|
-
|
|
1234
|
+
evt.Skip()
|
|
1239
1235
|
|
|
1240
1236
|
self.handler.update({ # DNA<ShellFrame>
|
|
1241
1237
|
None : {
|
|
@@ -1703,8 +1699,9 @@ class ShellFrame(MiniFrame):
|
|
|
1703
1699
|
self.debugger.debug(obj, *args, **kwargs)
|
|
1704
1700
|
elif isinstance(obj, str):
|
|
1705
1701
|
filename = "<string>"
|
|
1706
|
-
|
|
1707
|
-
|
|
1702
|
+
editor = self.Scratch
|
|
1703
|
+
buf = editor.find_buffer(filename)\
|
|
1704
|
+
or editor.create_buffer(filename)
|
|
1708
1705
|
with buf.off_readonly():
|
|
1709
1706
|
buf.Text = obj
|
|
1710
1707
|
self.debugger.run(obj, filename)
|
|
@@ -1850,6 +1847,7 @@ class ShellFrame(MiniFrame):
|
|
|
1850
1847
|
buf.SetText(text)
|
|
1851
1848
|
## Overwrite text and popup the window.
|
|
1852
1849
|
self.popup_window(self.Help)
|
|
1850
|
+
self.Help.swap_page(buf)
|
|
1853
1851
|
|
|
1854
1852
|
def clone_shell(self, target):
|
|
1855
1853
|
if not hasattr(target, '__dict__'):
|
|
@@ -1888,7 +1886,7 @@ class ShellFrame(MiniFrame):
|
|
|
1888
1886
|
@property
|
|
1889
1887
|
def all_shells(self):
|
|
1890
1888
|
"""Yields all books in the notebooks."""
|
|
1891
|
-
|
|
1889
|
+
return self.console.get_pages(type(self.rootshell))
|
|
1892
1890
|
|
|
1893
1891
|
@property
|
|
1894
1892
|
def current_shell(self):
|
|
@@ -1898,7 +1896,7 @@ class ShellFrame(MiniFrame):
|
|
|
1898
1896
|
@property
|
|
1899
1897
|
def all_editors(self):
|
|
1900
1898
|
"""Yields all editors in the notebooks."""
|
|
1901
|
-
|
|
1899
|
+
return self.ghost.get_pages(type(self.Log))
|
|
1902
1900
|
|
|
1903
1901
|
@property
|
|
1904
1902
|
def current_editor(self):
|
|
@@ -1909,12 +1907,19 @@ class ShellFrame(MiniFrame):
|
|
|
1909
1907
|
return next((x for x in self.all_editors if x.IsShown()), self.Scratch)
|
|
1910
1908
|
|
|
1911
1909
|
def find_editor(self, fn):
|
|
1912
|
-
"""Find an editor
|
|
1913
|
-
|
|
1910
|
+
"""Find an editor with the specified fn:filename or code.
|
|
1911
|
+
If found, switch to the buffer page.
|
|
1912
|
+
"""
|
|
1913
|
+
return next(self.find_editors(fn), None)
|
|
1914
|
+
|
|
1915
|
+
def find_editors(self, fn):
|
|
1916
|
+
"""Yields all editors with the specified fn:filename or code."""
|
|
1917
|
+
def _f(book):
|
|
1914
1918
|
buf = book.find_buffer(fn)
|
|
1915
1919
|
if buf:
|
|
1916
1920
|
book.swap_page(buf)
|
|
1917
|
-
|
|
1921
|
+
return buf
|
|
1922
|
+
return filter(_f, self.all_editors)
|
|
1918
1923
|
|
|
1919
1924
|
## --------------------------------
|
|
1920
1925
|
## Find text dialog
|
mwx/graphman.py
CHANGED
|
@@ -382,24 +382,8 @@ class LayerInterface(CtrlInterface):
|
|
|
382
382
|
self.Bind(wx.EVT_CONTEXT_MENU,
|
|
383
383
|
lambda v: mwx.Menu.Popup(self, self.menu))
|
|
384
384
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if self.thread and self.thread.active:
|
|
388
|
-
self.thread.active = 0
|
|
389
|
-
self.thread.Stop()
|
|
390
|
-
del self.Arts
|
|
391
|
-
v.Skip()
|
|
392
|
-
self.Bind(wx.EVT_WINDOW_DESTROY, destroy)
|
|
393
|
-
|
|
394
|
-
def on_show(v):
|
|
395
|
-
if not self:
|
|
396
|
-
return
|
|
397
|
-
if v.IsShown():
|
|
398
|
-
self.handler('page_shown', self)
|
|
399
|
-
elif isinstance(self.Parent, aui.AuiNotebook):
|
|
400
|
-
self.handler('page_hidden', self)
|
|
401
|
-
v.Skip()
|
|
402
|
-
self.Bind(wx.EVT_SHOW, on_show)
|
|
385
|
+
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
|
386
|
+
self.Bind(wx.EVT_SHOW, self.OnShow)
|
|
403
387
|
|
|
404
388
|
try:
|
|
405
389
|
self.Init()
|
|
@@ -431,6 +415,23 @@ class LayerInterface(CtrlInterface):
|
|
|
431
415
|
if self.parameters:
|
|
432
416
|
session['params'] = self.parameters
|
|
433
417
|
|
|
418
|
+
def OnDestroy(self, evt):
|
|
419
|
+
if evt.EventObject is self:
|
|
420
|
+
if self.thread and self.thread.active:
|
|
421
|
+
self.thread.active = 0
|
|
422
|
+
self.thread.Stop()
|
|
423
|
+
del self.Arts
|
|
424
|
+
evt.Skip()
|
|
425
|
+
|
|
426
|
+
def OnShow(self, evt):
|
|
427
|
+
if not self:
|
|
428
|
+
return
|
|
429
|
+
if evt.IsShown():
|
|
430
|
+
self.handler('page_shown', self)
|
|
431
|
+
elif isinstance(self.Parent, aui.AuiNotebook):
|
|
432
|
+
self.handler('page_hidden', self)
|
|
433
|
+
evt.Skip()
|
|
434
|
+
|
|
434
435
|
Shown = property(
|
|
435
436
|
lambda self: self.IsShown(),
|
|
436
437
|
lambda self,v: self.Show(v))
|
|
@@ -540,8 +541,11 @@ class Graph(GraphPlot):
|
|
|
540
541
|
|
|
541
542
|
def set_frame_visible(self, v):
|
|
542
543
|
if self.frame:
|
|
543
|
-
self.frame.
|
|
544
|
-
|
|
544
|
+
if self.frame.get_visible() != v:
|
|
545
|
+
self.frame.set_visible(v)
|
|
546
|
+
return True
|
|
547
|
+
return False
|
|
548
|
+
return None
|
|
545
549
|
|
|
546
550
|
def get_markups_visible(self):
|
|
547
551
|
return self.marked.get_visible()
|
|
@@ -728,10 +732,6 @@ class Frame(mwx.Frame):
|
|
|
728
732
|
(wx.ID_PASTE, "&Paste\t(C-v)", "Paste buffer from clipboard", Icon('paste'),
|
|
729
733
|
lambda v: self.__view.read_buffer_from_clipboard()),
|
|
730
734
|
(),
|
|
731
|
-
(mwx.ID_(20), "Show &Image", "Show/Hide image", wx.ITEM_CHECK, Icon('image'),
|
|
732
|
-
lambda v: self.__view.set_frame_visible(v.IsChecked()),
|
|
733
|
-
lambda v: v.Check(self.__view.get_frame_visible())),
|
|
734
|
-
|
|
735
735
|
(mwx.ID_(21), "Toggle &Markers", "Show/Hide markups", wx.ITEM_CHECK, Icon('+'),
|
|
736
736
|
lambda v: self.__view.set_markups_visible(v.IsChecked()),
|
|
737
737
|
lambda v: v.Check(self.__view.get_markups_visible())),
|
|
@@ -806,21 +806,31 @@ class Frame(mwx.Frame):
|
|
|
806
806
|
})
|
|
807
807
|
|
|
808
808
|
## Add main-menu to context-menu
|
|
809
|
-
self.graph.menu += self.menubar["Edit"][2:
|
|
810
|
-
self.output.menu += self.menubar["Edit"][2:
|
|
809
|
+
self.graph.menu += self.menubar["Edit"][2:7]
|
|
810
|
+
self.output.menu += self.menubar["Edit"][2:7]
|
|
811
811
|
|
|
812
812
|
self._mgr.Bind(aui.EVT_AUI_PANE_CLOSE, self.OnPaneClose)
|
|
813
813
|
|
|
814
814
|
self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
|
|
815
815
|
self.Bind(wx.EVT_CLOSE, self.OnClose)
|
|
816
816
|
|
|
817
|
+
def on_move(evt, show):
|
|
818
|
+
self.graph.set_frame_visible(show)
|
|
819
|
+
self.output.set_frame_visible(show)
|
|
820
|
+
if show:
|
|
821
|
+
self.graph.draw()
|
|
822
|
+
self.output.draw()
|
|
823
|
+
evt.Skip()
|
|
824
|
+
self.Bind(wx.EVT_MOVE_START, lambda v :on_move(v, show=0))
|
|
825
|
+
self.Bind(wx.EVT_MOVE_END, lambda v :on_move(v, show=1))
|
|
826
|
+
|
|
817
827
|
## Custom Key Bindings
|
|
818
828
|
self.define_key('* C-g', self.Quit)
|
|
819
829
|
|
|
820
830
|
@self.shellframe.define_key('* C-g')
|
|
821
|
-
def quit(
|
|
831
|
+
def quit(evt):
|
|
822
832
|
"""Dispatch quit to the main Frame."""
|
|
823
|
-
self.handler('C-g pressed',
|
|
833
|
+
self.handler('C-g pressed', evt)
|
|
824
834
|
|
|
825
835
|
## Accepts DnD
|
|
826
836
|
self.SetDropTarget(MyFileDropLoader(self.graph, self))
|
|
@@ -1305,7 +1315,7 @@ class Frame(mwx.Frame):
|
|
|
1305
1315
|
nb = plug.Parent
|
|
1306
1316
|
j = nb.GetPageIndex(plug)
|
|
1307
1317
|
nb.RemovePage(j) # just remove page
|
|
1308
|
-
## nb.DeletePage(j) #
|
|
1318
|
+
## nb.DeletePage(j) # Destroys plug object too.
|
|
1309
1319
|
else:
|
|
1310
1320
|
nb = None
|
|
1311
1321
|
self._mgr.DetachPane(plug)
|
|
@@ -1366,6 +1376,7 @@ class Frame(mwx.Frame):
|
|
|
1366
1376
|
plug = _plug
|
|
1367
1377
|
init(shell)
|
|
1368
1378
|
self.shellframe.Show()
|
|
1379
|
+
self.shellframe.load(plug)
|
|
1369
1380
|
|
|
1370
1381
|
def OnLoadPlugins(self, evt):
|
|
1371
1382
|
with wx.FileDialog(self, "Load a plugin file",
|
|
@@ -1804,14 +1815,18 @@ class Frame(mwx.Frame):
|
|
|
1804
1815
|
o.write("self.load_plug({!r}, session={})\n".format(path, session or None))
|
|
1805
1816
|
o.write("self._mgr.LoadPerspective({!r})\n".format(self._mgr.SavePerspective()))
|
|
1806
1817
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
o.write("self.
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1818
|
+
def _save(view):
|
|
1819
|
+
name = view.Name
|
|
1820
|
+
paths = [x.pathname for x in view.all_frames if x.pathname]
|
|
1821
|
+
o.write(f"self.{name}.unit = {view.unit:g}\n")
|
|
1822
|
+
o.write(f"self.load_frame({paths!r}, self.{name})\n")
|
|
1823
|
+
try:
|
|
1824
|
+
index = paths.index(view.frame.pathname)
|
|
1825
|
+
o.write(f"self.{name}.select({index})\n")
|
|
1826
|
+
except Exception:
|
|
1827
|
+
pass
|
|
1828
|
+
|
|
1829
|
+
_save(self.graph)
|
|
1830
|
+
_save(self.output)
|
|
1816
1831
|
|
|
1817
1832
|
self.message("\b done.")
|
mwx/matplot2.py
CHANGED
|
@@ -143,9 +143,9 @@ class MatplotPanel(wx.Panel):
|
|
|
143
143
|
## The context menus is disabled and never skip to the next handler.
|
|
144
144
|
self.canvas.Bind(wx.EVT_CONTEXT_MENU, lambda v: self.handler('context_menu', v))
|
|
145
145
|
|
|
146
|
-
def fork(
|
|
147
|
-
if self.handler.fork(self.handler.current_event,
|
|
148
|
-
|
|
146
|
+
def fork(evt):
|
|
147
|
+
if self.handler.fork(self.handler.current_event, evt) is None:
|
|
148
|
+
evt.Skip()
|
|
149
149
|
|
|
150
150
|
self.__handler = mwx.FSM({ # DNA<MatplotPanel>
|
|
151
151
|
None : {
|
|
@@ -446,6 +446,7 @@ class MatplotPanel(wx.Panel):
|
|
|
446
446
|
x, y = [x], [y]
|
|
447
447
|
self.selected.set_visible(1)
|
|
448
448
|
self.selected.set_data(x, y)
|
|
449
|
+
self.handler('selector_drawn', self.frame)
|
|
449
450
|
self.draw(self.selected)
|
|
450
451
|
self.trace_point(*v)
|
|
451
452
|
|
|
@@ -453,6 +454,7 @@ class MatplotPanel(wx.Panel):
|
|
|
453
454
|
def Selector(self):
|
|
454
455
|
self.selected.set_visible(0)
|
|
455
456
|
self.selected.set_data([], [])
|
|
457
|
+
self.handler('selector_removed', self.frame)
|
|
456
458
|
self.draw(self.selected)
|
|
457
459
|
|
|
458
460
|
## --------------------------------
|
mwx/matplot2g.py
CHANGED
|
@@ -327,7 +327,7 @@ class AxesImagePhantom(object):
|
|
|
327
327
|
"""Convert xydata (x,y) -> [nx,ny] pixel.
|
|
328
328
|
If cast, convert pixel-based lengths to pixel numbers.
|
|
329
329
|
"""
|
|
330
|
-
def
|
|
330
|
+
def _cast(n):
|
|
331
331
|
return np.int32(np.floor(np.round(n, 1)))
|
|
332
332
|
if y is None:
|
|
333
333
|
warnings.warn("Setting xy data with single tuple is deprecated.",
|
|
@@ -341,7 +341,7 @@ class AxesImagePhantom(object):
|
|
|
341
341
|
nx = (x - l) / ux
|
|
342
342
|
ny = (t - y) / uy # Y ピクセルインデクスは座標と逆
|
|
343
343
|
if cast:
|
|
344
|
-
return (
|
|
344
|
+
return (_cast(nx), _cast(ny))
|
|
345
345
|
return (nx-0.5, ny-0.5)
|
|
346
346
|
|
|
347
347
|
def xyfrompixel(self, nx, ny=None):
|
|
@@ -393,7 +393,7 @@ class GraphPlot(MatplotPanel):
|
|
|
393
393
|
def __init__(self, *args, **kwargs):
|
|
394
394
|
MatplotPanel.__init__(self, *args, **kwargs)
|
|
395
395
|
|
|
396
|
-
def _draw(
|
|
396
|
+
def _draw(evt):
|
|
397
397
|
self.canvas.draw_idle()
|
|
398
398
|
|
|
399
399
|
self.handler.update({ # DNA<GraphPlot>
|
|
@@ -780,7 +780,7 @@ class GraphPlot(MatplotPanel):
|
|
|
780
780
|
def index(self, j):
|
|
781
781
|
if isinstance(j, str):
|
|
782
782
|
names = [art.name for art in self.__Arts]
|
|
783
|
-
return names.index(j)
|
|
783
|
+
return names.index(j)
|
|
784
784
|
return self.__Arts.index(j)
|
|
785
785
|
|
|
786
786
|
def find_frame(self, j):
|
mwx/matplot2lg.py
CHANGED
|
@@ -98,8 +98,7 @@ class LinePlot(MatplotPanel):
|
|
|
98
98
|
self.__annotations = []
|
|
99
99
|
|
|
100
100
|
#<matplotlib.text.Annotation>
|
|
101
|
-
def
|
|
102
|
-
textcoords='offset points', **arrowprops):
|
|
101
|
+
def _A(v, xy, xytext, xycoords='data', textcoords='offset points', **arrowprops):
|
|
103
102
|
return self.axes.annotate(
|
|
104
103
|
'' if v is None else '{:g}'.format(v),
|
|
105
104
|
xy, xytext, xycoords, textcoords, arrowprops, size='small')
|
|
@@ -109,14 +108,14 @@ class LinePlot(MatplotPanel):
|
|
|
109
108
|
x = (b + a) / 2
|
|
110
109
|
y = self.ylim[0] + 20/self.ddpu[1]
|
|
111
110
|
if (b - a) > 60/self.ddpu[0]:
|
|
112
|
-
p =
|
|
111
|
+
p = _A(b-a, (x,y), (-20,8), arrowstyle='-') # wide space
|
|
113
112
|
else:
|
|
114
|
-
p =
|
|
113
|
+
p = _A(b-a, (x,y), (16,16), arrowstyle='-', # narrow space
|
|
115
114
|
connectionstyle="angle,angleA=0,angleB=90,rad=8")
|
|
116
115
|
self.__annotations = [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
_A(a, (a,y), (-54,-3), arrowstyle='->'),
|
|
117
|
+
_A(b, (b,y), ( 16,-3), arrowstyle='->'),
|
|
118
|
+
_A(None, (a,y), (b,y), textcoords='data', arrowstyle='<->'),
|
|
120
119
|
p,
|
|
121
120
|
]
|
|
122
121
|
|
|
@@ -232,11 +231,12 @@ class Histogram(LinePlot):
|
|
|
232
231
|
}
|
|
233
232
|
self.modeline.Show(0)
|
|
234
233
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
234
|
+
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
|
235
|
+
|
|
236
|
+
def OnDestroy(self, evt):
|
|
237
|
+
for graph in self.__graphs:
|
|
238
|
+
self.detach(graph)
|
|
239
|
+
evt.Skip()
|
|
240
240
|
|
|
241
241
|
def clear(self):
|
|
242
242
|
LinePlot.clear(self)
|
|
@@ -450,11 +450,12 @@ class LineProfile(LinePlot):
|
|
|
450
450
|
lambda v: v.Check(not self.__logicp)),
|
|
451
451
|
]
|
|
452
452
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
453
|
+
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
|
454
|
+
|
|
455
|
+
def OnDestroy(self, evt):
|
|
456
|
+
for graph in self.__graphs:
|
|
457
|
+
self.detach(graph)
|
|
458
|
+
evt.Skip()
|
|
458
459
|
|
|
459
460
|
def clear(self):
|
|
460
461
|
LinePlot.clear(self)
|
mwx/nutshell.py
CHANGED
|
@@ -79,9 +79,9 @@ class EditorInterface(CtrlInterface):
|
|
|
79
79
|
def __init__(self):
|
|
80
80
|
CtrlInterface.__init__(self)
|
|
81
81
|
|
|
82
|
-
def dispatch(
|
|
82
|
+
def dispatch(evt):
|
|
83
83
|
"""Fork events to the parent."""
|
|
84
|
-
self.parent.handler(self.handler.current_event,
|
|
84
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
85
85
|
|
|
86
86
|
self.make_keymap('C-x')
|
|
87
87
|
self.make_keymap('C-c')
|
|
@@ -1476,19 +1476,19 @@ class Buffer(EditWindow, EditorInterface):
|
|
|
1476
1476
|
self.Bind(stc.EVT_STC_SAVEPOINTLEFT, self.OnSavePointLeft)
|
|
1477
1477
|
self.Bind(stc.EVT_STC_SAVEPOINTREACHED, self.OnSavePointReached)
|
|
1478
1478
|
|
|
1479
|
-
def activate(
|
|
1479
|
+
def activate(evt):
|
|
1480
1480
|
self.handler('buffer_activated', self)
|
|
1481
|
-
|
|
1481
|
+
evt.Skip()
|
|
1482
1482
|
self.Bind(wx.EVT_SET_FOCUS, activate)
|
|
1483
1483
|
|
|
1484
|
-
def inactivate(
|
|
1484
|
+
def inactivate(evt):
|
|
1485
1485
|
self.handler('buffer_inactivated', self)
|
|
1486
|
-
|
|
1486
|
+
evt.Skip()
|
|
1487
1487
|
self.Bind(wx.EVT_KILL_FOCUS, inactivate)
|
|
1488
1488
|
|
|
1489
|
-
def dispatch(
|
|
1489
|
+
def dispatch(evt):
|
|
1490
1490
|
"""Fork events to the parent."""
|
|
1491
|
-
self.parent.handler(self.handler.current_event,
|
|
1491
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
1492
1492
|
|
|
1493
1493
|
## Note: Key events are not propagated from Buffer to EditorBook.
|
|
1494
1494
|
## They are explicitly dispatched from buffer.handler to editor.handler.
|
|
@@ -1544,10 +1544,14 @@ class Buffer(EditWindow, EditorInterface):
|
|
|
1544
1544
|
if self.IndicatorValueAt(2, pos):
|
|
1545
1545
|
p = self.IndicatorStart(2, pos)
|
|
1546
1546
|
q = self.IndicatorEnd(2, pos)
|
|
1547
|
-
|
|
1548
|
-
self.message("URL {!r}".format(
|
|
1549
|
-
|
|
1550
|
-
|
|
1547
|
+
url = self.GetTextRange(p, q).strip()
|
|
1548
|
+
self.message("URL {!r}".format(url))
|
|
1549
|
+
if wx.GetKeyState(wx.WXK_SHIFT):
|
|
1550
|
+
## Note: post-call for the confirmation dialog.
|
|
1551
|
+
wx.CallAfter(self.parent.load_file, url)
|
|
1552
|
+
else:
|
|
1553
|
+
import webbrowser
|
|
1554
|
+
return webbrowser.open(url)
|
|
1551
1555
|
self.anchor = pos # Clear selection
|
|
1552
1556
|
|
|
1553
1557
|
def on_modified(self, buf):
|
|
@@ -1747,16 +1751,11 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
1747
1751
|
self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnPageClose)
|
|
1748
1752
|
self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.OnPageClosed)
|
|
1749
1753
|
|
|
1750
|
-
|
|
1751
|
-
obj = v.EventObject
|
|
1752
|
-
if isinstance(obj, Buffer):
|
|
1753
|
-
self.handler('buffer_deleted', obj)
|
|
1754
|
-
v.Skip()
|
|
1755
|
-
self.Bind(wx.EVT_WINDOW_DESTROY, destroy)
|
|
1754
|
+
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
|
1756
1755
|
|
|
1757
|
-
def dispatch(
|
|
1756
|
+
def dispatch(evt):
|
|
1758
1757
|
"""Fork events to the parent."""
|
|
1759
|
-
self.parent.handler(self.handler.current_event,
|
|
1758
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
1760
1759
|
|
|
1761
1760
|
self.make_keymap('C-x')
|
|
1762
1761
|
self.make_keymap('C-c')
|
|
@@ -1780,6 +1779,12 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
1780
1779
|
},
|
|
1781
1780
|
})
|
|
1782
1781
|
|
|
1782
|
+
def OnDestroy(self, evt):
|
|
1783
|
+
obj = evt.EventObject
|
|
1784
|
+
if isinstance(obj, Buffer):
|
|
1785
|
+
self.handler('buffer_deleted', obj)
|
|
1786
|
+
evt.Skip()
|
|
1787
|
+
|
|
1783
1788
|
def OnPageClose(self, evt): #<wx._aui.AuiNotebookEvent>
|
|
1784
1789
|
nb = evt.EventObject
|
|
1785
1790
|
buf = nb.all_buffers[evt.Selection]
|
|
@@ -1962,6 +1967,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
1962
1967
|
|
|
1963
1968
|
def load_file(self, filename, lineno=0, verbose=True):
|
|
1964
1969
|
"""Load a file into an existing or new buffer.
|
|
1970
|
+
The requests module is required to use URL extension.
|
|
1965
1971
|
"""
|
|
1966
1972
|
buf = self.find_buffer(filename)
|
|
1967
1973
|
if not buf:
|
|
@@ -1979,8 +1985,6 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
1979
1985
|
self.swap_buffer(buf, lineno)
|
|
1980
1986
|
return True
|
|
1981
1987
|
try:
|
|
1982
|
-
self.Freeze()
|
|
1983
|
-
org = self.buffer
|
|
1984
1988
|
if re.match(url_re, filename):
|
|
1985
1989
|
import requests
|
|
1986
1990
|
res = requests.get(filename, timeout=3.0)
|
|
@@ -1988,27 +1992,34 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
1988
1992
|
buf._load_textfile(res.text, filename)
|
|
1989
1993
|
self.swap_buffer(buf, lineno)
|
|
1990
1994
|
return True
|
|
1991
|
-
return False
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1995
|
+
## return False
|
|
1996
|
+
raise Exception("The requested URL was not found.")
|
|
1997
|
+
if buf._load_file(filename):
|
|
1998
|
+
self.swap_buffer(buf, lineno)
|
|
1999
|
+
return True
|
|
2000
|
+
return False
|
|
1997
2001
|
except Exception as e:
|
|
1998
2002
|
self.post_message(f"Failed to load {filename!r}:", e)
|
|
1999
2003
|
self.delete_buffer(buf)
|
|
2000
|
-
if org:
|
|
2001
|
-
self.swap_buffer(org)
|
|
2002
2004
|
return False
|
|
2003
|
-
finally:
|
|
2004
|
-
self.Thaw()
|
|
2005
2005
|
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2006
|
+
load_url = load_file # for backward compatibility
|
|
2007
|
+
|
|
2008
|
+
def find_file(self, filename=None):
|
|
2009
|
+
"""Open the specified file."""
|
|
2010
|
+
if not filename:
|
|
2011
|
+
with wx.FileDialog(self, "Open buffer",
|
|
2012
|
+
wildcard='|'.join(self.wildcards),
|
|
2013
|
+
style=wx.FD_OPEN|wx.FD_MULTIPLE) as dlg:
|
|
2014
|
+
if dlg.ShowModal() == wx.ID_OK:
|
|
2015
|
+
for fn in dlg.Paths:
|
|
2016
|
+
self.find_file(fn)
|
|
2017
|
+
return
|
|
2018
|
+
if not self.load_file(filename):
|
|
2019
|
+
buf = self.create_buffer(filename)
|
|
2020
|
+
self.swap_buffer(buf)
|
|
2021
|
+
|
|
2022
|
+
open_buffer = find_file # for backward compatibility
|
|
2012
2023
|
|
|
2013
2024
|
def save_file(self, filename, buf=None, verbose=True):
|
|
2014
2025
|
"""Save the current buffer to a file.
|
|
@@ -2075,16 +2086,6 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2075
2086
|
if buf.need_buffer_save:
|
|
2076
2087
|
self.save_buffer(buf)
|
|
2077
2088
|
|
|
2078
|
-
def open_buffer(self):
|
|
2079
|
-
"""Confirm the open with the dialog."""
|
|
2080
|
-
with wx.FileDialog(self, "Open buffer",
|
|
2081
|
-
wildcard='|'.join(self.wildcards),
|
|
2082
|
-
style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST
|
|
2083
|
-
|wx.FD_MULTIPLE) as dlg:
|
|
2084
|
-
if dlg.ShowModal() == wx.ID_OK:
|
|
2085
|
-
for fn in dlg.Paths:
|
|
2086
|
-
self.load_file(fn)
|
|
2087
|
-
|
|
2088
2089
|
def kill_buffer(self, buf=None):
|
|
2089
2090
|
"""Confirm the close with the dialog."""
|
|
2090
2091
|
buf = buf or self.buffer
|
|
@@ -2362,38 +2363,23 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2362
2363
|
|
|
2363
2364
|
self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdate) # skip to brace matching
|
|
2364
2365
|
self.Bind(stc.EVT_STC_CALLTIP_CLICK, self.OnCallTipClick)
|
|
2366
|
+
self.Bind(stc.EVT_STC_START_DRAG, self.OnDrag)
|
|
2367
|
+
self.Bind(stc.EVT_STC_DRAG_OVER, self.OnDragging)
|
|
2368
|
+
self.Bind(stc.EVT_STC_DO_DROP, self.OnDragging)
|
|
2369
|
+
|
|
2370
|
+
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
|
2365
2371
|
|
|
2366
|
-
def
|
|
2367
|
-
EditorInterface.dnd_flag = (v.Position < self.bolc) # copy
|
|
2368
|
-
v.Skip()
|
|
2369
|
-
self.Bind(stc.EVT_STC_START_DRAG, on_drag)
|
|
2370
|
-
|
|
2371
|
-
def on_dragging(v): #<wx._core.StyledTextEvent>
|
|
2372
|
-
if v.Position < self.bolc:
|
|
2373
|
-
v.DragResult = wx.DragNone # Don't drop (as readonly)
|
|
2374
|
-
elif EditorInterface.dnd_flag:
|
|
2375
|
-
v.DragResult = wx.DragCopy # Don't move
|
|
2376
|
-
v.Skip()
|
|
2377
|
-
self.Bind(stc.EVT_STC_DRAG_OVER, on_dragging)
|
|
2378
|
-
self.Bind(stc.EVT_STC_DO_DROP, on_dragging)
|
|
2379
|
-
|
|
2380
|
-
def destroy(v):
|
|
2381
|
-
if v.EventObject is self:
|
|
2382
|
-
self.handler('shell_deleted', self)
|
|
2383
|
-
v.Skip()
|
|
2384
|
-
self.Bind(wx.EVT_WINDOW_DESTROY, destroy)
|
|
2385
|
-
|
|
2386
|
-
def activate(v):
|
|
2372
|
+
def activate(evt):
|
|
2387
2373
|
self.handler('shell_activated', self)
|
|
2388
|
-
|
|
2374
|
+
evt.Skip()
|
|
2389
2375
|
self.Bind(wx.EVT_SET_FOCUS, activate)
|
|
2390
2376
|
|
|
2391
|
-
def inactivate(
|
|
2377
|
+
def inactivate(evt):
|
|
2392
2378
|
self.handler('shell_inactivated', self)
|
|
2393
|
-
|
|
2379
|
+
evt.Skip()
|
|
2394
2380
|
self.Bind(wx.EVT_KILL_FOCUS, inactivate)
|
|
2395
2381
|
|
|
2396
|
-
def clear(
|
|
2382
|
+
def clear(evt):
|
|
2397
2383
|
## """Clear selection and message, no skip."""
|
|
2398
2384
|
## *do not* clear autocomp, so that the event can skip to AutoComp properly.
|
|
2399
2385
|
## if self.AutoCompActive():
|
|
@@ -2402,7 +2388,7 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2402
2388
|
self.ReplaceSelection("")
|
|
2403
2389
|
self.message("")
|
|
2404
2390
|
|
|
2405
|
-
def clear_autocomp(
|
|
2391
|
+
def clear_autocomp(evt):
|
|
2406
2392
|
## """Clear Autocomp, selection, and message."""
|
|
2407
2393
|
if self.AutoCompActive():
|
|
2408
2394
|
self.AutoCompCancel()
|
|
@@ -2410,20 +2396,20 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2410
2396
|
self.ReplaceSelection("")
|
|
2411
2397
|
self.message("")
|
|
2412
2398
|
|
|
2413
|
-
def skip_autocomp(
|
|
2399
|
+
def skip_autocomp(evt):
|
|
2414
2400
|
## """Don't eat backward prompt whitespace."""
|
|
2415
2401
|
## Prevent autocomp from eating prompts.
|
|
2416
2402
|
## Quit to avoid backspace over the last non-continuation prompt.
|
|
2417
2403
|
if self.cpos == self.bolc:
|
|
2418
|
-
self.handler('quit',
|
|
2419
|
-
|
|
2404
|
+
self.handler('quit', evt)
|
|
2405
|
+
evt.Skip()
|
|
2420
2406
|
|
|
2421
|
-
def fork(
|
|
2422
|
-
self.handler.fork(self.handler.current_event,
|
|
2407
|
+
def fork(evt):
|
|
2408
|
+
self.handler.fork(self.handler.current_event, evt)
|
|
2423
2409
|
|
|
2424
|
-
def dispatch(
|
|
2410
|
+
def dispatch(evt):
|
|
2425
2411
|
"""Fork events to the parent."""
|
|
2426
|
-
self.parent.handler(self.handler.current_event,
|
|
2412
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
2427
2413
|
|
|
2428
2414
|
self.handler.update({ # DNA<Nautilus>
|
|
2429
2415
|
None : {
|
|
@@ -2646,6 +2632,11 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2646
2632
|
_text, lp = self.CurLine
|
|
2647
2633
|
self.message("{:>6d}:{} ({})".format(self.cline, lp, self.cpos), pane=-1)
|
|
2648
2634
|
|
|
2635
|
+
def OnDestroy(self, evt):
|
|
2636
|
+
if evt.EventObject is self:
|
|
2637
|
+
self.handler('shell_deleted', self)
|
|
2638
|
+
evt.Skip()
|
|
2639
|
+
|
|
2649
2640
|
def OnUpdate(self, evt): #<wx._stc.StyledTextEvent>
|
|
2650
2641
|
if evt.Updated & (stc.STC_UPDATE_SELECTION | stc.STC_UPDATE_CONTENT):
|
|
2651
2642
|
self.trace_position()
|
|
@@ -2667,6 +2658,17 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2667
2658
|
self.CallTipCancel()
|
|
2668
2659
|
evt.Skip()
|
|
2669
2660
|
|
|
2661
|
+
def OnDrag(self, evt): #<wx._core.StyledTextEvent>
|
|
2662
|
+
EditorInterface.dnd_flag = (evt.Position < self.bolc) # copy
|
|
2663
|
+
evt.Skip()
|
|
2664
|
+
|
|
2665
|
+
def OnDragging(self, evt): #<wx._core.StyledTextEvent>
|
|
2666
|
+
if evt.Position < self.bolc:
|
|
2667
|
+
evt.DragResult = wx.DragNone # Don't drop (as readonly)
|
|
2668
|
+
elif EditorInterface.dnd_flag:
|
|
2669
|
+
evt.DragResult = wx.DragCopy # Don't move
|
|
2670
|
+
evt.Skip()
|
|
2671
|
+
|
|
2670
2672
|
def OnSpace(self, evt):
|
|
2671
2673
|
"""Called when space pressed."""
|
|
2672
2674
|
if not self.CanEdit():
|
mwx/plugins/frame_listview.py
CHANGED
|
@@ -7,7 +7,7 @@ from wx import aui
|
|
|
7
7
|
from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin
|
|
8
8
|
|
|
9
9
|
from mwx.framework import CtrlInterface, Menu, StatusBar
|
|
10
|
-
from mwx.controls import Icon,
|
|
10
|
+
from mwx.controls import Icon, Clipboard
|
|
11
11
|
from mwx.graphman import Layer
|
|
12
12
|
|
|
13
13
|
|
|
@@ -97,7 +97,7 @@ class CheckList(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
97
97
|
}
|
|
98
98
|
self.Target.handler.append(self.context)
|
|
99
99
|
|
|
100
|
-
def
|
|
100
|
+
def copy_info(all=True):
|
|
101
101
|
frames = self.Target.all_frames
|
|
102
102
|
if frames:
|
|
103
103
|
frame = frames[self.focused_item]
|
|
@@ -112,11 +112,11 @@ class CheckList(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
112
112
|
self.OnEditAnnotation),
|
|
113
113
|
(),
|
|
114
114
|
(102, "Copy info", Icon('copy'),
|
|
115
|
-
lambda v:
|
|
115
|
+
lambda v: copy_info(0),
|
|
116
116
|
lambda v: v.Enable(len(list(self.selected_items)))),
|
|
117
117
|
|
|
118
|
-
(103, "Copy ALL data",
|
|
119
|
-
lambda v:
|
|
118
|
+
(103, "Copy ALL data", Icon('copy', '+'),
|
|
119
|
+
lambda v: copy_info(1),
|
|
120
120
|
lambda v: v.Enable(len(list(self.selected_items)))),
|
|
121
121
|
]
|
|
122
122
|
self.Bind(wx.EVT_CONTEXT_MENU,
|
|
@@ -266,10 +266,9 @@ class Plugin(Layer):
|
|
|
266
266
|
expand=2, border=0, vspacing=0,
|
|
267
267
|
)
|
|
268
268
|
|
|
269
|
-
def on_focus_set(
|
|
269
|
+
def on_focus_set(evt):
|
|
270
270
|
self.parent.select_view(self.nb.CurrentPage.Target)
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
evt.Skip()
|
|
273
272
|
self.nb.Bind(wx.EVT_CHILD_FOCUS, on_focus_set)
|
|
274
273
|
|
|
275
274
|
def attach(self, target, caption):
|
mwx/plugins/line_profile.py
CHANGED
|
@@ -18,10 +18,10 @@ class Plugin(Layer):
|
|
|
18
18
|
self.layout((self.plot,), expand=2, border=0)
|
|
19
19
|
|
|
20
20
|
@self.handler.bind('page_shown')
|
|
21
|
-
def activate(
|
|
21
|
+
def activate(evt):
|
|
22
22
|
self.plot.attach(*self.parent.graphic_windows)
|
|
23
23
|
self.plot.linplot(self.parent.selected_view.frame)
|
|
24
24
|
|
|
25
25
|
@self.handler.bind('page_closed')
|
|
26
|
-
def deactivate(
|
|
26
|
+
def deactivate(evt):
|
|
27
27
|
self.plot.detach(*self.parent.graphic_windows)
|
mwx/utilus.py
CHANGED
|
@@ -483,13 +483,13 @@ class SSM(dict):
|
|
|
483
483
|
return "<{} object at 0x{:X}>".format(self.__class__.__name__, id(self))
|
|
484
484
|
|
|
485
485
|
def __str__(self):
|
|
486
|
-
def
|
|
486
|
+
def _lstr(v):
|
|
487
487
|
def _name(a):
|
|
488
488
|
if callable(a):
|
|
489
489
|
return typename(a, docp=1, qualp=0)
|
|
490
490
|
return repr(a)
|
|
491
491
|
return ', '.join(_name(a) for a in v)
|
|
492
|
-
return '\n'.join("{:>32} : {}".format(str(k),
|
|
492
|
+
return '\n'.join("{:>32} : {}".format(str(k), _lstr(v)) for k, v in self.items())
|
|
493
493
|
|
|
494
494
|
def bind(self, event, action=None):
|
|
495
495
|
"""Append a transaction to the context."""
|
mwx/wxmon.py
CHANGED
|
@@ -58,13 +58,13 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
58
58
|
|
|
59
59
|
@self.handler.bind('*button* pressed')
|
|
60
60
|
@self.handler.bind('*button* released')
|
|
61
|
-
def dispatch(
|
|
61
|
+
def dispatch(evt):
|
|
62
62
|
"""Fork events to the parent."""
|
|
63
|
-
self.parent.handler(self.handler.current_event,
|
|
64
|
-
|
|
63
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
64
|
+
evt.Skip()
|
|
65
65
|
|
|
66
66
|
@self.handler.bind('C-c pressed')
|
|
67
|
-
def copy(
|
|
67
|
+
def copy(evt):
|
|
68
68
|
self.copy()
|
|
69
69
|
|
|
70
70
|
def OnDestroy(self, evt):
|
|
@@ -219,10 +219,10 @@ class EventMonitor(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
219
219
|
def blink(self, i):
|
|
220
220
|
if self.GetItemBackgroundColour(i) != wx.Colour('yellow'):
|
|
221
221
|
self.SetItemBackgroundColour(i, "yellow")
|
|
222
|
-
def
|
|
222
|
+
def _reset_color():
|
|
223
223
|
if self and i < self.ItemCount:
|
|
224
224
|
self.SetItemBackgroundColour(i, 'white')
|
|
225
|
-
wx.CallAfter(wx.CallLater, 1000,
|
|
225
|
+
wx.CallAfter(wx.CallLater, 1000, _reset_color)
|
|
226
226
|
|
|
227
227
|
def copy(self):
|
|
228
228
|
if not self.SelectedItemCount:
|
mwx/wxpdb.py
CHANGED
|
@@ -107,9 +107,9 @@ class Debugger(Pdb):
|
|
|
107
107
|
self.parent.handler('add_help', pdb.__doc__)
|
|
108
108
|
pdb.help = _help
|
|
109
109
|
|
|
110
|
-
def dispatch(
|
|
110
|
+
def dispatch(evt):
|
|
111
111
|
"""Fork events to the parent."""
|
|
112
|
-
self.parent.handler(self.handler.current_event,
|
|
112
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
113
113
|
|
|
114
114
|
self.__handler = FSM({ # DNA<Debugger>
|
|
115
115
|
0 : {
|
mwx/wxwil.py
CHANGED
|
@@ -49,13 +49,13 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
49
49
|
|
|
50
50
|
@self.handler.bind('*button* pressed')
|
|
51
51
|
@self.handler.bind('*button* released')
|
|
52
|
-
def dispatch(
|
|
52
|
+
def dispatch(evt):
|
|
53
53
|
"""Fork events to the parent."""
|
|
54
|
-
self.parent.handler(self.handler.current_event,
|
|
55
|
-
|
|
54
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
55
|
+
evt.Skip()
|
|
56
56
|
|
|
57
57
|
@self.handler.bind('C-c pressed')
|
|
58
|
-
def copy(
|
|
58
|
+
def copy(evt):
|
|
59
59
|
self.copy()
|
|
60
60
|
|
|
61
61
|
dispatcher.connect(receiver=self._update, signal='Interpreter.push')
|
|
@@ -132,10 +132,10 @@ class LocalsWatcher(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
132
132
|
def blink(self, i):
|
|
133
133
|
if self.GetItemBackgroundColour(i) != wx.Colour('yellow'):
|
|
134
134
|
self.SetItemBackgroundColour(i, "yellow")
|
|
135
|
-
def
|
|
135
|
+
def _reset_color():
|
|
136
136
|
if self and i < self.ItemCount:
|
|
137
137
|
self.SetItemBackgroundColour(i, 'white')
|
|
138
|
-
wx.CallAfter(wx.CallLater, 1000,
|
|
138
|
+
wx.CallAfter(wx.CallLater, 1000, _reset_color)
|
|
139
139
|
|
|
140
140
|
def copy(self):
|
|
141
141
|
if not self.SelectedItemCount:
|
mwx/wxwit.py
CHANGED
|
@@ -43,18 +43,18 @@ class Inspector(it.InspectionTree, CtrlInterface):
|
|
|
43
43
|
|
|
44
44
|
@self.handler.bind('*button* pressed')
|
|
45
45
|
@self.handler.bind('*button* released')
|
|
46
|
-
def dispatch(
|
|
46
|
+
def dispatch(evt):
|
|
47
47
|
"""Fork events to the parent."""
|
|
48
|
-
self.parent.handler(self.handler.current_event,
|
|
49
|
-
|
|
48
|
+
self.parent.handler(self.handler.current_event, evt)
|
|
49
|
+
evt.Skip()
|
|
50
50
|
|
|
51
51
|
@self.handler.bind('f4 pressed')
|
|
52
|
-
def highlight(
|
|
52
|
+
def highlight(evt):
|
|
53
53
|
if self.target:
|
|
54
54
|
self.highlighter.HighlightCurrentItem(self)
|
|
55
55
|
|
|
56
56
|
@self.handler.bind('f5 pressed')
|
|
57
|
-
def refresh(
|
|
57
|
+
def refresh(evt):
|
|
58
58
|
self.BuildTree(self.target)
|
|
59
59
|
|
|
60
60
|
def OnDestroy(self, evt):
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
mwx/__init__.py,sha256=TbTijMLO3dsX4wargOd3z-z5wjMK8fcogBBr_mgCnSs,815
|
|
2
|
+
mwx/bookshelf.py,sha256=DAhMQk3_J4rdE50adBMFu5wNz3WdMh_zzJ37O9ncceo,5103
|
|
3
|
+
mwx/controls.py,sha256=JBMUbDgHFf4Dx0PofCdnoQExBnGjxiAeSGkdS_0Qgo4,47673
|
|
4
|
+
mwx/framework.py,sha256=dVj9vz-jGDsVUDa3H4urXRWwe6v6I2unrc7fx6rQEJg,75531
|
|
5
|
+
mwx/graphman.py,sha256=PacQF1Of6oaqw26uFoXaAK9IrwggGRwoJe9uCP5JZ28,70373
|
|
6
|
+
mwx/images.py,sha256=mrnUYH12I3XLVSZcEXlpVltX0XMxufbl2yRvDIQJZqc,49957
|
|
7
|
+
mwx/matplot2.py,sha256=nA7RLW1tf5kQfrenFnrAF900DbrpOUldc3SGaJgJKi0,32794
|
|
8
|
+
mwx/matplot2g.py,sha256=faKpuBdp4H_g-HKfRdxV17AwHtXcfRi2F0myE3cjM04,65393
|
|
9
|
+
mwx/matplot2lg.py,sha256=gI_L_GofQrg5TIgZFMgYu8-7IRoe6VCRG3Ub35ChSpQ,27177
|
|
10
|
+
mwx/mgplt.py,sha256=ITzxA97yDwr_35BUk5OqnyskSuKVDbpf2AQCKY1jHTI,5671
|
|
11
|
+
mwx/nutshell.py,sha256=DS_Q63RmOpINAmkZkDCYzVS35iGZNSv254gLrSUm9yo,135846
|
|
12
|
+
mwx/utilus.py,sha256=Uwj6vbNUUztwOswPG75xtsT2y_PZqh3QiJraxmA9iT0,37401
|
|
13
|
+
mwx/wxmon.py,sha256=6es-jVz9Ht7vZnG7VBJcaNYLHY0PnZtij60SXcZRTeY,12727
|
|
14
|
+
mwx/wxpdb.py,sha256=lLowkkAgMhPFHAfklD7wZHq0qbSMjRxnBFtSajmVgME,19133
|
|
15
|
+
mwx/wxwil.py,sha256=zP1-5Fpi1wpDQU977229zIH6QRuSkkyfuAlNKWjGoGg,5588
|
|
16
|
+
mwx/wxwit.py,sha256=7jR7WPu0-ZxTA6F_SQc7ZjlR9mNO21GFfriTZqV6Ly0,7344
|
|
17
|
+
mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
|
|
18
|
+
mwx/plugins/ffmpeg_view.py,sha256=vUYNybIJsF1JGkDzjBgDyBQvDh8e1oKHlEMY5Fwc8L4,9399
|
|
19
|
+
mwx/plugins/fft_view.py,sha256=evj2kCe6N10JQczW8IajgLVrUWOihQaHQ2xiBzAsAl4,2675
|
|
20
|
+
mwx/plugins/frame_listview.py,sha256=fY27r_8ttf2hi-T0CPgY_LGbH9xKkQmSIqgaALMyVCM,10112
|
|
21
|
+
mwx/plugins/line_profile.py,sha256=--9NIc3x5EfRB3L59JvD7rzENQHyiYfu7wWJo6AuMkA,820
|
|
22
|
+
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
23
|
+
mwx/py/filling.py,sha256=KaHooM32hrGGgqw75Cbt8lAvACwC6RXadob9LGgNnEc,16806
|
|
24
|
+
mwxlib-0.95.2.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
25
|
+
mwxlib-0.95.2.dist-info/METADATA,sha256=MlRm2EglFJRORLtyTPSH85NX07m1oL2TY3JtPoHqQ10,1925
|
|
26
|
+
mwxlib-0.95.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
27
|
+
mwxlib-0.95.2.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
28
|
+
mwxlib-0.95.2.dist-info/RECORD,,
|
mwxlib-0.94.8.dist-info/RECORD
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
mwx/__init__.py,sha256=zLsXDgqyC5NsPCjRxjS2huvZ3uDyeOJ1vapotqe2ULM,834
|
|
2
|
-
mwx/bookshelf.py,sha256=WEILqqxzGtdNUiUvn8oa4aTCSnzO11_MrV2L8sXKjXI,5000
|
|
3
|
-
mwx/controls.py,sha256=prp1NhZqv1XANhi2PPxW9jtrgwj_02XMOOyyzZ48klM,47185
|
|
4
|
-
mwx/framework.py,sha256=9ZWmc31eMBdtFPqTTd21dtyiYsiBA8U0MRuLzIMMVoI,75272
|
|
5
|
-
mwx/graphman.py,sha256=9MG0BzQh5lDDadyPPXps2M0hf6mPN3G0MQbBGdplY_I,70027
|
|
6
|
-
mwx/images.py,sha256=mrnUYH12I3XLVSZcEXlpVltX0XMxufbl2yRvDIQJZqc,49957
|
|
7
|
-
mwx/matplot2.py,sha256=qaF_gvLoLn-TimLbRR59KUavNr1ZpZQdSMqjzJk47rk,32682
|
|
8
|
-
mwx/matplot2g.py,sha256=mDaD367wjq6xsyIDX9ot8jLwYYGayoavWMhqsQVBHac,65442
|
|
9
|
-
mwx/matplot2lg.py,sha256=tg8u7w4DxiJdPN-E197NOmbQpc_1gZkgDHYv_xUhbFA,27224
|
|
10
|
-
mwx/mgplt.py,sha256=ITzxA97yDwr_35BUk5OqnyskSuKVDbpf2AQCKY1jHTI,5671
|
|
11
|
-
mwx/nutshell.py,sha256=SWlACsEHGtsLxw3l16TnNALNAB2_ObE7IO0eqo1s4eQ,135627
|
|
12
|
-
mwx/utilus.py,sha256=FTJhVFmx6TAE5rvZ_nfxZgyyaW4zMpXEz74v72X6m7Y,37399
|
|
13
|
-
mwx/wxmon.py,sha256=Qk86VbuuW2rR46pqEYLur13G_aloWz5SVv6sib30YY0,12717
|
|
14
|
-
mwx/wxpdb.py,sha256=2z3ZD9Oo1H-ONBHlaprkB9hrTmAI7o03sqO46ppEFE4,19129
|
|
15
|
-
mwx/wxwil.py,sha256=JK1du4i1RVMbDLqN8jLRDSu_JhKEp4mhHVMElzo4yoE,5578
|
|
16
|
-
mwx/wxwit.py,sha256=MQxXR6VqqT25K6dTQ1U_42SMq1yJT6y54xrMq-OMOaQ,7334
|
|
17
|
-
mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
|
|
18
|
-
mwx/plugins/ffmpeg_view.py,sha256=vUYNybIJsF1JGkDzjBgDyBQvDh8e1oKHlEMY5Fwc8L4,9399
|
|
19
|
-
mwx/plugins/fft_view.py,sha256=evj2kCe6N10JQczW8IajgLVrUWOihQaHQ2xiBzAsAl4,2675
|
|
20
|
-
mwx/plugins/frame_listview.py,sha256=T-2xSv_D2bk9fJ64aiSEe1rJRTeqaIpLVAYEUXW5vz8,10110
|
|
21
|
-
mwx/plugins/line_profile.py,sha256=WJB5z7F53yg4dII2R36IFZvtkSOGWT669b1HmAAXSnQ,816
|
|
22
|
-
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
23
|
-
mwx/py/filling.py,sha256=KaHooM32hrGGgqw75Cbt8lAvACwC6RXadob9LGgNnEc,16806
|
|
24
|
-
mwxlib-0.94.8.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
25
|
-
mwxlib-0.94.8.dist-info/METADATA,sha256=fHCSJqHLZhgT8iK4xUBbA2apLus3rSQMqMh0w-O7DxU,1925
|
|
26
|
-
mwxlib-0.94.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
27
|
-
mwxlib-0.94.8.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
28
|
-
mwxlib-0.94.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|