mwxlib 0.97.1__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/bookshelf.py CHANGED
@@ -31,21 +31,13 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
31
31
  'buffer_caption_updated' : [ None, self.on_buffer_filename ],
32
32
  },
33
33
  }
34
+ wx.CallAfter(self.attach, target=parent)
34
35
 
35
36
  ## self.Bind(wx.EVT_TREE_ITEM_GETTOOLTIP, self.OnItemTooltip)
36
37
  self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged)
37
38
  self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
38
39
 
39
- def enter():
40
- data = self.GetItemData(self.Selection)
41
- if data:
42
- data.SetFocus()
43
-
44
- def refresh(clear=False):
45
- self.build_tree(clear)
46
- wx.CallAfter(self.SetFocus)
47
-
48
- def delete():
40
+ def delete_item():
49
41
  data = self.GetItemData(self.Selection)
50
42
  if data:
51
43
  data.parent.kill_buffer(data) # -> focus moves
@@ -62,10 +54,9 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
62
54
  '*button* released' : [ None, dispatch ],
63
55
  },
64
56
  0 : {
65
- 'enter pressed' : (0, _F(enter)),
66
- 'delete pressed' : (0, _F(delete)),
67
- 'f5 pressed' : (0, _F(refresh, clear=0)),
68
- 'S-f5 pressed' : (0, _F(refresh, clear=1)),
57
+ 'delete pressed' : (0, _F(delete_item)),
58
+ 'f5 pressed' : (0, _F(self.build_tree, clear=0)),
59
+ 'S-f5 pressed' : (0, _F(self.build_tree, clear=1)),
69
60
  },
70
61
  })
71
62
 
@@ -75,6 +66,8 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
75
66
  evt.Skip()
76
67
 
77
68
  def attach(self, target):
69
+ if not self:
70
+ return
78
71
  self.detach()
79
72
  self.target = target
80
73
  for editor in self.target.all_editors:
@@ -82,7 +75,7 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
82
75
  self.build_tree()
83
76
 
84
77
  def detach(self):
85
- if not self.target:
78
+ if not self or not self.target:
86
79
  return
87
80
  for editor in self.target.all_editors:
88
81
  editor.handler.remove(self.context)
mwx/controls.py CHANGED
@@ -84,14 +84,6 @@ class Param(object):
84
84
  def __len__(self):
85
85
  return len(self.range)
86
86
 
87
- def bind(self, action=None, target='control'):
88
- warn("Use `Param.callback.bind` instead.", DeprecationWarning)
89
- return self.callback.bind(target, action)
90
-
91
- def unbind(self, action=None, target='control'):
92
- warn("Use `Param.callback.unbind` instead.", DeprecationWarning)
93
- return self.callback.unbind(target, action)
94
-
95
87
  def reset(self, v=None, backcall=True):
96
88
  """Reset value when indexed (by knobs) with callback."""
97
89
  if v is None or v == '':
@@ -315,8 +307,7 @@ class Knob(wx.Panel):
315
307
  self.update_ctrl()
316
308
 
317
309
  def __init__(self, parent, param, type=None,
318
- style=None, editable=1, cw=-1, lw=-1, tw=-1, h=22,
319
- **kwargs):
310
+ style=None, cw=-1, lw=-1, tw=-1, h=22, **kwargs):
320
311
  wx.Panel.__init__(self, parent, **kwargs)
321
312
 
322
313
  assert isinstance(param, Param),\
@@ -359,9 +350,6 @@ class Knob(wx.Panel):
359
350
  self.label.SetToolTip(self.__par._tooltip)
360
351
  self.label.Enable(lw) # skip focus
361
352
 
362
- if not editable:
363
- warn("Knob option `editable` is deprecated.", DeprecationWarning)
364
-
365
353
  self.text = wx.TextCtrl(self, size=(tw,h), style=wx.TE_PROCESS_ENTER)
366
354
  self.text.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter)
