mwxlib 0.96.0__py3-none-any.whl → 0.96.1__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 +10 -9
- mwx/framework.py +2 -2
- mwx/matplot2g.py +14 -10
- mwx/nutshell.py +1 -1
- mwx/utilus.py +4 -7
- {mwxlib-0.96.0.dist-info → mwxlib-0.96.1.dist-info}/METADATA +1 -1
- {mwxlib-0.96.0.dist-info → mwxlib-0.96.1.dist-info}/RECORD +10 -10
- {mwxlib-0.96.0.dist-info → mwxlib-0.96.1.dist-info}/WHEEL +1 -1
- {mwxlib-0.96.0.dist-info → mwxlib-0.96.1.dist-info}/LICENSE +0 -0
- {mwxlib-0.96.0.dist-info → mwxlib-0.96.1.dist-info}/top_level.txt +0 -0
mwx/controls.py
CHANGED
|
@@ -12,7 +12,7 @@ from .utilus import funcall as _F
|
|
|
12
12
|
from .framework import pack, Menu
|
|
13
13
|
|
|
14
14
|
import numpy as np
|
|
15
|
-
from numpy import nan, inf
|
|
15
|
+
from numpy import nan, inf # noqa: necessary to eval
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def _Tip(*tips):
|
|
@@ -97,10 +97,8 @@ class Param(object):
|
|
|
97
97
|
v = self.std_value
|
|
98
98
|
if v is None:
|
|
99
99
|
return
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
elif isinstance(v, str):
|
|
103
|
-
v = self.__eval(v.replace(',', '')) # eliminates commas
|
|
100
|
+
if isinstance(v, str):
|
|
101
|
+
v = self.__eval(v.replace(',', '')) # eliminates commas; includes nan, inf
|
|
104
102
|
self._set_value(v)
|
|
105
103
|
if backcall:
|
|
106
104
|
self.callback('control', self)
|
|
@@ -111,7 +109,8 @@ class Param(object):
|
|
|
111
109
|
"""
|
|
112
110
|
if v is None:
|
|
113
111
|
v = nan
|
|
114
|
-
|
|
112
|
+
|
|
113
|
+
if np.isnan(v) or np.isinf(v):
|
|
115
114
|
self.__value = v
|
|
116
115
|
for knob in self.knobs:
|
|
117
116
|
knob.update_ctrl(None, notify=False)
|
|
@@ -185,7 +184,7 @@ class Param(object):
|
|
|
185
184
|
@offset.setter
|
|
186
185
|
def offset(self, v):
|
|
187
186
|
if self.std_value is not None:
|
|
188
|
-
if
|
|
187
|
+
if not np.isnan(v):
|
|
189
188
|
v += self.std_value
|
|
190
189
|
self._set_value(v)
|
|
191
190
|
|
|
@@ -253,6 +252,7 @@ class LParam(Param):
|
|
|
253
252
|
|
|
254
253
|
@range.setter
|
|
255
254
|
def range(self, v):
|
|
255
|
+
assert v is None or len(v) <= 3, "The range must be of length <= 3 or None"
|
|
256
256
|
if v is None:
|
|
257
257
|
v = (0, 0)
|
|
258
258
|
self.__min = v[0]
|
|
@@ -266,7 +266,8 @@ class LParam(Param):
|
|
|
266
266
|
"""A knob index -> value
|
|
267
267
|
Returns -1 if the value is nan or inf.
|
|
268
268
|
"""
|
|
269
|
-
|
|
269
|
+
v = self.value
|
|
270
|
+
if np.isnan(v) or np.isinf(v):
|
|
270
271
|
return -1
|
|
271
272
|
return int(round((self.value - self.min) / self.step))
|
|
272
273
|
|
|
@@ -319,7 +320,7 @@ class Knob(wx.Panel):
|
|
|
319
320
|
wx.Panel.__init__(self, parent, **kwargs)
|
|
320
321
|
|
|
321
322
|
assert isinstance(param, Param),\
|
|
322
|
-
"Argument `param` must be an instance of Param
|
|
323
|
+
"Argument `param` must be an instance of Param"
|
|
323
324
|
|
|
324
325
|
self.__bit = 1
|
|
325
326
|
self.__par = param
|
mwx/framework.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#! python3
|
|
2
2
|
"""mwxlib framework.
|
|
3
3
|
"""
|
|
4
|
-
__version__ = "0.96.
|
|
4
|
+
__version__ = "0.96.1"
|
|
5
5
|
__author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
|
|
6
6
|
|
|
7
7
|
from functools import wraps, partial
|
|
@@ -232,7 +232,7 @@ class KeyCtrlInterfaceMixin:
|
|
|
232
232
|
state = self.handler.default_state
|
|
233
233
|
event = keymap + ' pressed'
|
|
234
234
|
|
|
235
|
-
assert state is not None, "Don't make keymap for None:state
|
|
235
|
+
assert state is not None, "Don't make keymap for None:state"
|
|
236
236
|
|
|
237
237
|
self.handler.update({ # DNA<KeyCtrlInterfaceMixin>
|
|
238
238
|
state : {
|
mwx/matplot2g.py
CHANGED
|
@@ -10,7 +10,7 @@ from matplotlib import patches
|
|
|
10
10
|
from PIL import Image
|
|
11
11
|
import cv2
|
|
12
12
|
import numpy as np
|
|
13
|
-
from numpy import pi
|
|
13
|
+
from numpy import pi
|
|
14
14
|
from scipy import ndimage as ndi
|
|
15
15
|
|
|
16
16
|
from . import framework as mwx
|
|
@@ -224,16 +224,18 @@ class AxesImagePhantom(object):
|
|
|
224
224
|
@property
|
|
225
225
|
def unit(self):
|
|
226
226
|
"""Logical length per pixel arb.unit [u/pixel]."""
|
|
227
|
-
return self.__localunit or self.parent.
|
|
227
|
+
return self.__localunit or self.parent.unit
|
|
228
228
|
|
|
229
229
|
@unit.setter
|
|
230
230
|
def unit(self, v):
|
|
231
231
|
u = self.unit
|
|
232
|
-
if v
|
|
233
|
-
v = self.parent.
|
|
232
|
+
if v is None:
|
|
233
|
+
v = self.parent.unit
|
|
234
234
|
self.__localunit = None
|
|
235
|
+
elif np.isnan(v) or np.isinf(v):
|
|
236
|
+
raise ValueError("The unit value cannot be NaN or Inf")
|
|
235
237
|
elif v <= 0:
|
|
236
|
-
raise
|
|
238
|
+
raise ValueError("The unit value must be greater than zero")
|
|
237
239
|
else:
|
|
238
240
|
if v == self.__localunit: # no effect when v is localunit
|
|
239
241
|
return
|
|
@@ -249,7 +251,7 @@ class AxesImagePhantom(object):
|
|
|
249
251
|
|
|
250
252
|
@property
|
|
251
253
|
def xy_unit(self):
|
|
252
|
-
u = self.__localunit or self.parent.
|
|
254
|
+
u = self.__localunit or self.parent.unit
|
|
253
255
|
return (u, u * self.__aspect_ratio)
|
|
254
256
|
|
|
255
257
|
@property
|
|
@@ -828,10 +830,12 @@ class GraphPlot(MatplotPanel):
|
|
|
828
830
|
|
|
829
831
|
@unit.setter
|
|
830
832
|
def unit(self, v):
|
|
831
|
-
if v
|
|
832
|
-
raise
|
|
833
|
+
if v is None:
|
|
834
|
+
raise ValueError("The globalunit must be non-nil value")
|
|
835
|
+
elif np.isnan(v) or np.isinf(v):
|
|
836
|
+
raise ValueError("Axis limits cannot be NaN or Inf")
|
|
833
837
|
elif v <= 0:
|
|
834
|
-
raise
|
|
838
|
+
raise ValueError("The unit value must be greater than zero")
|
|
835
839
|
else:
|
|
836
840
|
if v == self.__unit: # no effect unless unit changes
|
|
837
841
|
return
|
|
@@ -844,7 +848,7 @@ class GraphPlot(MatplotPanel):
|
|
|
844
848
|
for art in self.__Arts:
|
|
845
849
|
self.handler('frame_updated', art)
|
|
846
850
|
|
|
847
|
-
globalunit = unit
|
|
851
|
+
globalunit = unit # for backward compatibility
|
|
848
852
|
|
|
849
853
|
def update_markup_ratio(self, r):
|
|
850
854
|
"""Modify markup objects position."""
|
mwx/nutshell.py
CHANGED
|
@@ -1986,7 +1986,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
1986
1986
|
self.swap_buffer(buf, lineno)
|
|
1987
1987
|
return True
|
|
1988
1988
|
## return False
|
|
1989
|
-
raise Exception("The requested URL was not found
|
|
1989
|
+
raise Exception("The requested URL was not found")
|
|
1990
1990
|
if buf._load_file(filename):
|
|
1991
1991
|
self.swap_buffer(buf, lineno)
|
|
1992
1992
|
return True
|
mwx/utilus.py
CHANGED
|
@@ -438,9 +438,8 @@ def find_modules(force=False, verbose=True):
|
|
|
438
438
|
for info in walk_packages_no_import(['.']):
|
|
439
439
|
_callback('.', info.name)
|
|
440
440
|
else:
|
|
441
|
-
print("Please wait a moment "
|
|
442
|
-
|
|
443
|
-
"(This is executed once)".format(sys.winver))
|
|
441
|
+
print(f"Please wait a moment while Py{sys.winver} gathers a list of "
|
|
442
|
+
"all available modules... (This is executed once)")
|
|
444
443
|
|
|
445
444
|
lm = list(sys.builtin_module_names)
|
|
446
445
|
|
|
@@ -684,7 +683,6 @@ class FSM(dict):
|
|
|
684
683
|
" action : {}".format(typename(act)),
|
|
685
684
|
" args : {}".format(args),
|
|
686
685
|
" kwargs : {}".format(kwargs))
|
|
687
|
-
traceback.print_exc()
|
|
688
686
|
self.__matched_pattern = None
|
|
689
687
|
return retvals
|
|
690
688
|
|
|
@@ -728,12 +726,11 @@ class FSM(dict):
|
|
|
728
726
|
|
|
729
727
|
@staticmethod
|
|
730
728
|
def dump(*args):
|
|
731
|
-
print(*args, sep='\n', file=sys.__stderr__)
|
|
732
729
|
fn = get_rootpath("deb-dump.log")
|
|
733
730
|
with open(fn, 'a') as o:
|
|
734
731
|
print(time.strftime('!!! %Y/%m/%d %H:%M:%S'), file=o)
|
|
735
|
-
print(*args,
|
|
736
|
-
|
|
732
|
+
print(*args, traceback.format_exc(), sep='\n', file=o)
|
|
733
|
+
print(*args, traceback.format_exc(), sep='\n', file=sys.__stderr__)
|
|
737
734
|
|
|
738
735
|
@staticmethod
|
|
739
736
|
def duplicate(context):
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=nN62CGTWjME7Zz2h-jIRB8MxwuErIkHPGrlBzydkF0o,643
|
|
2
2
|
mwx/bookshelf.py,sha256=DAhMQk3_J4rdE50adBMFu5wNz3WdMh_zzJ37O9ncceo,5103
|
|
3
|
-
mwx/controls.py,sha256=
|
|
4
|
-
mwx/framework.py,sha256=
|
|
3
|
+
mwx/controls.py,sha256=2US02WAmYVydsPJ8ILzZ7opV83giX1P6kY5rr_ZTX2E,48278
|
|
4
|
+
mwx/framework.py,sha256=rzhushWI0BYuGeorx4M6ElKEtpMxrQIrlKOxqqEIokI,75665
|
|
5
5
|
mwx/graphman.py,sha256=4SRwCMs4-sS3n23FthythhuG9dBJ8TLz_TVyoYAbdoA,70639
|
|
6
6
|
mwx/images.py,sha256=gyvqW4TLWdJMKmsaWiPiV_PuHJM1GbHgeELERLwGzg8,45291
|
|
7
7
|
mwx/matplot2.py,sha256=-G7z0Osozm9NjLfXvX5UcdFviwbNUktjbd904_g-PqQ,33516
|
|
8
|
-
mwx/matplot2g.py,sha256=
|
|
8
|
+
mwx/matplot2g.py,sha256=2vDx1pY89b4A7uaLd_RHK2HQ5hnwtH4C4wiYZLzuQjw,65707
|
|
9
9
|
mwx/matplot2lg.py,sha256=pcu1oDPE_BlpFqNGPPKf9vpTuDs_h_u3OTRAJx5-Sds,27392
|
|
10
10
|
mwx/mgplt.py,sha256=ITzxA97yDwr_35BUk5OqnyskSuKVDbpf2AQCKY1jHTI,5671
|
|
11
|
-
mwx/nutshell.py,sha256=
|
|
12
|
-
mwx/utilus.py,sha256=
|
|
11
|
+
mwx/nutshell.py,sha256=yQbih2Q1SXexJPuFNSwJnky5teRHXEKks12laHo6joo,137049
|
|
12
|
+
mwx/utilus.py,sha256=YShC4f67dIyjIOSZhSOEgBUfNR1nVOS6pxtm0GKMWrA,37320
|
|
13
13
|
mwx/wxmon.py,sha256=6es-jVz9Ht7vZnG7VBJcaNYLHY0PnZtij60SXcZRTeY,12727
|
|
14
14
|
mwx/wxpdb.py,sha256=lLowkkAgMhPFHAfklD7wZHq0qbSMjRxnBFtSajmVgME,19133
|
|
15
15
|
mwx/wxwil.py,sha256=zP1-5Fpi1wpDQU977229zIH6QRuSkkyfuAlNKWjGoGg,5588
|
|
@@ -21,8 +21,8 @@ mwx/plugins/frame_listview.py,sha256=RaYOj-YKrpLqhT8TkBRDX1TQnSPv90V185j8OjrWJTs
|
|
|
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=KaHooM32hrGGgqw75Cbt8lAvACwC6RXadob9LGgNnEc,16806
|
|
24
|
-
mwxlib-0.96.
|
|
25
|
-
mwxlib-0.96.
|
|
26
|
-
mwxlib-0.96.
|
|
27
|
-
mwxlib-0.96.
|
|
28
|
-
mwxlib-0.96.
|
|
24
|
+
mwxlib-0.96.1.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
25
|
+
mwxlib-0.96.1.dist-info/METADATA,sha256=0D7iaLq2lSivCrt81_r6TINYUkXkU-tUAdsIVugNrrY,1925
|
|
26
|
+
mwxlib-0.96.1.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
27
|
+
mwxlib-0.96.1.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
28
|
+
mwxlib-0.96.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|