mwxlib 1.1.5__py3-none-any.whl → 1.1.7__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
@@ -73,7 +73,7 @@ class Param:
73
73
  v = self.value
74
74
  try:
75
75
  return self.__format(v)
76
- except ValueError:
76
+ except (TypeError, ValueError):
77
77
  return str(v)
78
78
 
79
79
  def __int__(self):
@@ -93,7 +93,7 @@ class Param:
93
93
  return
94
94
  elif isinstance(v, str):
95
95
  try:
96
- v = self.__eval(v.replace(',', '')) # eliminates commas; includes nan, inf
96
+ v = self.__eval(v.replace(',', '')) # eliminates commas
97
97
  except Exception:
98
98
  v = self.value
99
99
  internal_callback = False
@@ -202,9 +202,10 @@ class Param:
202
202
  def index(self):
203
203
  """A knob index -> value.
204
204
  Returns -1 if the value is not defined."""
205
- if self:
206
- return int(np.searchsorted(self.range, self.value))
207
- return -1
205
+ v = self.value
206
+ if np.isnan(v) or np.isinf(v):
207
+ return -1
208
+ return int(np.searchsorted(self.range, v))
208
209
 
209
210
  @index.setter
210
211
  def index(self, j):
@@ -267,7 +268,7 @@ class LParam(Param):
267
268
  v = self.value
268
269
  if np.isnan(v) or np.isinf(v):
269
270
  return -1
270
- return int(round((self.value - self.min) / self.step))
271
+ return int(round((v - self.min) / self.step))
271
272
 
272
273
  @index.setter
273
274
  def index(self, j):
mwx/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "1.1.5"
4
+ __version__ = "1.1.7"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from contextlib import contextmanager
@@ -1979,7 +1979,7 @@ class ShellFrame(MiniFrame):
1979
1979
  if self.findDlg:
1980
1980
  self.OnFindClose(None)
1981
1981
  wnd.EnsureVisible(wnd.cline)
1982
- wnd.EnsureLineMoreOnScreen(wnd.cline)
1982
+ wnd.ensureLineMoreOnScreen(wnd.cline)
1983
1983
 
1984
1984
  def OnFindPrev(self, evt):
1985
1985
  self.OnFindNext(evt, backward=True)
mwx/matplot2g.py CHANGED
@@ -235,11 +235,11 @@ class AxesImagePhantom:
235
235
 
236
236
  @unit.setter
237
237
  def unit(self, v):
238
- if v is None:
238
+ if v is None or np.isnan(v): # nan => undefined
239
239
  v = self.parent.unit
240
240
  self.__localunit = None
241
- elif np.isnan(v) or np.isinf(v):
242
- raise ValueError("The unit value cannot be NaN or Inf")
241
+ elif np.isinf(v):
242
+ raise ValueError("The unit value must not be inf")
243
243
  elif v <= 0:
244
244
  raise ValueError("The unit value must be greater than zero")
245
245
  else:
@@ -802,10 +802,8 @@ class GraphPlot(MatplotPanel):
802
802
 
803
803
  @unit.setter
804
804
  def unit(self, v):
805
- if v is None:
806
- raise ValueError("The globalunit must be non-nil value")
807
- elif np.isnan(v) or np.isinf(v):
808
- raise ValueError("Axis limits cannot be NaN or Inf")
805
+ if v is None or np.isnan(v) or np.isinf(v):
806
+ raise ValueError("The unit value must not be nan or inf")
809
807
  elif v <= 0:
810
808
  raise ValueError("The unit value must be greater than zero")
811
809
  else:
mwx/nutshell.py CHANGED
@@ -667,35 +667,30 @@ class EditorInterface(AutoCompInterfaceMixin, CtrlInterface):
667
667
  self.__mark = -1
668
668
  self.__stylus = {}
669
669
 
670
- __dnd_from = None
671
670
  __dnd_flag = 0
672
671
 
673
672
  def OnDrag(self, evt): #<wx._core.StyledTextEvent>
674
- EditorInterface.__dnd_from = evt.EventObject
675
- try:
676
- EditorInterface.__dnd_flag = (evt.Position < self.bolc) # force copy
677
- except AttributeError:
673
+ if isinstance(self, Shell):
674
+ EditorInterface.__dnd_flag = (evt.Position < self.bolc) # readonly
675
+ else:
678
676
  EditorInterface.__dnd_flag = 0
