mwxlib 0.97.3__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 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) # -> focus moves
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
@@ -319,7 +319,8 @@ class Knob(wx.Panel):
319
319
 
320
320
  if type is None:
321
321
  type = 'slider'
322
- cw = 0
322
+ if cw < 0:
323
+ cw = 0
323
324
  elif type == 'choice':
324
325
  if cw < 0:
325
326
  cw = 20
mwx/framework.py CHANGED
@@ -1,9 +1,10 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "0.97.3"
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 moved if shown
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=(300,200))
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 is moved
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 is moved => EVT_SHOW
962
+ win.Selection = j # the focus moves => EVT_SHOW
963
963
  else:
964
964
  plug.handler('page_shown', plug)
965
965
  else:
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
- text = self.GetTextRange(self.eol, self.TextLength)
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 + self.eol)
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)
@@ -1927,7 +1928,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
1927
1928
  buf = self.buffer
1928
1929
  j = self.GetPageIndex(buf)
1929
1930
  if j != -1:
1930
- self.DeletePage(j) # the focus is moved
1931
+ self.DeletePage(j) # the focus moves
1931
1932
  if not self.buffer: # no buffers
1932
1933
  self.new_buffer()
1933
1934
 
mwx/utilus.py CHANGED
@@ -1,9 +1,9 @@
1
1
  #! python3
2
2
  """mwxlib core utilities.
3
3
  """
4
+ from contextlib import contextmanager
4
5
  from functools import wraps
5
6
  from bdb import BdbQuit
6
- from contextlib import contextmanager
7
7
  import traceback
8
8
  import warnings
9
9
  import time
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 0.97.3
3
+ Version: 0.97.4
4
4
  Summary: A wrapper of matplotlib and wxPython (phoenix)
5
5
  Home-page: https://github.com/komoto48g/mwxlib
6
6
  Author: Kazuya O'moto
@@ -1,15 +1,15 @@
1
1
  mwx/__init__.py,sha256=nN62CGTWjME7Zz2h-jIRB8MxwuErIkHPGrlBzydkF0o,643
2
- mwx/bookshelf.py,sha256=ILKB13hX4riJnYFJmUvu2b1xa4uz8KxA1ZVuf4Y1zqM,5136
3
- mwx/controls.py,sha256=KAnzk2EeiBZsvJkfIHKIXo8bhxc6uVpC5CW802657ow,47815
4
- mwx/framework.py,sha256=ro-UOz8GFUmBqiKAst5DIRcboRJ0_x2KXGjoGctBAkA,75249
5
- mwx/graphman.py,sha256=Y6PD9L-ee5hc7nwBkmTDDKXf6cGHkc5L-f6OW3QtD6M,70486
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
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=4mUQCvtE0SZxlHRflrgKYGlMgvj2HY9LtBhAm9Rnnd8,137518
12
- mwx/utilus.py,sha256=8GK_2mGY08DVN5_SGWynLKQEJsCKqvqWTDToar1XozM,37333
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.3.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-0.97.3.dist-info/METADATA,sha256=Q10wJtVKCVOVctcuIDSFiyDADO0rlPKp8Ga-PLxOTKI,1880
26
- mwxlib-0.97.3.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
27
- mwxlib-0.97.3.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-0.97.3.dist-info/RECORD,,
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,,