mwxlib 0.99.1__py3-none-any.whl → 0.99.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/controls.py CHANGED
@@ -25,25 +25,26 @@ class Param:
25
25
 
26
26
  Args:
27
27
  name : label
28
- range : range
28
+ range : list of values
29
29
  value : std_value (default is None)
30
30
  fmt : text formatter or format:str (default is '%g')
31
31
  `hex` specifies hexadecimal format
32
- handler : called when control changed
33
- updater : called when check changed
32
+ handler : called when knob is handled.
33
+ updater : called when button is pressed.
34
+ checker : called when tick turns on/off.
34
35
 
35
36
  Attributes:
36
37
  knobs : knob list
37
38
  callback : single state machine that handles following events
38
39
 
39
- - control -> when index changed by knobs or reset (handler)
40
- - update -> when button pressed (updater)
41
- - check -> when check marked (updater)
40
+ - control -> when index is changed by knobs or reset (handler)
41
+ - updated -> when button is pressed (updater)
42
+ - checked -> when tick turns on/off (checker)
42
43
  - overflow -> when value overflows
43
44
  - underflow -> when value underflows
44
45
  """
45
46
  def __init__(self, name, range=None, value=None, fmt=None,
46
- handler=None, updater=None):
47
+ handler=None, updater=None, checker=None):
47
48
  self.knobs = []
48
49
  self.name = name
49
50
  self.range = range
@@ -60,8 +61,8 @@ class Param:
60
61
  self.__format = lambda v: fmt % v
61
62
  self.callback = SSM({
62
63
  'control' : [ _F(handler) ] if handler else [],
63
- 'update' : [ _F(updater) ] if updater else [],
64
- 'check' : [ _F(updater) ] if updater else [],
64
+ 'updated' : [ _F(updater) ] if updater else [],
65
+ 'checked' : [ _F(checker) ] if checker else [],
65
66
  'overflow' : [],
66
67
  'underflow' : [],
67
68
  })
@@ -110,13 +111,13 @@ class Param:
110
111
 
111
112
  @property
112
113
  def check(self):
113
- """A knob check property (user defined)."""
114
+ """A knob check-flag (user defined)."""
114
115
  return self.__check
115
116
 
116
117
  @check.setter
117
118
  def check(self, v):
118
119
  self.__check = bool(v)
119
- self.callback('check', self)
120
+ self.callback('checked', self)
120
121
 
121
122
  @property
122
123
  def name(self):
@@ -225,19 +226,21 @@ class LParam(Param):
225
226
 
226
227
  Args:
227
228
  name : label
228
- range : range [min:max:step]
229
+ range : range params [min:max:step]
229
230
  value : std_value (default is None)
230
231
  fmt : text formatter or format:str (default is '%g')
231
232
  `hex` specifies hexadecimal format
232
- handler : called when control changed
233
- updater : called when check changed
233
+ handler : called when knob is handled.
234
+ updater : called when button is pressed.
235
+ checker : called when tick turns on/off.
234
236
 
235
237
  Attributes:
236
238
  knobs : knob list
237
239
  callback : single state machine that handles following events
238
240
 
239
- - control -> when index changed by knobs or reset (handler)
240
- - check -> when check ticks on/off (updater)
241
+ - control -> when index is changed by knobs or reset (handler)
242
+ - updated -> when button is pressed (updater)
243
+ - checked -> when tick turns on/off (checker)
241
244
  - overflow -> when value overflows
242
245
  - underflow -> when value underflows
243
246
  """
@@ -296,8 +299,9 @@ class Knob(wx.Panel):
296
299
  type : ctrl type (slider[*], [hv]spin, choice, None)
297
300
  style : style of label
298
301
  None -> static text (default)
299
- chkbox -> label with check box
300
302
  button -> label with flat button
303
+ chkbox -> label with checkbox
304
+ checkbox -> label with checkbox
301
305
  cw : width of ctrl
