mwxlib 0.94.0__py3-none-any.whl → 0.94.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 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/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 udpate_design(self, **kwargs):
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.0"
4
+ __version__ = "0.94.2"
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()
@@ -1237,9 +1278,9 @@ class ShellFrame(MiniFrame):
1237
1278
  shell = self.current_shell
1238
1279
  self.Scratch.buffer.py_eval_line(shell.globals, shell.locals)
1239
1280
 
1240
- @self.Scratch.define_key('M-j')
1281
+ @self.Scratch.define_key('C-S-j')
1241
1282
  @postcall
1242
- def exec_buffer():
1283
+ def eval_buffer():
1243
1284
  shell = self.current_shell
1244
1285
  self.Scratch.buffer.py_exec_region(shell.globals, shell.locals)
1245
1286
 
mwx/nutshell.py CHANGED
@@ -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, M-j : [0] call tooltip of eval (for the word selected or focused)
2224
- C-h, M-h : [0] call tooltip of help (for the func selected or focused)
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
- 'M-j pressed' : (0, self.exec_region),
2475
+ 'C-S-j pressed' : (0, self.exec_region),
2476
2476
  'C-h pressed' : (0, self.call_helpTip),
2477
- 'M-h pressed' : (0, self.call_helpTip2),
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
- 'M-j pressed' : (2, self.exec_region),
2534
+ 'C-S-j pressed' : (2, self.exec_region),
2535
2535
  'C-h pressed' : (2, self.call_helpTip),
2536
- 'M-h pressed' : (2, self.call_helpTip2),
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
- 'M-j pressed' : (3, self.exec_region),
2565
+ 'C-S-j pressed' : (3, self.exec_region),
2566
2566
  'C-h pressed' : (3, self.call_helpTip),
2567
- 'M-h pressed' : (3, self.call_helpTip2),
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
- 'M-j pressed' : (4, self.exec_region),
2596
+ 'C-S-j pressed' : (4, self.exec_region),
2597
2597
  'C-h pressed' : (4, self.call_helpTip),
2598
- 'M-h pressed' : (4, self.call_helpTip2),
2598
+ 'C-S-h pressed' : (4, self.call_helpTip2),
2599
2599
  '*alt pressed' : (4, ),
2600
2600
  '*ctrl pressed' : (4, ),
2601
2601
  '*shift pressed' : (4, ),
@@ -3307,13 +3307,12 @@ class Nautilus(Shell, EditorInterface):
3307
3307
 
3308
3308
  text = self.SelectedText or self.Command or self.expr_at_caret
3309
3309
  if text:
3310
+ text = introspect.getRoot(text, terminator='(')
3310
3311
  try:
3311
- text = introspect.getRoot(text, terminator='(')
3312
3312
  obj = self.eval(text)
3313
+ self.help(obj)
3313
3314
  except Exception as e:
3314
3315
  self.message("- {} : {!r}".format(e, text))
3315
- else:
3316
- self.help(obj)
3317
3316
 
3318
3317
  def call_helpTip(self, evt):
3319
3318
  """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 warnings.catch_warnings():
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 0.94.0
3
+ Version: 0.94.2
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
- mwx/__init__.py,sha256=5B4YSOuijG1Uo5-FLtLHGB52Cp_F4vnN--4wGPBx7do,2398
1
+ mwx/__init__.py,sha256=zLsXDgqyC5NsPCjRxjS2huvZ3uDyeOJ1vapotqe2ULM,834
2
2
  mwx/bookshelf.py,sha256=FrissUYdGXLABOzJmMaQU6GXvu6n_9DVW3d5wGwQzjM,6613
3
- mwx/controls.py,sha256=9C1sXBwQl-oZtCb3rXoT-doW48Sv1J359toNq9ScF9M,47173
4
- mwx/framework.py,sha256=kMfGFudj900FfShXWeFlyqogCdxCKwgbH2Y--1pn6Pk,73877
3
+ mwx/controls.py,sha256=1eguX5eofsA6hmS2y7R4hvlFjFikVoZ8v2S1ES7rjEU,47196
4
+ mwx/framework.py,sha256=1QVxdGh9q2auq4hQV-DaJsAZellHuUd9jpYfPBUj0fA,75394
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
8
  mwx/matplot2g.py,sha256=Ca-3RJZmSiZcvNrXmeK_lFf2fdG-0gkp7dYkCtrKi2I,65530
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=o5QHqlnLmKBZ63BWHcWXQO2LZ6YOzT0u46x3zEJAYQw,135825
12
- mwx/utilus.py,sha256=THDxQ-QqbHYVc8iX8qN9yxvfcf7Pvpm7sfTP9ipYvzs,37040
11
+ mwx/nutshell.py,sha256=iJEFzcu5qfp-HxXORB8ci-Q1z7a8zTPwbfFxik5h6pY,135802
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.0.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-0.94.0.dist-info/METADATA,sha256=G-NumcRVK3w8tTgMgMM_64pEpkJaZqqGFYoo7Vs7CoM,1925
26
- mwxlib-0.94.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
27
- mwxlib-0.94.0.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-0.94.0.dist-info/RECORD,,
24
+ mwxlib-0.94.2.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
+ mwxlib-0.94.2.dist-info/METADATA,sha256=nG8tQUyP23iDpjnaedgv9mFikcFoIBpFhFhfgI0wlWY,1925
26
+ mwxlib-0.94.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
27
+ mwxlib-0.94.2.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
+ mwxlib-0.94.2.dist-info/RECORD,,