mwxlib 0.97.0__py3-none-any.whl → 0.97.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/bookshelf.py CHANGED
@@ -31,27 +31,16 @@ 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(evt):
40
+ def delete_item():
40
41
  data = self.GetItemData(self.Selection)
41
42
  if data:
42
- data.SetFocus()
43
-
44
- def refresh(evt, clear=False):
45
- self.build_tree(clear)
46
- if self.target:
47
- self.target.current_editor.SetFocus()
48
- wx.CallAfter(self.SetFocus)
49
-
50
- def delete(evt):
51
- data = self.GetItemData(self.Selection)
52
- if data:
53
- if data.mtdelta or data.Text:
54
- data.parent.kill_buffer(data) # -> focus moves
43
+ data.parent.kill_buffer(data) # -> focus moves
55
44
  wx.CallAfter(self.SetFocus)
56
45
 
57
46
  def dispatch(evt):
@@ -65,10 +54,9 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
65
54
  '*button* released' : [ None, dispatch ],
66
55
  },
67
56
  0 : {
68
- 'enter pressed' : (0, enter),
69
- 'delete pressed' : (0, delete),
70
- 'f5 pressed' : (0, refresh),
71
- '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)),
72
60
  },
73
61
  })
74
62
 
@@ -78,6 +66,8 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
78
66
  evt.Skip()
79
67
 
80
68
  def attach(self, target):
69
+ if not self:
70
+ return
81
71
  self.detach()
82
72
  self.target = target
83
73
  for editor in self.target.all_editors:
@@ -85,7 +75,7 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
85
75
  self.build_tree()
86
76
 
87
77
  def detach(self):
88
- if not self.target:
78
+ if not self or not self.target:
89
79
  return
90
80
  for editor in self.target.all_editors:
91
81
  editor.handler.remove(self.context)
@@ -135,19 +125,18 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
135
125
  ## Actions for bookshelf interfaces
136
126
  ## --------------------------------
137
127
 
138
- ## @postcall
139
128
  def on_buffer_new(self, buf):
140
129
  self.build_tree(clear=0)
141
130
 
142
- ## @postcall
143
131
  def on_buffer_deleted(self, buf):
144
132
  self.Delete(buf.__itemId)
145
133
 
134
+ ## Note: [buffer_activated][EVT_SET_FOCUS] > [buffer_new] の順で呼ばれる
135
+ ## buf.__itemId がない場合がある (delete_buffer 直後など)
146
136
  @postcall
147
137
  def on_buffer_selected(self, buf):
148
138
  self.SelectItem(buf.__itemId)
149
139
 
150
- @postcall
151
140
  def on_buffer_filename(self, buf):
152
141
  self.SetItemText(buf.__itemId, buf.caption_prefix + buf.name)
153
142
 
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):
@@ -1225,7 +1211,7 @@ class Indicator(wx.Control):
1225
1211
  self.__value = int(v)
1226
1212
  self.Refresh()
1227
1213
 
