mwxlib 0.97.2__py3-none-any.whl → 0.97.3__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/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "0.97.2"
4
+ __version__ = "0.97.3"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from functools import wraps, partial
mwx/matplot2g.py CHANGED
@@ -14,7 +14,7 @@ from scipy import ndimage as ndi
14
14
 
15
15
  from . import framework as mwx
16
16
  from .framework import Menu
17
- from .utilus import warn
17
+ ## from .utilus import warn
18
18
  from .utilus import funcall as _F
19
19
  from .controls import Clipboard
20
20
  from .matplot2 import MatplotPanel
@@ -46,6 +46,12 @@ def _to_buffer(img):
46
46
  return img
47
47
 
48
48
 
49
+ def _to_array(x):
50
+ if isinstance(x, (list, tuple)):
51
+ x = np.array(x)
52
+ return x
53
+
54
+
49
55
  def imconvert(src, cutoff=0, threshold=None, binning=1):
50
56
  """Convert buffer to image<uint8>
51
57
 
@@ -325,15 +331,16 @@ class AxesImagePhantom(object):
325
331
  return self.__buf[ny, nx] # nearest value
326
332
  return ndi.map_coordinates(self.__buf, np.vstack((ny, nx))) # spline value
327
333
 
328
- def xytopixel(self, x, y, cast=True):
334
+ def xytopixel(self, x, y=None, cast=True):
329
335
  """Convert xydata (x,y) -> [nx,ny] pixel.
330
336
  If cast, convert pixel-based lengths to pixel numbers.
