mwxlib 0.97.2__py3-none-any.whl → 0.97.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/bookshelf.py +1 -1
- mwx/controls.py +2 -1
- mwx/framework.py +17 -9
- mwx/graphman.py +1 -1
- mwx/matplot2g.py +17 -9
- mwx/nutshell.py +14 -8
- mwx/utilus.py +1 -1
- {mwxlib-0.97.2.dist-info → mwxlib-0.97.4.dist-info}/METADATA +1 -1
- {mwxlib-0.97.2.dist-info → mwxlib-0.97.4.dist-info}/RECORD +12 -12
- {mwxlib-0.97.2.dist-info → mwxlib-0.97.4.dist-info}/LICENSE +0 -0
- {mwxlib-0.97.2.dist-info → mwxlib-0.97.4.dist-info}/WHEEL +0 -0
- {mwxlib-0.97.2.dist-info → mwxlib-0.97.4.dist-info}/top_level.txt +0 -0
mwx/bookshelf.py
CHANGED
|
@@ -40,7 +40,7 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
|
|
|
40
40
|
def delete_item():
|
|
41
41
|
data = self.GetItemData(self.Selection)
|
|
42
42
|
if data:
|
|
43
|
-
data.parent.kill_buffer(data) #
|
|
43
|
+
data.parent.kill_buffer(data) # the focus moves
|
|
44
44
|
wx.CallAfter(self.SetFocus)
|
|
45
45
|
|
|
46
46
|
def dispatch(evt):
|
mwx/controls.py
CHANGED
mwx/framework.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#! python3
|
|
2
2
|
"""mwxlib framework.
|
|
3
3
|
"""
|
|
4
|
-
__version__ = "0.97.
|
|
4
|
+
__version__ = "0.97.4"
|
|
5
5
|
__author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
|
|
6
6
|
|
|
7
|
+
from contextlib import contextmanager
|
|
7
8
|
from functools import wraps, partial
|
|
8
9
|
from importlib import reload
|
|
9
10
|
import traceback
|
|
@@ -75,6 +76,16 @@ def postcall(f):
|
|
|
75
76
|
return _f
|
|
76
77
|
|
|
77
78
|
|
|
79
|
+
@contextmanager
|
|
80
|
+
def save_focus_excursion():
|
|
81
|
+
wnd = wx.Window.FindFocus() # original focus
|
|
82
|
+
try:
|
|
83
|
+
yield wnd
|
|
84
|
+
finally:
|
|
85
|
+
if wnd:
|
|
86
|
+
wnd.SetFocus() # restore focus
|
|
87
|
+
|
|
88
|
+
|
|
78
89
|
_speckeys = {
|
|
79
90
|
wx.WXK_ALT : 'alt',
|
|
80
91
|
wx.WXK_BACK : 'backspace',
|
|
@@ -885,7 +896,7 @@ class AuiNotebook(aui.AuiNotebook):
|
|
|
885
896
|
wnd = wx.Window.FindFocus() # original focus
|
|
886
897
|
org = self.CurrentPage
|
|
887
898
|
if j != self.Selection:
|
|
888
|
-
self.Selection = j # focus
|
|
899
|
+
self.Selection = j # the focus moves if shown
|
|
889
900
|
self.CurrentPage.SetFocus() # reset focus
|
|
890
901
|
if wnd and wnd is not org: # restore focus other window
|
|
891
902
|
wnd.SetFocus()
|
|
@@ -1152,7 +1163,7 @@ class ShellFrame(MiniFrame):
|
|
|
1152
1163
|
|
|
1153
1164
|
self.ghost.SetDropTarget(FileDropLoader(self.Scratch))
|
|
1154
1165
|
|
|
1155
|
-
self.watcher = AuiNotebook(self, size=(
|
|
1166
|
+
self.watcher = AuiNotebook(self, size=(600,400))
|
|
1156
1167
|
self.watcher.AddPage(self.ginfo, "globals")
|
|
1157
1168
|
self.watcher.AddPage(self.linfo, "locals")
|
|
1158
1169
|
self.watcher.AddPage(self.monitor, "Monitor", bitmap=Icon('tv'))
|
|
@@ -1544,10 +1555,9 @@ class ShellFrame(MiniFrame):
|
|
|
1544
1555
|
return
|
|
1545
1556
|
self.popup_window(win, not pane.IsShown())
|
|
1546
1557
|
|
|
1558
|
+
@save_focus_excursion()
|
|
1547
1559
|
def popup_window(self, win, show=True):
|
|
1548
1560
|
"""Show the notebook page and keep the focus."""
|
|
1549
|
-
wnd = wx.Window.FindFocus() # original focus
|
|
1550
|
-
|
|
1551
1561
|
for pane in self._mgr.GetAllPanes():
|
|
1552
1562
|
nb = pane.window
|
|
1553
1563
|
if nb is win:
|
|
@@ -1555,14 +1565,11 @@ class ShellFrame(MiniFrame):
|
|
|
1555
1565
|
j = nb.GetPageIndex(win) # find and select page
|
|
1556
1566
|
if j != -1:
|
|
1557
1567
|
if j != nb.Selection:
|
|
1558
|
-
nb.Selection = j # the focus
|
|
1568
|
+
nb.Selection = j # the focus moves
|
|
1559
1569
|
break
|
|
1560
1570
|
else:
|
|
1561
1571
|
return # no such pane.window
|
|
1562
1572
|
|
|
1563
|
-
if wnd:
|
|
1564
|
-
wnd.SetFocus() # restore focus
|
|
1565
|
-
|
|
1566
1573
|
## Modify the floating position of the pane when displayed.
|
|
1567
1574
|
## Note: This is a known bug in wxWidgets 3.17 -- 3.20,
|
|
1568
1575
|
## and will be fixed in wxPython 4.2.1.
|
|
@@ -1598,6 +1605,7 @@ class ShellFrame(MiniFrame):
|
|
|
1598
1605
|
if editor:
|
|
1599
1606
|
return editor.load_file(filename, lineno)
|
|
1600
1607
|
|
|
1608
|
+
@save_focus_excursion()
|
|
1601
1609
|
def load(self, filename, lineno=0, show=True):
|
|
1602
1610
|
"""Load file @where the object is defined.
|
|
1603
1611
|
|
mwx/graphman.py
CHANGED
|
@@ -959,7 +959,7 @@ class Frame(mwx.Frame):
|
|
|
959
959
|
if isinstance(win, aui.AuiNotebook):
|
|
960
960
|
j = win.GetPageIndex(plug)
|
|
961
961
|
if j != win.Selection:
|
|
962
|
-
win.Selection = j # the focus
|
|
962
|
+
win.Selection = j # the focus moves => EVT_SHOW
|
|
963
963
|
else:
|
|
964
964
|
plug.handler('page_shown', plug)
|
|
965
965
|
else:
|
mwx/matplot2g.py
CHANGED
|
@@ -14,7 +14,7 @@ from scipy import ndimage as ndi
|
|
|
14
14
|
|
|
15
15
|
from . import framework as mwx
|
|
16
16
|
from .framework import Menu
|
|
17
|
-
from .utilus import warn
|
|
17
|
+
## from .utilus import warn
|
|
18
18
|
from .utilus import funcall as _F
|
|
19
19
|
from .controls import Clipboard
|
|
20
20
|
from .matplot2 import MatplotPanel
|
|
@@ -46,6 +46,12 @@ def _to_buffer(img):
|
|
|
46
46
|
return img
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
def _to_array(x):
|
|
50
|
+
if isinstance(x, (list, tuple)):
|
|
51
|
+
x = np.array(x)
|
|
52
|
+
return x
|
|
53
|
+
|
|
54
|
+
|
|
49
55
|
def imconvert(src, cutoff=0, threshold=None, binning=1):
|
|
50
56
|
"""Convert buffer to image<uint8>
|
|
51
57
|
|
|
@@ -325,15 +331,16 @@ class AxesImagePhantom(object):
|
|
|
325
331
|
return self.__buf[ny, nx] # nearest value
|
|
326
332
|
return ndi.map_coordinates(self.__buf, np.vstack((ny, nx))) # spline value
|
|
327
333
|
|
|
328
|
-
def xytopixel(self, x, y, cast=True):
|
|
334
|
+
def xytopixel(self, x, y=None, cast=True):
|
|
329
335
|
"""Convert xydata (x,y) -> [nx,ny] pixel.
|
|
330
336
|
If cast, convert pixel-based lengths to pixel numbers.
|
|
331
337
|
"""
|
|
332
338
|
def _cast(n):
|
|
333
339
|
return np.int32(np.floor(np.round(n, 1)))
|
|
334
|
-
if
|
|
335
|
-
|
|
336
|
-
y =
|
|
340
|
+
if y is None:
|
|
341
|
+
## warn("Setting xy data with single tuple.", DeprecationWarning)
|
|
342
|
+
x, y = x
|
|
343
|
+
x, y = _to_array(x), _to_array(y)
|
|
337
344
|
l,r,b,t = self.__art.get_extent()
|
|
338
345
|
ux, uy = self.xy_unit
|
|
339
346
|
nx = (x - l) / ux
|
|
@@ -342,11 +349,12 @@ class AxesImagePhantom(object):
|
|
|
342
349
|
return (_cast(nx), _cast(ny))
|
|
343
350
|
return (nx-0.5, ny-0.5)
|
|
344
351
|
|
|
345
|
-
def xyfrompixel(self, nx, ny):
|
|
352
|
+
def xyfrompixel(self, nx, ny=None):
|
|
346
353
|
"""Convert pixel [nx,ny] -> (x,y) xydata (float number)."""
|
|
347
|
-
if
|
|
348
|
-
|
|
349
|
-
ny =
|
|
354
|
+
if ny is None:
|
|
355
|
+
## warn("Setting xy data with single tuple.", DeprecationWarning)
|
|
356
|
+
nx, ny = nx
|
|
357
|
+
nx, ny = _to_array(nx), _to_array(ny)
|
|
350
358
|
l,r,b,t = self.__art.get_extent()
|
|
351
359
|
ux, uy = self.xy_unit
|
|
352
360
|
x = l + (nx + 0.5) * ux
|
mwx/nutshell.py
CHANGED
|
@@ -987,11 +987,12 @@ class EditorInterface(CtrlInterface):
|
|
|
987
987
|
return p, q, st
|
|
988
988
|
|
|
989
989
|
def grep_forward(self, pattern, flags=re.M):
|
|
990
|
-
|
|
990
|
+
orig = self.eol if (self.markline == self.cline) else self.cpos
|
|
991
|
+
text = self.GetTextRange(orig, self.TextLength)
|
|
991
992
|
errs = re.finditer(pattern, text, flags)
|
|
992
993
|
for err in errs:
|
|
993
994
|
p, q = err.span()
|
|
994
|
-
self.goto_char(q +
|
|
995
|
+
self.goto_char(q + orig)
|
|
995
996
|
self.goto_char(self.bol)
|
|
996
997
|
self.mark = self.cpos
|
|
997
998
|
self.EnsureVisible(self.cline)
|
|
@@ -1415,7 +1416,7 @@ class Buffer(EditWindow, EditorInterface):
|
|
|
1415
1416
|
return os.path.getmtime(fn) - self.__mtime
|
|
1416
1417
|
if re.match(url_re, fn):
|
|
1417
1418
|
return -1
|
|
1418
|
-
return None
|
|
1419
|
+
return self.__mtime # None or specified value
|
|
1419
1420
|
|
|
1420
1421
|
@property
|
|
1421
1422
|
def caption_prefix(self):
|
|
@@ -1481,12 +1482,14 @@ class Buffer(EditWindow, EditorInterface):
|
|
|
1481
1482
|
self.Bind(stc.EVT_STC_SAVEPOINTREACHED, self.OnSavePointReached)
|
|
1482
1483
|
|
|
1483
1484
|
def activate(evt):
|
|
1484
|
-
|
|
1485
|
+
if self:
|
|
1486
|
+
self.handler('buffer_activated', self)
|
|
1485
1487
|
evt.Skip()
|
|
1486
1488
|
self.Bind(wx.EVT_SET_FOCUS, activate)
|
|
1487
1489
|
|
|
1488
1490
|
def inactivate(evt):
|
|
1489
|
-
|
|
1491
|
+
if self:
|
|
1492
|
+
self.handler('buffer_inactivated', self)
|
|
1490
1493
|
evt.Skip()
|
|
1491
1494
|
self.Bind(wx.EVT_KILL_FOCUS, inactivate)
|
|
1492
1495
|
|
|
@@ -1925,7 +1928,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
1925
1928
|
buf = self.buffer
|
|
1926
1929
|
j = self.GetPageIndex(buf)
|
|
1927
1930
|
if j != -1:
|
|
1928
|
-
self.DeletePage(j) # the focus
|
|
1931
|
+
self.DeletePage(j) # the focus moves
|
|
1929
1932
|
if not self.buffer: # no buffers
|
|
1930
1933
|
self.new_buffer()
|
|
1931
1934
|
|
|
@@ -2018,6 +2021,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2018
2021
|
return
|
|
2019
2022
|
if not self.load_file(filename):
|
|
2020
2023
|
buf = self.create_buffer(filename)
|
|
2024
|
+
buf._Buffer__mtime = 0 # => need_buffer_save
|
|
2021
2025
|
self.swap_buffer(buf)
|
|
2022
2026
|
|
|
2023
2027
|
open_buffer = find_file # for backward compatibility
|
|
@@ -2370,12 +2374,14 @@ class Nautilus(Shell, EditorInterface):
|
|
|
2370
2374
|
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
|
2371
2375
|
|
|
2372
2376
|
def activate(evt):
|
|
2373
|
-
|
|
2377
|
+
if self:
|
|
2378
|
+
self.handler('shell_activated', self)
|
|
2374
2379
|
evt.Skip()
|
|
2375
2380
|
self.Bind(wx.EVT_SET_FOCUS, activate)
|
|
2376
2381
|
|
|
2377
2382
|
def inactivate(evt):
|
|
2378
|
-
|
|
2383
|
+
if self:
|
|
2384
|
+
self.handler('shell_inactivated', self)
|
|
2379
2385
|
evt.Skip()
|
|
2380
2386
|
self.Bind(wx.EVT_KILL_FOCUS, inactivate)
|
|
2381
2387
|
|
mwx/utilus.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=nN62CGTWjME7Zz2h-jIRB8MxwuErIkHPGrlBzydkF0o,643
|
|
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=Y4xI2SrEO22DrI1hyyfFx7DfFZA8znOzX9RWMPsA2BE,5137
|
|
3
|
+
mwx/controls.py,sha256=YtcFqSFRZaFyVOCF1RI33F3-BA_r6L75--izYXSLNt8,47843
|
|
4
|
+
mwx/framework.py,sha256=RrwPw08G26GbJFemxqZU1W1SZ1x-Txau8y9F-6qOU8w,75416
|
|
5
|
+
mwx/graphman.py,sha256=SdGWKWqOAkScRzkd3D0yZI44czBnHjFimYxqoEYZbDw,70483
|
|
6
6
|
mwx/images.py,sha256=_-Eh3xF7Khu42ivkYp97NXIzSNGbjcidqtWjZQFGtqE,47827
|
|
7
7
|
mwx/matplot2.py,sha256=xCJ_ZzdDEWmzctpPaOrzTnwXyHINP4nfFHweoTZa6ug,32899
|
|
8
|
-
mwx/matplot2g.py,sha256=
|
|
8
|
+
mwx/matplot2g.py,sha256=wiZFDFuQe3ax71fmyeR_9hvAmgT-4nVfZ30UByv8Nv8,64379
|
|
9
9
|
mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
|
|
10
10
|
mwx/mgplt.py,sha256=ITzxA97yDwr_35BUk5OqnyskSuKVDbpf2AQCKY1jHTI,5671
|
|
11
|
-
mwx/nutshell.py,sha256=
|
|
12
|
-
mwx/utilus.py,sha256=
|
|
11
|
+
mwx/nutshell.py,sha256=Zwlh_1zFRCmlTBFsw_0xHBLsofKSmzd8K62cWBov1FQ,137580
|
|
12
|
+
mwx/utilus.py,sha256=mmqB4P_3mTi7SrFleMiN1599Jm0Us0XKnNA6v2xglSs,37333
|
|
13
13
|
mwx/wxmon.py,sha256=f3V24EF7kdMlYF7usLYK9QE5KU6fSu0jVqsvwAiA-Ag,12647
|
|
14
14
|
mwx/wxpdb.py,sha256=lLowkkAgMhPFHAfklD7wZHq0qbSMjRxnBFtSajmVgME,19133
|
|
15
15
|
mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
|
|
@@ -21,8 +21,8 @@ mwx/plugins/frame_listview.py,sha256=hbApzZWa9-BmQthu7uZBlBbGbtf4iJ_prO8IhxoGMs8
|
|
|
21
21
|
mwx/plugins/line_profile.py,sha256=--9NIc3x5EfRB3L59JvD7rzENQHyiYfu7wWJo6AuMkA,820
|
|
22
22
|
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
23
23
|
mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
|
|
24
|
-
mwxlib-0.97.
|
|
25
|
-
mwxlib-0.97.
|
|
26
|
-
mwxlib-0.97.
|
|
27
|
-
mwxlib-0.97.
|
|
28
|
-
mwxlib-0.97.
|
|
24
|
+
mwxlib-0.97.4.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
25
|
+
mwxlib-0.97.4.dist-info/METADATA,sha256=QKmoaVt-Lsr7Ra6T8Z8YPpKtkWDNGDG2fgW1L9E5jdM,1880
|
|
26
|
+
mwxlib-0.97.4.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
|
27
|
+
mwxlib-0.97.4.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
28
|
+
mwxlib-0.97.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|