302
306
  lw : width of label
303
307
  tw : width of textbox
@@ -339,19 +343,17 @@ class Knob(wx.Panel):
339
343
 
340
344
  label = self.__par.name + ' '
341
345
 
342
- if style == 'chkbox':
346
+ if style == 'chkbox' or style == 'checkbox':
343
347
  if lw >= 0:
344
348
  lw += 16
345
349
  self.label = wx.CheckBox(self, label=label, size=(lw,-1))
346
350
  self.label.Bind(wx.EVT_CHECKBOX, self.OnCheck)
347
-
348
351
  elif style == 'button':
349
352
  if lw >= 0:
350
353
  lw += 16
351
354
  self.label = pb.PlateButton(self, label=label, size=(lw,-1),
352
355
  style=pb.PB_STYLE_DEFAULT|pb.PB_STYLE_SQUARE)
353
356
  self.label.Bind(wx.EVT_BUTTON, self.OnPress)
354
-
355
357
  elif not style:
356
358
  self.label = wx.StaticText(self, label=label, size=(lw,-1))
357
359
  else:
@@ -536,7 +538,7 @@ class Knob(wx.Panel):
536
538
  evt.Skip()
537
539
 
538
540
  def OnPress(self, evt): #<wx._core.CommandEvent>
539
- self.__par.callback('update', self.__par)
541
+ self.__par.callback('updated', self.__par)
540
542
  evt.Skip()
541
543
 
542
544
  def Enable(self, p=True):
mwx/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "0.99.1"
4
+ __version__ = "0.99.2"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from contextlib import contextmanager
mwx/graphman.py CHANGED
@@ -336,6 +336,7 @@ class LayerInterface(CtrlInterface):
336
336
  'thread_error' : [ None ], # failed in error
337
337
  'page_shown' : [ None, _F(self.Draw, True) ],
338
338
  'page_closed' : [ None, _F(self.Draw, False) ],
339
+ 'page_hidden' : [ None, _F(self.Draw, False) ],
339
340
  },
340
341
  0 : {
341
342
  'C-c pressed' : (0, _F(copy_params)),
@@ -380,6 +381,7 @@ class LayerInterface(CtrlInterface):
380
381
  lambda v: Menu.Popup(self, self.menu))
381
382
 
382
383
  self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
384
+ self.Bind(wx.EVT_SHOW, self.OnShow)
383
385
 
384
386
  try:
385
387
  self.Init()
@@ -419,6 +421,16 @@ class LayerInterface(CtrlInterface):
419
421
  del self.Arts
420
422
  evt.Skip()
421
423
 
424
+ def OnShow(self, evt):
425
+ if not self:
426
+ return
427
+ if isinstance(self.Parent, aui.AuiNotebook):
428
+ if evt.IsShown():
429
+ self.handler('page_shown', self)
430
+ else:
431
+ self.handler('page_hidden', self)
432
+ evt.Skip()
433
+
422
434
  Shown = property(
423
435
  lambda self: self.IsShown(),
424
436
  lambda self,v: self.Show(v))
@@ -1001,7 +1013,7 @@ class Frame(mwx.Frame):
1001
1013
  plug.handler('page_closed', plug)
1002
1014
  else:
1003
1015
  win.handler('page_closed', win)
1004
- evt.Skip()
1016
+ evt.Skip(False) # Don't skip to avoid being called twice.
1005
1017
 
1006
1018
  ## --------------------------------
1007
1019
  ## Plugin <Layer> interface
mwx/utilus.py CHANGED
@@ -197,7 +197,7 @@ def typename(obj, docp=False, qualp=True):
197
197
 
198
198
  modname = getattr(obj, '__module__', None)
199
199
  if modname and modname != "__main__" and not modname.startswith('mwx'):
200
- name = modname + '.' + name
200
+ name = modname + ('.' if qualp else '..') + name
201
201
 
