mwxlib 0.84.6__py3-none-any.whl → 0.84.8__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
@@ -4,7 +4,7 @@
4
4
 
5
5
  Author: Kazuya O'moto <komoto@jeol.co.jp>
6
6
  """
7
- __version__ = "0.84.6"
7
+ __version__ = "0.84.8"
8
8
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
9
9
 
10
10
  from functools import wraps, partial
mwx/graphman.py CHANGED
@@ -201,6 +201,7 @@ class LayerInterface(CtrlInterface):
201
201
 
202
202
  Note:
203
203
  parent <Frame> is not always equal to Parent when floating.
204
+ Parent type can be <Frame>, <AuiFloatingFrame>, or <AuiNotebook>.
204
205
  """
205
206
  MENU = "Plugins" # default menu for Plugins
206
207
  menukey = property(lambda self: "{}/&{}".format(self.MENU, self.__module__))
@@ -222,7 +223,7 @@ class LayerInterface(CtrlInterface):
222
223
  ## funcall = interactive_call
223
224
  funcall = staticmethod(_F)
224
225
 
225
- ## for debug
226
+ ## for debug (internal use only)
226
227
  pane = property(lambda self: self.parent.get_pane(self))
227
228
 
228
229
  @property
@@ -350,10 +351,11 @@ class LayerInterface(CtrlInterface):
350
351
  self.Bind(wx.EVT_WINDOW_DESTROY, destroy)
351
352
 
352
353
  def on_show(v):
353
- if v.IsShown():
354
- self.handler('page_shown', self)
355
- else:
356
- self.handler('page_hidden', self)
354
+ if self.category: # -> notebook
355
+ if v.IsShown():
356
+ self.handler('page_shown', self)
357
+ else:
358
+ self.handler('page_hidden', self)
357
359
  v.Skip()
358
360
  self.Bind(wx.EVT_SHOW, on_show)
359
361
 
@@ -831,17 +833,14 @@ class Frame(mwx.Frame):
831
833
  if name in self.plugins:
832
834
  plug = self.plugins[name].__plug__
833
835
  name = plug.category or name
834
- elif _isLayer(name):
835
- if name: # Check if wrapped C/C++ object of Layer has been deleted.
836
- name = name.category or name
837
- else:
838
- name = '' # to return a dummy pane
836
+ elif name and _isLayer(name):
837
+ ## Also check if wrapped C/C++ object of Layer has been deleted.
838
+ name = name.category or name
839
839
  return self._mgr.GetPane(name)
840
840
 
841
- def show_pane(self, name, show=True):
841
+ def show_pane(self, name, show=True, interactive=False):
842
842
  """Show named pane or notebook pane."""
843
843
  pane = self.get_pane(name)
844
- plug = self.get_plug(name)
845
844
  if not pane.IsOk():
846
845
  return
847
846
 
