mwxlib 1.0.6__py3-none-any.whl → 1.1.0__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/controls.py CHANGED
@@ -426,7 +426,7 @@ class Knob(wx.Panel):
426
426
  self.ctrl.SetItems(items)
427
427
  self.ctrl.SetStringSelection(str(v))
428
428
  else:
429
- self.ctrl.SetRange(0, len(v)-1) #<wx.Slider> <wx.SpinButton>
429
+ self.ctrl.SetRange(0, len(v)-1) #<wx.Slider> #<wx.SpinButton>
430
430
 
431
431
  def update_label(self):
432
432
  """Called when label is being changed (internal use only)."""
@@ -482,7 +482,7 @@ class Knob(wx.Panel):
482
482
  v.index = j
483
483
  v.reset(v.value)
484
484
 
485
- def OnScroll(self, evt): #<wx._core.ScrollEvent><wx._controls.SpinEvent><wx._core.CommandEvent>
485
+ def OnScroll(self, evt): #<wx._core.ScrollEvent> #<wx._controls.SpinEvent> #<wx._core.CommandEvent>
486
486
  v = self.__par
487
487
  j = self.ctrl.GetValue()
488
488
  if j != v.index:
mwx/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "1.0.6"
4
+ __version__ = "1.1.0"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from contextlib import contextmanager
@@ -261,26 +261,33 @@ class KeyCtrlInterfaceMixin:
261
261
  },
262
262
  })
263
263
 
264
+ builtins.enter = "Enter extension mode."
265
+ builtins.exit = "Exit extension mode."
266
+
264
267
  def pre_command_hook(self, evt):
265
- """Called when entering extension mode (internal use only)."""
268
+ ## """Called when entering extension mode (internal use only)."""
266
269
  ## Check text selection for [C-c/C-x].
267
270
  wnd = wx.Window.FindFocus()
268
271
  if isinstance(wnd, wx.TextEntry) and wnd.StringSelection\
269
- or isinstance(wnd, stc.StyledTextCtrl) and wnd.SelectedText:
270
- ## or any other of pre-selection-p?
272
+ or isinstance(wnd, stc.StyledTextCtrl) and wnd.SelectedText:
271
273
  self.handler('quit', evt)
272
274
  else:
273
275
  self.message(evt.key + '-')
274
276
  evt.Skip()
277
+ pre_command_hook.__name__ = str('enter')
275
278
 
276
279
  def post_command_hook(self, evt):
277
- """Called when exiting extension mode (internal use only)."""
280
+ ## """Called when exiting extension mode (internal use only)."""
281
+ ## Check if the event has reached a top-level window.
282
+ if isinstance(self, wx.TopLevelWindow):
283
+ return
278
284
  keymap = self.handler.previous_state
279
285
  if keymap:
280
286
  self.message("{} {}".format(keymap, evt.key))
281
287
  else:
282
288
  self.message(evt.key)
283
289
  evt.Skip()
290
+ post_command_hook.__name__ = str('exit')
284
291
 
285
292
  def define_key(self, keymap, action=None, *args, **kwargs):
286
293
  """Define [map key (pressed)] action.
@@ -729,11 +736,6 @@ class Frame(wx.Frame, KeyCtrlInterfaceMixin):
729
736
 
730
737
  message = property(lambda self: self.statusbar)
731
738
 
732
- def post_command_hook(self, evt):
733
- ## (override) Don't skip events as a TopLevelWindow.
734
- pass
735
- post_command_hook.__name__ = str('noskip')
736
-
737
739
  def __init__(self, *args, **kwargs):
738
740
  wx.Frame.__init__(self, *args, **kwargs)
739
741
 
@@ -808,11 +810,6 @@ class MiniFrame(wx.MiniFrame, KeyCtrlInterfaceMixin):
808
810
 
809
811
  message = property(lambda self: self.statusbar)
810
812
 
811
- def post_command_hook(self, evt):
812
- ## (override) Don't skip events as a TopLevelWindow.
813
- pass
814
- post_command_hook.__name__ = str('noskip')
815
-
816
813
  def __init__(self, *args, **kwargs):
817
814
  wx.MiniFrame.__init__(self, *args, **kwargs)
818
815
 
mwx/graphman.py CHANGED
@@ -261,6 +261,12 @@ class LayerInterface(CtrlInterface):
261
261
  ## thread_type = Thread
262
262
  thread = None
263
263
 
264
+ ## layout helper function (internal use only)
265
+ pack = mwx.pack
266
+
267
+ ## funcall = interactive_call (internal use only)
268
+ funcall = staticmethod(_F)
269
+
264
270
  ## for debug (internal use only)
265
271
  pane = property(lambda self: self.parent.get_pane(self))
266
272
 
mwx/matplot2.py CHANGED
@@ -160,6 +160,12 @@ class MatplotPanel(wx.Panel):
160
160
  if self.handler.fork(self.handler.current_event, evt) is None:
161
161
  evt.Skip()
162
162
 
163
+ def skip(evt): #<wx._core.KeyEvent> #<matplotlib.backend_bases.MouseEvent>
164
+ try:
165
+ evt.Skip()
166
+ except AttributeError:
167
+ pass
168
+
163
169
  self.__handler = FSM({ # DNA<MatplotPanel>
164
170
  None : {
165
171
  'canvas_draw' : [ None, self.OnDraw ], # before canvas.draw
@@ -188,6 +194,7 @@ class MatplotPanel(wx.Panel):
188
194
  'space pressed' : (PAN, self.OnPanBegin),
189
195
  'ctrl pressed' : (PAN, self.OnPanBegin),
190
196
  'z pressed' : (ZOOM, self.OnZoomBegin),
197
+ '* pressed' : (NORMAL, skip),
191
198
  'xaxis motion' : (XAXIS, self.OnAxisEnter),
192
199
  'yaxis motion' : (YAXIS, self.OnAxisEnter),
193
200
  'y2axis motion' : (YAXIS, self.OnAxisEnter),
mwx/nutshell.py CHANGED
@@ -1785,16 +1785,6 @@ class Buffer(EditorInterface, EditWindow):
1785
1785
  """