367
355
  self.text.Bind(wx.EVT_KILL_FOCUS, self.OnTextExit)
@@ -926,8 +914,6 @@ class Icon(wx.Bitmap):
926
914
  bmp = wx.NullBitmap
927
915
  return bmp
928
916
 
929
- Icon2 = Icon # for backward compatibility
930
-
931
917
 
932
918
  def _getBitmap1(key, size=(16,16)):
933
919
  if isinstance(key, wx.Bitmap):
mwx/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "0.97.1"
4
+ __version__ = "0.97.3"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from functools import wraps, partial
@@ -1111,7 +1111,6 @@ class ShellFrame(MiniFrame):
1111
1111
 
1112
1112
  self.Bookshelf = EditorTreeCtrl(self, name="Bookshelf",
1113
1113
  style=wx.TR_DEFAULT_STYLE|wx.TR_HIDE_ROOT)
1114
- wx.CallAfter(self.Bookshelf.attach, self)
1115
1114
 
1116
1115
  from .wxpdb import Debugger
1117
1116
  from .wxwit import Inspector
mwx/graphman.py CHANGED
@@ -1477,9 +1477,6 @@ class Frame(mwx.Frame):
1477
1477
  print(self.message.read())
1478
1478
  return frames
1479
1479
 
1480
- import_index = load_index # for backward compatibility
1481
- export_index = save_index # for backward compatibility
1482
-
1483
1480
  ## --------------------------------
1484
1481
  ## load/save frames and attributes
1485
1482
  ## --------------------------------
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
 
@@ -332,11 +338,9 @@ class AxesImagePhantom(object):
332
338
  def _cast(n):
333
339
  return np.int32(np.floor(np.round(n, 1)))
334
340
  if y is None:
335
- warn("Setting xy data with single tuple.", DeprecationWarning)
341
+ ## warn("Setting xy data with single tuple.", DeprecationWarning)
336
342
  x, y = x
337
- if isinstance(x, (list, tuple)):
338
- x = np.array(x)
339
- y = np.array(y)
343
+ x, y = _to_array(x), _to_array(y)
340
344
  l,r,b,t = self.__art.get_extent()
341
345
  ux, uy = self.xy_unit
342
346
  nx = (x - l) / ux
@@ -348,11 +352,9 @@ class AxesImagePhantom(object):
348
352
  def xyfrompixel(self, nx, ny=None):
349
353
  """Convert pixel [nx,ny] -> (x,y) xydata (float number)."""
350
354
  if ny is None:
351
- warn("Setting xy data with single tuple.", DeprecationWarning)
355
+ ## warn("Setting xy data with single tuple.", DeprecationWarning)
352
356
  nx, ny = nx
353
- if isinstance(nx, (list, tuple)):
354
- nx = np.array(nx)
355
- ny = np.array(ny)
357
+ nx, ny = _to_array(nx), _to_array(ny)
356
358
  l,r,b,t = self.__art.get_extent()
357
359
  ux, uy = self.xy_unit
358
360
  x = l + (nx + 0.5) * ux
@@ -814,8 +816,6 @@ class GraphPlot(MatplotPanel):
814
816
  self.handler('frame_updated', art)
815
817
  self.canvas.draw_idle()
816
818
 
817
- globalunit = unit # for backward compatibility
818
-
819
819
  def kill_buffer(self):
820
820
  if self.buffer is not None:
821
821
  del self.buffer
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
 
@@ -2006,8 +2008,6 @@ class EditorBook(AuiNotebook, CtrlInterface):
2006
2008
  self.delete_buffer(buf)
2007
2009
  return False
2008
2010
 
2009
- load_url = load_file # for backward compatibility
2010
-
2011
2011
  def find_file(self, filename=None):
2012
2012
  """Open the specified file."""
2013
2013
  if not filename:
@@ -2020,6 +2020,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2020
2020
  return
2021
2021
  if not self.load_file(filename):
2022
2022
  buf = self.create_buffer(filename)