@@ -851,7 +850,7 @@ class Frame(mwx.Frame):
851
850
  pane.best_size = (w//2, h) # ドッキング時に再計算される
852
851
 
853
852
  ## Force Layer windows to show.
854
- if _isLayer(plug):
853
+ if interactive:
855
854
  ## [M-menu] Reload plugin (ret: None if succeeded).
856
855
  if wx.GetKeyState(wx.WXK_ALT):
857
856
  self.reload_plug(name)
@@ -864,24 +863,22 @@ class Frame(mwx.Frame):
864
863
  pane.Float()
865
864
  show = True
866
865
 
867
- self._show_pane(name, show)
868
- self._mgr.Update()
869
-
870
- def _show_pane(self, name, show=True):
871
- """Show named pane window (internal use only)."""
872
- pane = self.get_pane(name)
873
- plug = self.get_plug(name)
874
- if plug:
875
- nb = plug.__notebook # given when load_plug
876
- if nb and show:
877
- nb.SetSelection(nb.GetPageIndex(plug))
878
-
879
- win = plug or pane.window
866
+ plug = self.get_plug(name) # -> None if pane.window is Graph
867
+ win = pane.window # -> Window (plug / notebook / Graph)
880
868
  if show:
881
- if not pane.IsShown():
869
+ if isinstance(win, aui.AuiNotebook):
870
+ j = win.GetPageIndex(plug)
871
+ if j != win.Selection:
872
+ win.Selection = j # the focus is moved => [page_shown]
873
+ else:
874
+ plug.handler('page_shown', plug)
875
+ elif not pane.IsShown():
882
876
  win.handler('page_shown', win)
883
877
  else:
884
- if pane.IsShown():
878
+ if isinstance(win, aui.AuiNotebook):
879
+ for plug in win.all_pages: # => [page_closed] to all pages
880
+ plug.handler('page_closed', plug)
881
+ elif pane.IsShown():
885
882
  win.handler('page_closed', win)
886
883
 
887
884
  ## Modify the floating position of the pane when displayed.
@@ -890,6 +887,7 @@ class Frame(mwx.Frame):
890
887
  if wx.Display.GetFromWindow(pane.window) == -1:
891
888
  pane.floating_pos = wx.GetMousePosition()
892
889
  pane.Show(show)
890
+ self._mgr.Update()
893
891
 
894
892
  def update_pane(self, name, show=False, **kwargs):
895
893
  """Update the layout of the pane.
@@ -923,7 +921,7 @@ class Frame(mwx.Frame):
923
921
  pane.Dock()
924
922
  else:
925
923
  pane.Float()
926
- self._show_pane(name, show)
924
+ self.show_pane(name, show)
927
925
  self._mgr.Update()
928
926
 
929
927
  def OnPaneClose(self, evt): #<wx.aui.AuiManagerEvent>
@@ -968,9 +966,9 @@ class Frame(mwx.Frame):
968
966
  name,_ = os.path.splitext(os.path.basename(name))
969
967
  if name in self.plugins:
970
968
  return self.plugins[name].__plug__
971
- elif _isLayer(name):
972
- if name: # Check if wrapped C/C++ object of Layer has been deleted.
973
- return name
969
+ elif name and _isLayer(name):
970
+ ## Also check if wrapped C/C++ object of Layer has been deleted.
971
+ return name
974
972
 
975
973
  @staticmethod
976
974
  def register(cls, module=None):
@@ -1099,7 +1097,7 @@ class Frame(mwx.Frame):
1099
1097
 
1100
1098
  module = self.load_module(root, force, session, **props)
1101
1099
  if not module:
1102
- return module # None or False
1100
+ return module # None (if not force) or False (failed to import)
1103
1101
 
1104
1102
  try:
1105
1103
  name = module.Plugin.__module__
@@ -1187,13 +1185,14 @@ class Frame(mwx.Frame):
1187
1185
  .Name(name).Caption(caption)
1188
1186
  .FloatingSize(size).MinSize(size).Show(0))
1189
1187
 
1190
- ## set reference of notebook (optional)
1191
- plug.__notebook = nb
1192
- plug.__Menu_item = None
1188
+ ## Set winow.Name for inspection.
1193
1189
  plug.Name = name
1190
+
1194
1191
  self.update_pane(name, **props)
1195
1192
 
1196
1193
  ## Create a menu
1194
+ plug.__Menu_item = None
1195
+
1197
1196
  if not hasattr(module, 'ID_'): # give a unique index to the module
1198
1197
  global __plug_ID__ # cache ID *not* in [ID_LOWEST(4999):ID_HIGHEST(5999)]
1199
1198
  try:
@@ -1210,7 +1209,7 @@ class Frame(mwx.Frame):
1210
1209
  hint = (plug.__doc__ or name).strip().splitlines()[0]
1211
1210
  plug.__Menu_item = (
1212
1211
  module.ID_, text, hint, wx.ITEM_CHECK,
1213
- lambda v: self.show_pane(name, v.IsChecked()),
1212
+ lambda v: self.show_pane(name, v.IsChecked(), interactive=1),
1214
1213
  lambda v: v.Check(self.get_pane(name).IsShown()),
1215
1214
  )
1216
1215
  if menu not in self.menubar:
@@ -1238,12 +1237,13 @@ class Frame(mwx.Frame):
1238
1237
  self.menubar[menu].remove(plug.__Menu_item)
1239
1238
  self.menubar.update(menu)
1240
1239
 
1241
- nb = plug.__notebook
1242
- if nb:
1240
+ if isinstance(plug.Parent, aui.AuiNotebook):
1241
+ nb = plug.Parent
1243
1242
  j = nb.GetPageIndex(plug)
1244
1243
  nb.RemovePage(j) # just remove page
1245
1244
  ## nb.DeletePage(j) # cf. destroy plug object too
1246
1245
  else:
1246
+ nb = None
1247
1247
  self._mgr.DetachPane(plug)
1248
1248
  self._mgr.Update()
1249
1249
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 0.84.6
3
+ Version: 0.84.8
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 <komoto@jeol.co.jp>
@@ -1,7 +1,7 @@
1
1
  mwx/__init__.py,sha256=bSRdncjfSCKycMFQVnagOi9R2vUCC5snGkjea7jqPgU,2520
2
2
  mwx/controls.py,sha256=pD1IjgkwdvD-ebntnAH-6Jo7KY5hDq30Ne6rTE_i9fE,43499
3
- mwx/framework.py,sha256=_xEyhQCLiybNR5mjO11x8RzzxXwcrM2ZQw5GmA3I0nY,73816
4
- mwx/graphman.py,sha256=g5pRrWysU-9yK3RY72hlu2nUM93ZK4NZQB-3E_nMH6U,68211
3
+ mwx/framework.py,sha256=FREzT3tMg6wXLvVmJhRMEuc8KHLH655JT0Zoxtc5a3E,73816
4
+ mwx/graphman.py,sha256=rDOYa3IZVp48hD0bio7fCwIG0-dNWjdZHm1cvfINszY,68561
5
5
  mwx/images.py,sha256=9e8X7OpJ6Z3fF3ez17P_qk2D1NMO10-lN8TCtulAqT0,46248
6
6
  mwx/matplot2.py,sha256=W_FpY0S33crCAh7N9YTXo-jgYzj8uL9gqXkekfQo7Pk,36017
7
7
  mwx/matplot2g.py,sha256=cBuLMnQt3XSKQL9io0XJb_v8Lv0pO9hm0IMjVIERtu4,68253
@@ -15,8 +15,8 @@ mwx/wxwil.py,sha256=DPXXx4OdEzvHr-_jxz9J29Ozufmb6Vr7rXVkG_LKQd0,5254
15
15
  mwx/wxwit.py,sha256=UG361QTUheO_hlSIRgkprrGUYh0IzHB8ZqOoJeeMzUs,7424
16
16
  mwx/py/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  mwx/py/filling.py,sha256=f6KMBcBv7gwrl6qmJYLTL-O0Z47bWNAdTCZtUZIo8vM,16794
18
- mwxlib-0.84.6.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
19
- mwxlib-0.84.6.dist-info/METADATA,sha256=wizHJAqVB8N_Bgam9rtlHXf65O1k2QKV4DbbUYNOIOM,1893
20
- mwxlib-0.84.6.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
21
- mwxlib-0.84.6.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
22
- mwxlib-0.84.6.dist-info/RECORD,,
18
+ mwxlib-0.84.8.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
19
+ mwxlib-0.84.8.dist-info/METADATA,sha256=xZ7328VNHvIs8oA83rx-zd5jDLlh6jTIQfGO6kg3NkI,1893
20
+ mwxlib-0.84.8.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
21
+ mwxlib-0.84.8.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
22
+ mwxlib-0.84.8.dist-info/RECORD,,