1228
- def update_design(self, **kwargs):
1214
+ def redesign(self, **kwargs):
1229
1215
  """Update multiple design properties at once.
1230
1216
 
1231
1217
  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.97.0"
4
+ __version__ = "0.97.2"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from functools import wraps, partial
@@ -54,16 +54,15 @@ def deb(target=None, loop=True, locals=None, **kwargs):
54
54
  kwargs.setdefault("ensureClose", True)
55
55
 
56
56
  app = wx.GetApp() or wx.App()
57
- try:
58
- frame = ShellFrame(None, target, **kwargs)
59
- frame.Show()
60
- frame.rootshell.SetFocus()
61
- if locals:
62
- frame.rootshell.locals.update(locals)
57
+ frame = ShellFrame(None, target, **kwargs)
58
+ frame.Show()
59
+ frame.rootshell.SetFocus()
60
+ if locals:
61
+ frame.rootshell.locals.update(locals)
62
+ if not loop:
63
63
  return frame
64
- finally:
65
- if loop and not app.GetMainLoop():
66
- app.MainLoop()
64
+ if not app.GetMainLoop():
65
+ return app.MainLoop()
67
66
 
68
67
 
69
68
  def postcall(f):
@@ -159,7 +158,7 @@ _speckeys = {
159
158
 
160
159
  _speckeys_wxkmap = dict((v, k) for k, v in _speckeys.items())
161
160
 
162
- def keyspec(key):
161
+ def getKeyState(key):
163
162
  """Returns state of speckey (cf. wx.GetKeyState)."""
164
163
  try:
165
164
  return wx.GetKeyState(_speckeys_wxkmap[key])
@@ -1112,7 +1111,6 @@ class ShellFrame(MiniFrame):
1112
1111
 
1113
1112
  self.Bookshelf = EditorTreeCtrl(self, name="Bookshelf",
1114
1113
  style=wx.TR_DEFAULT_STYLE|wx.TR_HIDE_ROOT)
1115
- wx.CallAfter(self.Bookshelf.attach, self)
1116
1114
 
1117
1115
  from .wxpdb import Debugger
1118
1116
  from .wxwit import Inspector
mwx/graphman.py CHANGED
@@ -895,8 +895,8 @@ class Frame(mwx.Frame):
895
895
  evt.Skip()
896
896
 
897
897
  def Destroy(self):
898
- for name in list(self.plugins):
899
- self.unload_plug(name) # => plug.Destroy
898
+ ## for name in list(self.plugins):
899
+ ## self.unload_plug(name) # => plug.Destroy
900
900
  self._mgr.UnInit()
901
901
  return mwx.Frame.Destroy(self)
902
902
 
@@ -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
@@ -272,7 +272,7 @@ class AxesImagePhantom(object):
272
272
  return self.parent.index(self)
273
273
 
274
274
  def update_buffer(self, buf=None):
275
- """Update buffer and the image."""
275
+ """Update buffer and the image (internal use only)."""
276
276
  if buf is not None:
277
277
  self.__buf = _to_buffer(buf)
278
278
 
@@ -286,7 +286,7 @@ class AxesImagePhantom(object):
286
286
  self.parent.handler('frame_modified', self)
287
287
 
288
288
  def update_extent(self):
289
- """Update logical extent of the image."""
289
+ """Update logical extent of the image (internal use only)."""
290
290
  h, w = self.__buf.shape[:2]
291
291
  ux, uy = self.xy_unit
292
292
  w *= ux/2
@@ -325,15 +325,12 @@ class AxesImagePhantom(object):
325
325
  return self.__buf[ny, nx] # nearest value
326
326
  return ndi.map_coordinates(self.__buf, np.vstack((ny, nx))) # spline value
327
327
 
328
- def xytopixel(self, x, y=None, cast=True):
328
+ def xytopixel(self, x, y, cast=True):
329
329
  """Convert xydata (x,y) -> [nx,ny] pixel.
330
330
  If cast, convert pixel-based lengths to pixel numbers.