679
677
  evt.Skip()
680
678
 
681
679
  def OnDragging(self, evt): #<wx._core.StyledTextEvent>
682
- _from = EditorInterface.__dnd_from
683
- _to = evt.EventObject
684
- if isinstance(_from, Shell) and _from is not _to: # from shell to buffer
685
- wx.UIActionSimulator().KeyDown(wx.WXK_CONTROL) # force copy
686
- try:
687
- if evt.Position < self.bolc:
688
- evt.DragResult = wx.DragNone # Don't drop (as readonly)
680
+ if isinstance(self, Shell):
681
+ if evt.Position < self.bolc: # target is readonly
682
+ evt.DragResult = wx.DragNone
689
683
  elif EditorInterface.__dnd_flag:
690
- evt.DragResult = wx.DragCopy # Don't move
691
- except AttributeError:
692
- pass
684
+ ## from shell to shell
685
+ evt.DragResult = wx.DragCopy if wx.GetKeyState(wx.WXK_CONTROL) else wx.DragNone
686
+ else:
687
+ if EditorInterface.__dnd_flag:
688
+ ## from shell to buffer
689
+ evt.DragResult = wx.DragCopy if wx.GetKeyState(wx.WXK_CONTROL) else wx.DragNone
693
690
  evt.Skip()
694
691
 
695
692
  def OnDragged(self, evt): #<wx._core.StyledTextEvent>
696
- EditorInterface.__dnd_from = None
697
693
  EditorInterface.__dnd_flag = 0
698
- wx.UIActionSimulator().KeyUp(wx.WXK_CONTROL)
699
694
  evt.Skip()
700
695
 
701
696
  ## --------------------------------
@@ -1108,7 +1103,7 @@ class EditorInterface(AutoCompInterfaceMixin, CtrlInterface):
1108
1103
  break
1109
1104
  lc = la
1110
1105
  self.ToggleFold(lc)
1111
- self.EnsureLineOnScreen(lc)
1106
+ self.ensureLineOnScreen(lc)
1112
1107
  return lc
1113
1108
 
1114
1109
  def get_region(self, line):
@@ -1265,7 +1260,7 @@ class EditorInterface(AutoCompInterfaceMixin, CtrlInterface):
1265
1260
  w, h = self.PointFromPosition(pos)
1266
1261
  return self.FirstVisibleLine + h//self.TextHeight(0)
1267
1262
 
1268
- def EnsureLineOnScreen(self, line):
1263
+ def ensureLineOnScreen(self, line):
1269
1264
  """Ensure a particular line is visible by scrolling the buffer
1270
1265
  without expanding any header line hiding it.
1271
1266
  """
@@ -1277,7 +1272,7 @@ class EditorInterface(AutoCompInterfaceMixin, CtrlInterface):
1277
1272
  elif vl > hl + n - 1:
1278
1273
  self.ScrollToLine(vl - n + 1)
1279
1274
 