202
202
  if docp and callable(obj) and obj.__doc__:
203
203
  name += "<{!r}>".format(obj.__doc__.splitlines()[0]) # concat the first doc line
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 0.99.1
3
+ Version: 0.99.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,15 +1,15 @@
1
1
  mwx/__init__.py,sha256=nN62CGTWjME7Zz2h-jIRB8MxwuErIkHPGrlBzydkF0o,643
2
2
  mwx/bookshelf.py,sha256=so-xSLq08sMlJBErTxOaDoKUAMa_g1CkIP2pNnff68c,5607
3
- mwx/controls.py,sha256=IPd2MhiWncKcsNu9m0Pi3WJU61FXUdaup8v9XmgM4Zg,47795
4
- mwx/framework.py,sha256=UIFTHvaE3gjLg8LMep5_2XWIK-_XGbc6wsJ0jFkfq1Y,75587
5
- mwx/graphman.py,sha256=N34F5GXpN3ZEMfUIOswlM-OCIB1KObC6X1NTq_Qc2dk,69973
3
+ mwx/controls.py,sha256=1WTJEFeeGY9_gycGzHMQUdgBGgwc2QnvDnQPJ49bRZY,48053
4
+ mwx/framework.py,sha256=dCQ_xwPssrjBpGYLwxQRlKRHf-kX4tumFgZlVt7iQ3Q,75587
5
+ mwx/graphman.py,sha256=-klqkJ8h5Vi01Xe9H_N28m-59x2lbRe_ow3NHswnDZE,70433
6
6
  mwx/images.py,sha256=_-Eh3xF7Khu42ivkYp97NXIzSNGbjcidqtWjZQFGtqE,47827
7
7
  mwx/matplot2.py,sha256=xCJ_ZzdDEWmzctpPaOrzTnwXyHINP4nfFHweoTZa6ug,32899
8
8
  mwx/matplot2g.py,sha256=gCXa8X1MEMP7n_mG73h3SkWKuNZOfjVKUTWNRXXK11c,64310
9
9
  mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
10
10
  mwx/mgplt.py,sha256=0WJ1RN_Y0a4Y3rz1C_Lx-WhumtOMdb1N49guX9aZZ_o,5602
11
11
  mwx/nutshell.py,sha256=xoHTyWZ46geGy3u4aU8k8_-mr520EdGcvuQRO4TBU_A,140715
12
- mwx/utilus.py,sha256=B76pDg6_kW8FMNdQ6xO0Bwy4KJ0laY98Gg6N3iqV7c8,37325
12
+ mwx/utilus.py,sha256=iizdVrbwL1lX7eTfsMmltFz4IfHqTXVM37wwlPQ3A3Y,37346
13
13
  mwx/wxmon.py,sha256=Pq8XXigM_isJd80yiqG18iRVdArJpsePpxfnZOkk-Uw,12573
14
14
  mwx/wxpdb.py,sha256=lLowkkAgMhPFHAfklD7wZHq0qbSMjRxnBFtSajmVgME,19133
15
15
  mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
@@ -21,8 +21,8 @@ mwx/plugins/frame_listview.py,sha256=yEYPCdLHLSMTJwTv6iYAh3Lo4lJvYfp5BxTLP3FhW9Y
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.99.1.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-0.99.1.dist-info/METADATA,sha256=Hen3Gyc04u6p8FXYzfrB3fwK1h-OFhYVqzlqdMkCsbs,7411
26
- mwxlib-0.99.1.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
27
- mwxlib-0.99.1.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-0.99.1.dist-info/RECORD,,
24
+ mwxlib-0.99.2.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
+ mwxlib-0.99.2.dist-info/METADATA,sha256=fLuVjSWTwHhXJmBuIEwD-HCdHHhFPVHnXapKkretuvQ,7411
26
+ mwxlib-0.99.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
27
+ mwxlib-0.99.2.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
+ mwxlib-0.99.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5