331
331
  """
332
332
  def _cast(n):
333
333
  return np.int32(np.floor(np.round(n, 1)))
334
- if y is None:
335
- warn("Setting xy data with single tuple.", DeprecationWarning)
336
- x, y = x
337
334
  if isinstance(x, (list, tuple)):
338
335
  x = np.array(x)
339
336
  y = np.array(y)
@@ -345,11 +342,8 @@ class AxesImagePhantom(object):
345
342
  return (_cast(nx), _cast(ny))
346
343
  return (nx-0.5, ny-0.5)
347
344
 
348
- def xyfrompixel(self, nx, ny=None):
345
+ def xyfrompixel(self, nx, ny):
349
346
  """Convert pixel [nx,ny] -> (x,y) xydata (float number)."""
350
- if ny is None:
351
- warn("Setting xy data with single tuple.", DeprecationWarning)
352
- nx, ny = nx
353
347
  if isinstance(nx, (list, tuple)):
354
348
  nx = np.array(nx)
355
349
  ny = np.array(ny)
@@ -396,7 +390,7 @@ class GraphPlot(MatplotPanel):
396
390
  'pageup pressed' : [ None, self.OnPageUp ],
397
391
  'pagedown pressed' : [ None, self.OnPageDown ],
398
392
  'M-a pressed' : [ None, _F(self.fit_to_canvas) ],
399
- 'C-a pressed' : [ None, _F(self.update_axis) ],
393
+ 'C-a pressed' : [ None, _F(self.fit_to_axes) ],
400
394
  'C-i pressed' : [ None, _F(self.invert_cmap) ],
401
395
  'C-k pressed' : [ None, _F(self.kill_buffer) ],
402
396
  'C-S-k pressed' : [ None, _F(self.kill_buffer_all) ],
@@ -814,8 +808,6 @@ class GraphPlot(MatplotPanel):
814
808
  self.handler('frame_updated', art)
815
809
  self.canvas.draw_idle()
816
810
 
817
- globalunit = unit # for backward compatibility
818
-
819
811
  def kill_buffer(self):
820
812
  if self.buffer is not None:
821
813
  del self.buffer
@@ -823,8 +815,8 @@ class GraphPlot(MatplotPanel):
823
815
  def kill_buffer_all(self):
824
816
  del self[:]
825
817
 
826
- def update_axis(self):
827
- """Reset display range (xylim's), update home position."""
818
+ def fit_to_axes(self):
819
+ """Reset the view limits to the current frame extent."""
828
820
  if self.frame:
829
821
  self.axes.axis(self.frame.get_extent()) # reset xlim and ylim
830
822
  self.toolbar.update()
@@ -832,7 +824,7 @@ class GraphPlot(MatplotPanel):
832
824
  self.draw()
833
825
 
834
826
  def fit_to_canvas(self):
835
- """fit display range (xylim's) to canvas."""
827
+ """Reset the view limits to the canvas range."""
836
828
  x, y = self.xlim, self.ylim
837
829
  w, h = self.canvas.GetSize()
838
830
  r = h/w
@@ -1114,7 +1106,7 @@ class GraphPlot(MatplotPanel):
1114
1106
  self.select(i - 1)
1115
1107
 
1116
1108
  def OnHomePosition(self, evt):
1117
- self.update_axis()
1109
+ self.fit_to_axes()
1118
1110
 
1119
1111
  def OnEscapeSelection(self, evt):
1120
1112
  xs, ys = self.Selector
mwx/nutshell.py CHANGED
@@ -2006,8 +2006,6 @@ class EditorBook(AuiNotebook, CtrlInterface):
2006
2006
  self.delete_buffer(buf)
2007
2007
  return False
2008
2008
 
2009
- load_url = load_file # for backward compatibility
2010
-
2011
2009
  def find_file(self, filename=None):
2012
2010
  """Open the specified file."""
2013
2011
  if not filename:
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.0
3
+ Version: 0.97.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,14 +1,14 @@
1
1
  mwx/__init__.py,sha256=nN62CGTWjME7Zz2h-jIRB8MxwuErIkHPGrlBzydkF0o,643
2
- mwx/bookshelf.py,sha256=UgyVYHiYUL2wEvVw110vWnvkJBtXgYAE5hvz9MMLRsU,5333
3
- mwx/controls.py,sha256=s6yJzQyYnjCzcjXa6nbTJncxzpMI0E5zYWPn3-cFy5Q,48378
4
- mwx/framework.py,sha256=cXyfw0-PdkONYMHM-h9OsVIsOnDO3C1f4aDC5aYBP4o,75332
5
- mwx/graphman.py,sha256=VktL6fnYt2BBo-r7UVgVcqVd7IIOY9vpGBDNLNie088,70606
2
+ mwx/bookshelf.py,sha256=ILKB13hX4riJnYFJmUvu2b1xa4uz8KxA1ZVuf4Y1zqM,5136
3
+ mwx/controls.py,sha256=KAnzk2EeiBZsvJkfIHKIXo8bhxc6uVpC5CW802657ow,47815
4
+ mwx/framework.py,sha256=4mawMkpnYUeESV0UTH3Qh79gki8MRbANl-f7EV75yOo,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=jSyRTW9oUqAKA9L9Rcujxy1QLoFOVg411HjVNElexzQ,64401
8
+ mwx/matplot2g.py,sha256=arUt5WMQCOg56mQLxUVQqIVHJ-HzwV-YpPcZiLTWrz0,64129
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=Oiy9HEWrQAL4KPz0qveH8J1W8Nd4aDWMjWcO58ZMV10,137322
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.0.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-0.97.0.dist-info/METADATA,sha256=3nBiqPuPWhRv2W2keE3GqrTbXBNP9N0iWDOPDKPh6DA,1880
26
- mwxlib-0.97.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
27
- mwxlib-0.97.0.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-0.97.0.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.3.0)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5