1280
- def EnsureLineMoreOnScreen(self, line, offset=0):
1275
+ def ensureLineMoreOnScreen(self, line, offset=0):
1281
1276
  """Ensure a particular line is visible by scrolling the buffer
1282
1277
  without expanding any header line hiding it.
1283
1278
  If the line is at the screen edge, recenter it.
@@ -2446,7 +2441,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2446
2441
  for fn in dlg.Paths:
2447
2442
  self.find_file(fn)
2448
2443
  return
2449
- if self.load_file(filename) == False:
2444
+ if self.load_file(filename) == False: # not None
2450
2445
  buf = self.create_buffer(filename)
2451
2446
  buf._Buffer__mtime = 0 # => need_buffer_save
2452
2447
  self.swap_buffer(buf)
mwx/wxpdb.py CHANGED
@@ -330,7 +330,7 @@ class Debugger(Pdb):
330
330
  buffer.recenter(3)
331
331
  buffer.goto_line(lineno - 1)
332
332
  buffer.pointer = lineno - 1 # (->) pointer:marker
333
- buffer.EnsureLineMoreOnScreen(lineno - 1)
333
+ buffer.ensureLineMoreOnScreen(lineno - 1)
334
334
  self.code = code
335
335
  wx.CallAfter(_mark)
336
336
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 1.1.5
3
+ Version: 1.1.7
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
@@ -17,7 +17,7 @@ Classifier: Topic :: Scientific/Engineering :: Image Processing
17
17
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: wxpython >=4.2.0
20
+ Requires-Dist: wxpython>=4.2.0
21
21
  Requires-Dist: matplotlib
22
22
  Requires-Dist: opencv-python
23
23
  Requires-Dist: scipy
@@ -1,18 +1,18 @@
1
1
  mwx/__init__.py,sha256=psabnAMei5VzB2TsB2qBNLrIZMX0LiqjlXCpNGmDejk,668
2
2
  mwx/bookshelf.py,sha256=b_TMDaNIzLHoL0xbbqb3tt0BnRvhLAqaCn_pBdrigZw,7523
3
- mwx/controls.py,sha256=cNZkgwSv90lPIz61FvMtYxHIt8hJD_RQYXxsgTQIdLc,47949
4
- mwx/framework.py,sha256=KobxKW3ogvEBdm1I6cKr_4xyP5JTmxpDK3AsnQbLk90,76125
3
+ mwx/controls.py,sha256=trJKRFgum3u-8f8hd6N3qk6jHt4dVqiLgE6CKK5EE4U,47971
4
+ mwx/framework.py,sha256=bgO-mgMMYZtb3cQtPzOyErEVtpSvd9RJEdqFMpcpz6c,76125
5
5
  mwx/graphman.py,sha256=LjN1R8UZxHycrgAfnl_SoTT_vHuKcSISr5VVf0cMflM,69821
6
6
  mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
7
7
  mwx/matplot2.py,sha256=RuVWXC2A_qgZRNmBBptbHDn5MyxaWBqp3ru4bP_lDE0,33150
8
- mwx/matplot2g.py,sha256=4G5uZJZzATEC3QEVZ4pGHetEDfu5NJNUFyeAaQScK5s,64495
8
+ mwx/matplot2g.py,sha256=dBAODQvSM_yf2uQUCrRO03ZOK3MycR8lEXTJfRXDlbY,64432
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=5X3o2TTXWxZ9pyXy-6XRsIKu09q8_lIWUDoST59FoIA,141488
11
+ mwx/nutshell.py,sha256=wzcZSxTM9G2bYtIBri51-AA6JhiKrtfsh-DMgwJZ5io,141340
12
12
  mwx/testsuite.py,sha256=kiM3-BVhr42LRRN7xG7pYl3at8o2vnypWSxD8KRvA7c,1228
13
13
  mwx/utilus.py,sha256=HFvP682SyeSp8yNfUrdUXPhWdLuWVlsUSg6LqNBJOT8,37451
14
14
  mwx/wxmon.py,sha256=yzWqrbY6LzpfRwQeytYUeqFhFuLVm_XEvrVAL_k0HBQ,12756
15
- mwx/wxpdb.py,sha256=--TQr-_zs9dWPYV2V4s3Zr4abvN14o5wD8anT9frHUg,18875
15
+ mwx/wxpdb.py,sha256=AObuf4JLAmlQLj-yf0_mkBBd-Bhhz2Vb8hbTVcHEZOs,18875
16
16
  mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
17
17
  mwx/wxwit.py,sha256=1hHtMi2YEy2T_LnUpwdmrIdtCuvxMOFyykqnbq6jLP0,7294
18
18
  mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
@@ -22,8 +22,8 @@ mwx/plugins/frame_listview.py,sha256=gowjQ-ARNonMkDSXkQgPKq4U9YBJ-vQ0jK2krBVOdCs
22
22
  mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
23
23
  mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
24
24
  mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
25
- mwxlib-1.1.5.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
26
- mwxlib-1.1.5.dist-info/METADATA,sha256=Gr1yxZsOVwU-M2UA0fLOrj78gjkJShfJfx7IwwBO4OU,7259
27
- mwxlib-1.1.5.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
28
- mwxlib-1.1.5.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
29
- mwxlib-1.1.5.dist-info/RECORD,,
25
+ mwxlib-1.1.7.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
26
+ mwxlib-1.1.7.dist-info/METADATA,sha256=G8xDeGhF9BCMfozwYrtRmZgMltFt3QcKGv_ka5UjSEg,7258
27
+ mwxlib-1.1.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
28
+ mwxlib-1.1.7.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
29
+ mwxlib-1.1.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5