2023
+ buf._Buffer__mtime = 0 # => need_buffer_save
2023
2024
  self.swap_buffer(buf)
2024
2025
 
2025
2026
  open_buffer = find_file # for backward compatibility
@@ -2372,12 +2373,14 @@ class Nautilus(Shell, EditorInterface):
2372
2373
  self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
2373
2374
 
2374
2375
  def activate(evt):
2375
- self.handler('shell_activated', self)
2376
+ if self:
2377
+ self.handler('shell_activated', self)
2376
2378
  evt.Skip()
2377
2379
  self.Bind(wx.EVT_SET_FOCUS, activate)
2378
2380
 
2379
2381
  def inactivate(evt):
2380
- self.handler('shell_inactivated', self)
2382
+ if self:
2383
+ self.handler('shell_inactivated', self)
2381
2384
  evt.Skip()
2382
2385
  self.Bind(wx.EVT_KILL_FOCUS, inactivate)
2383
2386
 
mwx/py/filling.py CHANGED
@@ -1,8 +1,9 @@
1
1
  #! python3
2
2
  """Filling is the gui tree control through which a user can navigate
3
- the local namespace or any object."""
4
-
3
+ the local namespace or any object.
4
+ """
5
5
  __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
6
+ __author__ += "Kazuya O'moto <komoto@jeol.co.jp>"
6
7
  # Tags: py3-port
7
8
 
8
9
  import wx
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 0.97.1
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
- mwx/bookshelf.py,sha256=SiDYw0bMW-dHrPl2eP4ZEoQAn17f9XeEk8_0XbYw9DQ,5319
3
- mwx/controls.py,sha256=ebF16EOoDWndVdBh_x2TKLZ4WevkH91QkKWyEivfCjY,48373
4
- mwx/framework.py,sha256=ffCTDK7wMnAct-kaNXK3FoL8Bm0vECPDxXO1ordG2Og,75300
5
- mwx/graphman.py,sha256=NLklcxzTKklaL_FXpl5qW2apwAb3YuHH_NSr--PlqMQ,70612
2
+ mwx/bookshelf.py,sha256=ILKB13hX4riJnYFJmUvu2b1xa4uz8KxA1ZVuf4Y1zqM,5136
3
+ mwx/controls.py,sha256=KAnzk2EeiBZsvJkfIHKIXo8bhxc6uVpC5CW802657ow,47815
4
+ mwx/framework.py,sha256=ro-UOz8GFUmBqiKAst5DIRcboRJ0_x2KXGjoGctBAkA,75249
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=95J4tyA6VgKrTN7zPPGoo_f24kYAqKB5BOBordExNUg,64443
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=zrye6tLuGgyCC-Od323o71bauGDKFnO8Zsabs0JMqjs,137383
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
@@ -20,9 +20,9 @@ mwx/plugins/fft_view.py,sha256=xxTDD-_z4l18u4t2ybPB3xAMIslJmJ0gQlTxEqJUhNI,2782
20
20
  mwx/plugins/frame_listview.py,sha256=hbApzZWa9-BmQthu7uZBlBbGbtf4iJ_prO8IhxoGMs8,10421
21
21
  mwx/plugins/line_profile.py,sha256=--9NIc3x5EfRB3L59JvD7rzENQHyiYfu7wWJo6AuMkA,820
22
22
  mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
23
- mwx/py/filling.py,sha256=KaHooM32hrGGgqw75Cbt8lAvACwC6RXadob9LGgNnEc,16806
24
- mwxlib-0.97.1.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-0.97.1.dist-info/METADATA,sha256=2iRI3XivGubsXjavm_XGa1fkwoFx5MjiWFbWnNqhrko,1880
26
- mwxlib-0.97.1.dist-info/WHEEL,sha256=rWxmBtp7hEUqVLOnTaDOPpR-cZpCDkzhhcBce-Zyd5k,91
27
- mwxlib-0.97.1.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-0.97.1.dist-info/RECORD,,
23
+ mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (71.0.4)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5