1786
1786
  return self.mtdelta is not None and self.mtdelta > 0
1787
1787
 
1788
- def pre_command_hook(self, evt):
1789
- self.parent.handler(self.handler.current_event, evt)
1790
- return EditorInterface.pre_command_hook(self, evt)
1791
- pre_command_hook.__name__ = str('pre_command_dispatch') # alias
1792
-
1793
- def post_command_hook(self, evt):
1794
- self.parent.handler(self.handler.current_event, evt)
1795
- return EditorInterface.post_command_hook(self, evt)
1796
- post_command_hook.__name__ = str('post_command_dispatch') # alias
1797
-
1798
1788
  def __init__(self, parent, filename, **kwargs):
1799
1789
  EditWindow.__init__(self, parent, **kwargs)
1800
1790
  EditorInterface.__init__(self)
@@ -2647,10 +2637,9 @@ class Nautilus(EditorInterface, Shell):
2647
2637
 
2648
2638
  - quoteback : x`y --> y=x | x`y`z --> z=y=x
2649
2639
  - pullback : x@y --> y(x) | x@y@z --> z(y(x))
2650
- - apropos : x.y? [not] p --> shows apropos (not-)matched by predicates p
2651
- equiv. apropos(x, y [,ignorecase ?:True,??:False] [,pred=p])
2652
- ``y`` can contain regular expressions except for a dot.
2653
- ``y`` can contain abbreviations: \\a:[a-z], \\A:[A-Z] .
2640
+ - apropos : x.y? [not] p --> shows items (not) matched by predicate p
2641
+ equiv. apropos(x, y [,ignorecase ?:True,??:False] [,pred=p]).
2642
+ ``y`` can contain regular expressions, but no dots or backslashes.
2654
2643
  ``p`` can be atom, callable, type (e.g., int, str, ...),
2655
2644
  and any predicates such as inspect.isclass.
2656
2645
 
mwx/testsuite.py ADDED
@@ -0,0 +1,58 @@
1
+ #! python3
2
+ """Test suite for App, Frame, and ControlPanel.
3
+
4
+ Get the wx.App or wx.Frame instance and start the main-loop if needed.
5
+
6
+ Usage:
7
+ with testApp() as app:
8
+ frm = wx.Frame(None)
9
+ frm.Show()
10
+
11
+ Is equivlent to:
12
+ app = wx.App()
13
+ frm = wx.Frame(None)
14
+ frm.Show()
15
+ app.MainLoop()
16
+ """
17
+ from contextlib import contextmanager
18
+ import wx
19
+
20
+ __all__ = ["testApp", "testFrame", "Plugman", "ControlPanel"]
21
+
22
+
23
+ @contextmanager
24
+ def testApp():
25
+ app = wx.GetApp() or wx.App()
26
+ yield app
27
+ if not app.GetMainLoop():
28
+ app.MainLoop()
29
+ ## wx.App.run = staticmethod(testApp)
30
+
31
+
32
+ @contextmanager
33
+ def testFrame(**kwargs):
34
+ with testApp():
35
+ frm = wx.Frame(None, **kwargs)
36
+ yield frm
37
+ frm.Show()
38
+ ## wx.Frame.run = staticmethod(testFrame)
39
+
40
+
41
+ @contextmanager
42
+ def Plugman(**kwargs):
43
+ import mwx.graphman
44
+ with testApp():
45
+ frm = mwx.graphman.Frame(None, **kwargs)
46
+ yield frm
47
+ frm.Show()
48
+
49
+
50
+ @contextmanager
51
+ def ControlPanel(**kwargs):
52
+ import mwx
53
+ with testApp():
54
+ frm = mwx.Frame(None)
55
+ panel = mwx.ControlPanel(frm, **kwargs)
56
+ yield panel
57
+ panel.Sizer.Fit(frm)
58
+ frm.Show()
mwx/utilus.py CHANGED
@@ -138,9 +138,6 @@ def apropos(obj, rexpr='', ignorecase=True, alias=None, pred=None, locals=None):
138
138
  """
139
139
  name = alias or typename(obj)
140
140
 
141
- rexpr = (rexpr.replace('\\a','[a-z0-9]') #\a: identifier chars (custom rule)
142
- .replace('\\A','[A-Z0-9]')) #\A:
143
-
144
141
  if isinstance(pred, str):
145
142
  pred = predicate(pred, locals)
146
143
 
@@ -326,9 +323,9 @@ def split_tokens(text, comment=True):
326
323
  j, k = 1, 0
327
324
  for type, string, start, end, line in tokens:
328
325
  l, m = start
329
- if type in (0,5,6) or not string:
326
+ if type in (tokenize.ENDMARKER, tokenize.INDENT, tokenize.DEDENT):
330
327
  continue
331
- if type == 61 and not comment:
328
+ if type == tokenize.COMMENT and not comment:
332
329
  token = next(tokens) # eats a trailing token
333
330
  string = token.string # cr/lf or ''
334
331
  if m == 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 1.0.6
3
+ Version: 1.1.0
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,16 @@
1
1
  mwx/__init__.py,sha256=psabnAMei5VzB2TsB2qBNLrIZMX0LiqjlXCpNGmDejk,668
2
2
  mwx/bookshelf.py,sha256=so-xSLq08sMlJBErTxOaDoKUAMa_g1CkIP2pNnff68c,5607
3
- mwx/controls.py,sha256=iXNTk4ge6sHStenjxC7bFKgQHvqxMwfb82IbgiDmtEk,47944
4
- mwx/framework.py,sha256=Y0YBqjcbfPMTqal_-vN9LPAXaHVNTYbxQ1UpMbVAb_8,75818
5
- mwx/graphman.py,sha256=mDnhy3jAzZCo8_p6ZcA-NDPMuOyW_R2r_fuxUIAM7D8,69669
3
+ mwx/controls.py,sha256=cNZkgwSv90lPIz61FvMtYxHIt8hJD_RQYXxsgTQIdLc,47949
4
+ mwx/framework.py,sha256=eDCdsCjn0-dgeGh4RjTmkoKCyQa96_YXSWF6zFped4Y,75759
5
+ mwx/graphman.py,sha256=04bEw7TEIs6X1QrgqBSLJoIhJnW5TwHTW_wZOvJYSwo,69840
6
6
  mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
7
- mwx/matplot2.py,sha256=zA56jIdRUdzu-wrmPai1PSOjzqV2Erqw2yFKW-jwdA8,32901
7
+ mwx/matplot2.py,sha256=RuVWXC2A_qgZRNmBBptbHDn5MyxaWBqp3ru4bP_lDE0,33150
8
8
  mwx/matplot2g.py,sha256=4G5uZJZzATEC3QEVZ4pGHetEDfu5NJNUFyeAaQScK5s,64495
9
9
  mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
10
10
  mwx/mgplt.py,sha256=M5rt-H7Uq1OHnlFvMA4a3945UBvppbR9L_mw8NL_YZ0,5602
11
- mwx/nutshell.py,sha256=9QeJXQluEmZSB0B8rGSH9SU_WvjCymmDdU0DKd3fkko,142076
12
- mwx/utilus.py,sha256=Yyw8L1f-ikhyd7wtFXYtsOswofWxmB4GAmLOZnhUXeU,37388
11
+ mwx/nutshell.py,sha256=MLE667zDFB2iZSpW1m0AwLxRAh6HUYLMyl4OLV_VXAI,141532
12
+ mwx/testsuite.py,sha256=gPoqnBzG4wnON785Pn5lEuWFgenrY6KhPH-e1WZbKfA,1234
13
+ mwx/utilus.py,sha256=sZehJJHBQ7aGpzEMClmowqExVO7esyVMK7Tk-MJO6tQ,37293
13
14
  mwx/wxmon.py,sha256=yzWqrbY6LzpfRwQeytYUeqFhFuLVm_XEvrVAL_k0HBQ,12756
14
15
  mwx/wxpdb.py,sha256=--TQr-_zs9dWPYV2V4s3Zr4abvN14o5wD8anT9frHUg,18875
15
16
  mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
@@ -21,8 +22,8 @@ mwx/plugins/frame_listview.py,sha256=gowjQ-ARNonMkDSXkQgPKq4U9YBJ-vQ0jK2krBVOdCs
21
22
  mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
22
23
  mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
23
24
  mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
24
- mwxlib-1.0.6.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-1.0.6.dist-info/METADATA,sha256=p5q3rC09GOoq4pW_UWNKP7Z1SvrX24kKCy-I19tKmts,7259
26
- mwxlib-1.0.6.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
27
- mwxlib-1.0.6.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-1.0.6.dist-info/RECORD,,
25
+ mwxlib-1.1.0.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
26
+ mwxlib-1.1.0.dist-info/METADATA,sha256=JHue3ApnAKemSra3UbiHgzXbe0pk7pkwoSMEF_jOTco,7259
27
+ mwxlib-1.1.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
28
+ mwxlib-1.1.0.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
29
+ mwxlib-1.1.0.dist-info/RECORD,,
File without changes