331
337
  """
332
338
  def _cast(n):
333
339
  return np.int32(np.floor(np.round(n, 1)))
334
- if isinstance(x, (list, tuple)):
335
- x = np.array(x)
336
- y = np.array(y)
340
+ if y is None:
341
+ ## warn("Setting xy data with single tuple.", DeprecationWarning)
342
+ x, y = x
343
+ x, y = _to_array(x), _to_array(y)
337
344
  l,r,b,t = self.__art.get_extent()
338
345
  ux, uy = self.xy_unit
339
346
  nx = (x - l) / ux
@@ -342,11 +349,12 @@ class AxesImagePhantom(object):
342
349
  return (_cast(nx), _cast(ny))
343
350
  return (nx-0.5, ny-0.5)
344
351
 
345
- def xyfrompixel(self, nx, ny):
352
+ def xyfrompixel(self, nx, ny=None):
346
353
  """Convert pixel [nx,ny] -> (x,y) xydata (float number)."""
347
- if isinstance(nx, (list, tuple)):
348
- nx = np.array(nx)
349
- ny = np.array(ny)
354
+ if ny is None:
355
+ ## warn("Setting xy data with single tuple.", DeprecationWarning)
356
+ nx, ny = nx
357
+ nx, ny = _to_array(nx), _to_array(ny)
350
358
  l,r,b,t = self.__art.get_extent()
351
359
  ux, uy = self.xy_unit
352
360
  x = l + (nx + 0.5) * ux
mwx/nutshell.py CHANGED
@@ -1415,7 +1415,7 @@ class Buffer(EditWindow, EditorInterface):
1415
1415
  return os.path.getmtime(fn) - self.__mtime
1416
1416
  if re.match(url_re, fn):
1417
1417
  return -1
1418
- return None
1418
+ return self.__mtime # None or specified value
1419
1419
 
1420
1420
  @property
1421
1421
  def caption_prefix(self):
@@ -1481,12 +1481,14 @@ class Buffer(EditWindow, EditorInterface):
1481
1481
  self.Bind(stc.EVT_STC_SAVEPOINTREACHED, self.OnSavePointReached)
1482
1482
 
1483
1483
  def activate(evt):
1484
- self.handler('buffer_activated', self)
1484
+ if self:
1485
+ self.handler('buffer_activated', self)
1485
1486
  evt.Skip()
1486
1487
  self.Bind(wx.EVT_SET_FOCUS, activate)
1487
1488
 
1488
1489
  def inactivate(evt):
1489
- self.handler('buffer_inactivated', self)
1490
+ if self:
1491
+ self.handler('buffer_inactivated', self)
1490
1492
  evt.Skip()
1491
1493
  self.Bind(wx.EVT_KILL_FOCUS, inactivate)
1492
1494
 
@@ -2018,6 +2020,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2018
2020
  return
2019
2021
  if not self.load_file(filename):
2020
2022
  buf = self.create_buffer(filename)
2023
+ buf._Buffer__mtime = 0 # => need_buffer_save
2021
2024
  self.swap_buffer(buf)
2022
2025
 
2023
2026
  open_buffer = find_file # for backward compatibility
@@ -2370,12 +2373,14 @@ class Nautilus(Shell, EditorInterface):
2370
2373
  self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
2371
2374
 
2372
2375
  def activate(evt):
2373
- self.handler('shell_activated', self)
2376
+ if self:
2377
+ self.handler('shell_activated', self)
2374
2378
  evt.Skip()
2375
2379
  self.Bind(wx.EVT_SET_FOCUS, activate)
2376
2380
 
2377
2381
  def inactivate(evt):
2378
- self.handler('shell_inactivated', self)
2382
+ if self:
2383
+ self.handler('shell_inactivated', self)
2379
2384
  evt.Skip()
2380
2385
  self.Bind(wx.EVT_KILL_FOCUS, inactivate)
2381
2386
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 0.97.2
3
+ Version: 0.97.3
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,14 +1,14 @@
1
1
  mwx/__init__.py,sha256=nN62CGTWjME7Zz2h-jIRB8MxwuErIkHPGrlBzydkF0o,643
2
2
  mwx/bookshelf.py,sha256=ILKB13hX4riJnYFJmUvu2b1xa4uz8KxA1ZVuf4Y1zqM,5136
3
3
  mwx/controls.py,sha256=KAnzk2EeiBZsvJkfIHKIXo8bhxc6uVpC5CW802657ow,47815
4
- mwx/framework.py,sha256=4mawMkpnYUeESV0UTH3Qh79gki8MRbANl-f7EV75yOo,75249
4
+ mwx/framework.py,sha256=ro-UOz8GFUmBqiKAst5DIRcboRJ0_x2KXGjoGctBAkA,75249
5
5
  mwx/graphman.py,sha256=Y6PD9L-ee5hc7nwBkmTDDKXf6cGHkc5L-f6OW3QtD6M,70486
6
6
  mwx/images.py,sha256=_-Eh3xF7Khu42ivkYp97NXIzSNGbjcidqtWjZQFGtqE,47827
7
7
  mwx/matplot2.py,sha256=xCJ_ZzdDEWmzctpPaOrzTnwXyHINP4nfFHweoTZa6ug,32899
8
- mwx/matplot2g.py,sha256=arUt5WMQCOg56mQLxUVQqIVHJ-HzwV-YpPcZiLTWrz0,64129
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=Oiy9HEWrQAL4KPz0qveH8J1W8Nd4aDWMjWcO58ZMV10,137322
11
+ mwx/nutshell.py,sha256=4mUQCvtE0SZxlHRflrgKYGlMgvj2HY9LtBhAm9Rnnd8,137518
12
12
  mwx/utilus.py,sha256=8GK_2mGY08DVN5_SGWynLKQEJsCKqvqWTDToar1XozM,37333
13
13
  mwx/wxmon.py,sha256=f3V24EF7kdMlYF7usLYK9QE5KU6fSu0jVqsvwAiA-Ag,12647
14
14
  mwx/wxpdb.py,sha256=lLowkkAgMhPFHAfklD7wZHq0qbSMjRxnBFtSajmVgME,19133
@@ -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.2.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-0.97.2.dist-info/METADATA,sha256=dBXbEkroA5_XxikmiXvAEQix_YjHJoQiKN-sKABSyCs,1880
26
- mwxlib-0.97.2.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
27
- mwxlib-0.97.2.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-0.97.2.dist-info/RECORD,,
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,,