mwxlib 1.3.0__py3-none-any.whl → 1.3.11__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__ = "1.3.0"
4
+ __version__ = "1.3.11"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from contextlib import contextmanager
@@ -32,8 +32,9 @@ def deb(target=None, loop=True, locals=None, debrc=None, **kwargs):
32
32
  If None, the target is set to `__main__`.
33
33
  loop : If True, the app and the mainloop will be created.
34
34
  locals : Additional context of the shell
35
- debrc : file name of the session; defaults to None.
35
+ debrc : file name of the session. Defaults to None.
36
36
  If None, no session will be created or saved.
37
+ If `''`, the default session (.debrc) will be loaded.
37
38
 
38
39
  **kwargs: Nautilus ShellFrame arguments
39
40
 
@@ -872,23 +873,19 @@ class AuiNotebook(aui.AuiNotebook):
872
873
  self.Bind(aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN, tab_menu)
873
874
 
874
875
  @property
875
- def all_pages(self):
876
- """Returns all window pages."""
877
- return [self.GetPage(i) for i in range(self.PageCount)]
878
-
879
- @property
880
- def all_tabs(self):
881
- """Returns all AuiTabCtrl objects."""
876
+ def _all_tabs(self): # (deprecated) internal use only
877
+ """Returns all AuiTabCtrl objects (internal use only)."""
882
878
  return [x for x in self.Children if isinstance(x, aui.AuiTabCtrl)]
883
879
 
884
880
  @property
885
- def all_panes(self):
886
- """Returns all AuiPaneInfo excluding `dummy` one."""
881
+ def _all_panes(self): # (deprecated) internal use only
882
+ """Returns all AuiPaneInfo excluding `dummy` one (internal use only)."""
887
883
  return list(self._mgr.AllPanes)[1:]
888
884
 
889
885
  def get_pages(self, type=None):
890
886
  """Yields pages of the specified window type."""
891
- for win in self.all_pages:
887
+ for i in range(self.PageCount):
888
+ win = self.GetPage(i)
892
889
  if type is None or isinstance(win, type):
893
890
  yield win
894
891
 
@@ -926,7 +923,7 @@ class AuiNotebook(aui.AuiNotebook):
926
923
  Note:
927
924
  Argument `win` can also be page.window.Name (not page.caption).
928
925
  """
929
- for tabs in self.all_tabs: #<aui.AuiTabCtrl>
926
+ for tabs in self._all_tabs: #<aui.AuiTabCtrl>
930
927
  for page in tabs.Pages: #<aui.AuiNotebookPage>
931
928
  ## if page.window is win or page.caption == win:
932
929
  if page.window is win or page.window.Name == win:
@@ -944,8 +941,8 @@ class AuiNotebook(aui.AuiNotebook):
944
941
  tabs.AddPage(win, page) # Add a page with the copied info.
945
942
  if tc1.PageCount == 0:
946
943
  ## Delete an empty tab and the corresponding pane.
947
- j = self.all_tabs.index(tc1)
948
- pane = self.all_panes[j]
944
+ j = self._all_tabs.index(tc1)
945
+ pane = self._all_panes[j]
949
946
  tc1.Destroy()
950
947
  self._mgr.DetachPane(pane.window)
951
948
  self._mgr.Update()
@@ -961,10 +958,10 @@ class AuiNotebook(aui.AuiNotebook):
961
958
  Perspectives are saved according to page.window.Name.
962
959
  User should give it (not page.caption) a unique name.
963
960
  """
964
- for j, pane in enumerate(self.all_panes):
961
+ for j, pane in enumerate(self._all_panes):
965
962
  pane.name = f"pane{j+1}"
966
963
  spec = ""
967
- for j, tabs in enumerate(self.all_tabs):
964
+ for j, tabs in enumerate(self._all_tabs):
968
965
  k = next(k for k, page in enumerate(tabs.Pages)
969
966
  if page.window.Shown) # get active window
970
967
  ## names = [page.caption for page in tabs.Pages]
@@ -984,19 +981,19 @@ class AuiNotebook(aui.AuiNotebook):
984
981
  try:
985
982
  self.Parent.Freeze()
986
983
  ## Collapse all tabs to main tabctrl
987
- maintab = self.all_tabs[0]
988
- for win in self.all_pages:
984
+ maintab = self._all_tabs[0]
985
+ for win in self.get_pages():
989
986
  self.move_tab(win, maintab)
990
987
 
991
988
  ## Create a new tab using Split method.
992
989
  ## Note: The normal way of creating panes with `_mgr` crashes.
993
990
 
994
- all_names = [win.Name for win in self.all_pages]
991
+ all_names = [win.Name for win in self.get_pages()]
995
992
  for names, k in tabinfo[1:]:
996
993
  names, k = eval(names), int(k)
997
994
  i = all_names.index(names[0]) # Assuming 0:tab is included.
998
995
  self.Split(i, wx.LEFT)
999
- newtab = self.all_tabs[-1]
996
+ newtab = self._all_tabs[-1]
1000
997
  for name in names[1:]:
1001
998
  self.move_tab(name, newtab)
1002
999
  self.Selection = all_names.index(names[k]) # new tabs active window
@@ -1005,7 +1002,7 @@ class AuiNotebook(aui.AuiNotebook):
1005
1002
  names, k = eval(names), int(k)
1006
1003
  self.Selection = all_names.index(names[k]) # main tabs active window
1007
1004
 
1008
- for j, pane in enumerate(self.all_panes):
1005
+ for j, pane in enumerate(self._all_panes):
1009
1006
  pane.name = f"pane{j+1}"
1010
1007
  self._mgr.LoadPerspective(frames)
1011
1008
  self._mgr.Update()
@@ -1033,30 +1030,24 @@ class FileDropLoader(wx.DropTarget):
1033
1030
  index, flags = self.target.HitTest((x, y))
1034
1031
  if index != -1:
1035
1032
  self.target.Selection = index
1033
+ result = wx.DragCopy
1034
+ else:
1035
+ result = wx.DragNone
1036
1036
  return result
1037
1037
 
1038
1038
  def OnData(self, x, y, result):
1039
1039
  editor = self.target.Parent.current_editor
1040
1040
  self.GetData()
1041
- if self.textdo.TextLength > 1:
1042
- f = self.textdo.Text.strip()
1043
- res = editor.load_file(f)
1044
- if res:
1045
- editor.buffer.SetFocus()
1046
- editor.message(f"Loaded {f!r} successfully.")
1047
- result = wx.DragCopy
1048
- elif res is None:
1049
- editor.message(f"Loading {f!r} canceled.")
1050
- result = wx.DragCancel
1051
- else:
1052
- editor.message(f"Loading {f!r} failed.")
1053
- result = wx.DragNone
1054
- self.textdo.SetText('')
1041
+ if self.textdo.Text:
1042
+ fn = self.textdo.Text.strip()
1043
+ res = editor.parent.handler("text_dropped", fn)
1044
+ if res is None or not any(res):
1045
+ editor.load_file(fn)
1046
+ result = wx.DragCopy
1047
+ self.textdo.SetText("")
1055
1048
  else:
1056
- for f in self.filedo.Filenames:
1057
- if editor.load_file(f):
1058
- editor.buffer.SetFocus()
1059
- editor.message(f"Loaded {f!r} successfully.")
1049
+ for fn in self.filedo.Filenames:
1050
+ editor.load_file(fn)
1060
1051
  self.filedo.SetData(wx.DF_FILENAME, None)
1061
1052
  return result
1062
1053
 
@@ -1067,8 +1058,9 @@ class ShellFrame(MiniFrame):
1067
1058
  Args:
1068
1059
  target : target object of the rootshell.
1069
1060
  If None, it will be __main__.
1070
- session : file name of the session; defaults to None.
1061
+ session : file name of the session. Defaults to None.
1071
1062
  If None, no session will be created or saved.
1063
+ If `''`, the default session (.debrc) will be loaded.
1072
1064
  ensureClose : flag for the shell standalone.
1073
1065
  If True, EVT_CLOSE will close the window.
1074
1066
  Otherwise the window will be only hidden.
@@ -1188,7 +1180,7 @@ class ShellFrame(MiniFrame):
1188
1180
  self._mgr.AddPane(self.ghost,
1189
1181
  aui.AuiPaneInfo().Name("ghost")
1190
1182
  .Caption("Ghost in the Shell").Right()
1191
- .MaximizeButton().Show(0))
1183
+ .MaximizeButton().Show(1))
1192
1184
 
1193
1185
  self._mgr.AddPane(self.watcher,
1194
1186
  aui.AuiPaneInfo().Name("watcher")
@@ -1251,12 +1243,10 @@ class ShellFrame(MiniFrame):
1251
1243
  'trace_end' : [ None, self.on_trace_end ],
1252
1244
  'monitor_begin' : [ None, self.on_monitor_begin ],
1253
1245
  'monitor_end' : [ None, self.on_monitor_end ],
1254
- 'buffer_new' : [ None, ],
1255
1246
  'shell_new' : [ None, ],
1256
1247
  'add_log' : [ None, self.add_log ],
1257
1248
  'add_help' : [ None, self.add_help ],
1258
1249
  'title_window' : [ None, self.on_title_window ],
1259
- 'buffer_caption_updated' : [ None, self.on_buffer_caption ], # => self.OnActivate
1260
1250
  },
1261
1251
  0 : {
1262
1252
  '* pressed' : (0, fork_debugger),
@@ -1470,21 +1460,30 @@ class ShellFrame(MiniFrame):
1470
1460
  if not evt.Active:
1471
1461
  ## Reset autoload when active focus going outside.
1472
1462
  self.__autoload = True
1473
- elif evt.GetActivationReason() == evt.Reason_Mouse\
1474
- and self.__autoload:
1463
+ elif evt.GetActivationReason() == evt.Reason_Mouse and self.__autoload:
1475
1464
  ## Check all buffers that need to be loaded.
1465
+ verbose = 1
1476
1466
  for book in self.get_all_editors():
1477
1467
  for buf in book.get_all_buffers():
1478
1468
  if buf.need_buffer_load:
1479
- if wx.MessageBox( # Confirm load.
1480
- "The file has been modified externally.\n\n"
1481
- "The contents of the buffer will be overwritten.\n"
1482
- "Continue loading {}/{}?".format(book.Name, buf.name),
1483
- "Load {!r}".format(buf.name),
1484
- style=wx.YES_NO|wx.ICON_INFORMATION) != wx.YES:
1485
- self.__autoload = False # Don't ask any more.
1486
- return
1469
+ buf.update_caption()
1470
+ if verbose:
1471
+ with wx.MessageDialog(self, # Confirm load.
1472
+ "The file has been modified externally.\n\n"
1473
+ "The contents of the buffer will be overwritten.\n"
1474
+ "Continue loading {}/{}?".format(book.Name, buf.name),
1475
+ "Load {!r}".format(buf.name),
1476
+ style=wx.YES_NO|wx.CANCEL|wx.HELP|wx.ICON_INFORMATION) as dlg:
1477
+ dlg.SetHelpLabel("Yes to All")
1478
+ ret = dlg.ShowModal()
1479
+ if ret == wx.ID_NO:
1480
+ continue
1481
+ if ret == wx.ID_CANCEL:
1482
+ break # all
1483
+ if ret == wx.ID_HELP: # ID_YESTOALL
1484
+ verbose = 0
1487
1485
  book.load_file(buf.filename, buf.markline+1)
1486
+ self.__autoload = False
1488
1487
  ## Reinitialize self-specific builtins if other instances are destroyed.
1489
1488
  if evt.Active:
1490
1489
  self.Init()
@@ -1535,7 +1534,7 @@ class ShellFrame(MiniFrame):
1535
1534
 
1536
1535
  def OnConsolePageClose(self, evt): #<wx._aui.AuiNotebookEvent>
1537
1536
  nb = evt.EventObject
1538
- win = nb.all_pages[evt.Selection]
1537
+ win = list(nb.get_pages())[evt.Selection]
1539
1538
  if win is self.rootshell:
1540
1539
  ## self.message("Don't close the root shell.")
1541
1540
  nb.WindowStyle &= ~aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
@@ -1550,22 +1549,20 @@ class ShellFrame(MiniFrame):
1550
1549
  def About(self, evt=None):
1551
1550
  self.add_help(
1552
1551
  '\n\n'.join((
1553
- "#<module 'mwx' from {!r}>".format(__file__),
1554
- "Author: {!r}".format(__author__),
1555
- "Version: {!s}".format(__version__),
1552
+ f"#<module 'mwx' from {__file__!r}>",
1553
+ f"Author: {__author__!r}",
1554
+ f"Version: {__version__!s}",
1556
1555
  self.__class__.__doc__,
1557
1556
  self.rootshell.__class__.__doc__,
1558
-
1559
- ## Thanks to wx.py.shell.
1560
- "#{!r}".format(wx.py),
1561
- "Author: {!r}".format(wx.py.version.__author__),
1562
- "Version: {!s}".format(wx.py.version.VERSION),
1557
+ ## --- Thanks to <wx.py.shell> ---
1558
+ f"#{wx.py!r}",
1559
+ f"Author: {wx.py.version.__author__!r}",
1560
+ f"Version: {wx.py.version.VERSION!s}",
1563
1561
  wx.py.shell.Shell.__doc__,
1564
1562
  textwrap.indent("*original" + wx.py.shell.HELP_TEXT, ' '*4),
1565
-
1566
- ## Thanks are also due to wx.
1567
- "#{!r}".format(wx),
1568
- "To show the credit, press C-M-Mbutton.\n",
1563
+ ## --- Thanks are also due to <wx> ---
1564
+ ## f"#{wx!r}".format(wx),
1565
+ ## f"To show the credit, press [C-M-Mbutton].", # cf. wx.InfoMessageBox(None)
1569
1566
  ))
1570
1567
  )
1571
1568
 
@@ -1637,7 +1634,7 @@ class ShellFrame(MiniFrame):
1637
1634
  if m:
1638
1635
  filename, ln = m.groups()
1639
1636
  lineno = int(ln)
1640
- editor = self.find_editor(filename) or self.Log
1637
+ editor = next(self.get_all_editors(filename), self.Log)
1641
1638
  ret = editor.load_file(filename, lineno)
1642
1639
  if ret:
1643
1640
  self.popup_window(editor, show)
@@ -1837,23 +1834,16 @@ class ShellFrame(MiniFrame):
1837
1834
  title = obj if isinstance(obj, str) else repr(obj)
1838
1835
  self.SetTitle("Nautilus - {}".format(title))
1839
1836
 
1840
- def on_buffer_caption(self, buf):
1841
- """Called when the buffer caption is updated."""
1842
- if buf.caption_prefix.startswith('!'):
1843
- v = wx.ActivateEvent(wx.wxEVT_ACTIVATE, True,
1844
- buf.Id, ActivationReason=0)
1845
- self.EventHandler.ProcessEvent(v) # => self.OnActivate
1846
-
1847
1837
  def add_log(self, text, noerr=None):
1848
1838
  """Add text to the logging buffer.
1849
- If noerr <bool> is specified, add a line-marker.
1839
+ If noerr:bool is specified, add a line-mark.
1850
1840
  """
1851
1841
  buf = self.Log.default_buffer or self.Log.new_buffer()
1852
1842
  with buf.off_readonly():
1853
- buf.goto_char(buf.TextLength) # line to set an arrow marker
1843
+ buf.goto_char(buf.TextLength) # line to set an arrow mark
1854
1844
  buf.write(text)
1855
1845
  if noerr is not None:
1856
- ## Set a marker on the current line.
1846
+ ## Set a mark on the current line.
1857
1847
  buf.add_marker(buf.cline, 1 if noerr else 2) # 1:white 2:red-arrow
1858
1848
  return
1859
1849
 
@@ -1861,11 +1851,18 @@ class ShellFrame(MiniFrame):
1861
1851
  ## with open(self.LOGGING_FILE, 'a', encoding='utf-8', newline='') as o:
1862
1852
  ## o.write(text)
1863
1853
 
1864
- def add_help(self, text):
1865
- """Add text to the help buffer."""
1854
+ def add_help(self, text, title=None):
1855
+ """Add text to the help buffer.
1856
+ If title:str is specified, create a new buffer with that title.
1857
+ """
1866
1858
  buf = self.Help.default_buffer or self.Help.new_buffer()
1859
+ if title is not None:
1860
+ self.Help.find_file(f"*{title}*")
1861
+ buf = self.Help.buffer
1867
1862
  with buf.off_readonly():
1868
- buf.SetText(text)
1863
+ buf.Text = text
1864
+ buf.EmptyUndoBuffer()
1865
+ buf.SetSavePoint()
1869
1866
  ## Overwrite text and popup the window.
1870
1867
  self.popup_window(self.Help)
1871
1868
  self.Help.swap_page(buf)
@@ -1874,8 +1871,9 @@ class ShellFrame(MiniFrame):
1874
1871
  if not hasattr(target, '__dict__'):
1875
1872
  raise TypeError("primitive objects cannot be targeted")
1876
1873
 
1877
- shell = self.find_shell(target)
1878
- if not shell:
1874
+ try:
1875
+ shell = next(self.get_all_shells(target))
1876
+ except StopIteration:
1879
1877
  shell = self.rootshell.__class__(self, target, name="clone",
1880
1878
  style=wx.CLIP_CHILDREN|wx.BORDER_NONE)
1881
1879
  self.console.AddPage(shell, typename(shell.target))
@@ -1907,38 +1905,40 @@ class ShellFrame(MiniFrame):
1907
1905
  yield from self.console.get_pages(type)
1908
1906
  yield from self.ghost.get_pages(type)
1909
1907
 
1910
- def get_all_shells(self):
1911
- """Yields all shells in the notebooks."""
1912
- yield from self.console.get_pages(type(self.rootshell))
1913
-
1914
- def get_all_editors(self):
1915
- """Yields all editors in the notebooks."""
1916
- yield from self.ghost.get_pages(type(self.Log))
1908
+ def get_all_shells(self, target=None):
1909
+ """Yields all shells with specified target.
1910
+
1911
+ If the shell is found, it switches to the corresponding page.
1912
+ If `target` is not provided, it yields all shells in the notebooks.
1913
+ """
1914
+ if target is None:
1915
+ yield from self.console.get_pages(type(self.rootshell))
1916
+ else:
1917
+ for shell in self.console.get_pages(type(self.rootshell)):
1918
+ if shell.target is target:
1919
+ self.console.swap_page(shell)
1920
+ yield shell
1917
1921
 
1918
- @property
1919
- def all_shells(self): # (deprecated) for backward compatibility
1920
- """Yields all books in the notebooks."""
1921
- return self.console.get_pages(type(self.rootshell))
1922
+ def get_all_editors(self, fn=None):
1923
+ """Yields all editors with specified fn:filename or code.
1924
+
1925
+ If the editor is found, it switches to the corresponding page.
1926
+ If `fn` is not provided, it yields all editors in the notebooks.
1927
+ """
1928
+ if fn is None:
1929
+ yield from self.ghost.get_pages(type(self.Log))
1930
+ else:
1931
+ for book in self.ghost.get_pages(type(self.Log)):
1932
+ buf = book.find_buffer(fn)
1933
+ if buf:
1934
+ book.swap_page(buf)
1935
+ yield book
1922
1936
 
1923
1937
  @property
1924
1938
  def current_shell(self):
1925
1939
  """Currently selected shell or rootshell."""
1926
1940
  return self.console.CurrentPage
1927
1941
 
1928
- def find_shell(self, target):
1929
- """Find a shell targeting the specified object.
1930
- If found, switch to the corresponding page.
1931
- """
1932
- for shell in self.get_all_shells():
1933
- if shell.target is target:
1934
- self.console.swap_page(shell)
1935
- return shell
1936
-
1937
- @property
1938
- def all_editors(self): # (deprecated) for backward compatibility
1939
- """Yields all editors in the notebooks."""
1940
- return self.ghost.get_pages(type(self.Log))
1941
-
1942
1942
  @property
1943
1943
  def current_editor(self):
1944
1944
  """Currently selected editor or scratch."""
@@ -1947,16 +1947,6 @@ class ShellFrame(MiniFrame):
1947
1947
  return editor
1948
1948
  return next((x for x in self.get_all_editors() if x.IsShown()), self.Scratch)
1949
1949
 
1950
- def find_editor(self, fn):
1951
- """Find an editor containing the specified fn:filename or code.
1952
- If found, switch to the corresponding page.
1953
- """
1954
- for book in self.get_all_editors():
1955
- buf = book.find_buffer(fn)
1956
- if buf:
1957
- book.swap_page(buf)
1958
- return book
1959
-
1960
1950
  ## --------------------------------
1961
1951
  ## Find text dialog
1962
1952
  ## --------------------------------
mwx/graphman.py CHANGED
@@ -553,9 +553,9 @@ class Graph(GraphPlot):
553
553
  self.update_art_of_mark()
554
554
 
555
555
  def remove_markups(self):
556
- del self.Selector
557
- del self.Markers
558
- del self.Region
556
+ del self.selector
557
+ del self.markers
558
+ del self.region
559
559
 
560
560
  def hide_layers(self):
561
561
  for name in self.parent.plugins:
@@ -730,21 +730,21 @@ class Frame(mwx.Frame):
730
730
  (wx.ID_PASTE, "&Paste\t(C-v)", "Paste buffer from clipboard", Icon('paste'),
731
731
  lambda v: self.__view.read_buffer_from_clipboard()),
732
732
  (),
733
- (mwx.ID_(21), "Toggle &Markers", "Show/Hide markups", wx.ITEM_CHECK, Icon('+'),
733
+ (mwx.ID_(21), "Toggle &markers", "Show/Hide markups", wx.ITEM_CHECK, Icon('+'),
734
734
  lambda v: self.__view.set_markups_visible(v.IsChecked()),
735
735
  lambda v: v.Check(self.__view.get_markups_visible())),
736
736
 
737
- (mwx.ID_(22), "&Remove Markers", "Remove markups", Icon('-'),
737
+ (mwx.ID_(22), "&Remove markers", "Remove markups", Icon('-'),
738
738
  lambda v: self.__view.remove_markups()),
739
739
  (),
740
- (mwx.ID_(23), "Hide all &Layers", "Hide all layers", Icon('xr'),
740
+ (mwx.ID_(23), "Hide all &layers", "Hide all layers", Icon('xr'),
741
741
  lambda v: self.__view.hide_layers()),
742
742
  (),
743
- (mwx.ID_(24), "&Histogram\tCtrl-h", "Show Histogram window", wx.ITEM_CHECK,
743
+ (mwx.ID_(24), "&Histogram\tCtrl-h", "Show histogram window", wx.ITEM_CHECK,
744
744
  lambda v: self.show_pane(self.histogram, v.IsChecked()),
745
745
  lambda v: v.Check(self.histogram.IsShownOnScreen())),
746
746
 
747
- (mwx.ID_(25), "&Invert Color\t(C-i)", "Invert colormap", wx.ITEM_CHECK,
747
+ (mwx.ID_(25), "&Invert color\t(C-i)", "Invert colormap", wx.ITEM_CHECK,
748
748
  lambda v: self.__view.invert_cmap(),
749
749
  lambda v: v.Check(self.__view.get_cmap()[-2:] == "_r")),
750
750
  ]
@@ -764,10 +764,10 @@ class Frame(mwx.Frame):
764
764
  ## lambda v: self.__view.set_cmap('gray'),
765
765
  ## lambda v: v.Check(self.__view.get_cmap()[:4] == "gray")),
766
766
  ##
767
- ("Standard Colors",
767
+ ("Standard colors",
768
768
  [_cmenu(i, c) for i, c in enumerate(colours) if c.islower()]),
769
769
 
770
- ("Other Colors",
770
+ ("Other colors",
771
771
  [_cmenu(i, c) for i, c in enumerate(colours) if not c.islower()]),
772
772
  ]
773
773
 
@@ -887,7 +887,7 @@ class Frame(mwx.Frame):
887
887
  return
888
888
  self.Quit()
889
889
  break
890
- for frame in self.graph.all_frames:
890
+ for frame in self.graph.get_all_frames():
891
891
  if frame.pathname is None:
892
892
  if wx.MessageBox( # Confirm close.
893
893
  "You are closing unsaved frame.\n\n"
@@ -970,7 +970,7 @@ class Frame(mwx.Frame):
970
970
  win.handler('page_shown', win)
971
971
  elif not show and shown:
972
972
  if isinstance(win, aui.AuiNotebook):
973
- for plug in win.all_pages:
973
+ for plug in win.get_pages():
974
974
  plug.handler('page_closed', plug)
975
975
  else:
976
976
  win.handler('page_closed', win)
@@ -1016,7 +1016,7 @@ class Frame(mwx.Frame):
1016
1016
  pane = evt.GetPane()
1017
1017
  win = pane.window
1018
1018
  if isinstance(win, aui.AuiNotebook):
1019
- for plug in win.all_pages:
1019
+ for plug in win.get_pages():
1020
1020
  plug.handler('page_closed', plug)
1021
1021
  else:
1022
1022
  win.handler('page_closed', win)
@@ -1103,6 +1103,7 @@ class Frame(mwx.Frame):
1103
1103
  else:
1104
1104
  module = import_module(name)
1105
1105
  except Exception as e:
1106
+ traceback.print_exc()
1106
1107
  print(f"- Unable to load {root!r}.", e)
1107
1108
  return False
1108
1109
 
@@ -1425,7 +1426,7 @@ class Frame(mwx.Frame):
1425
1426
  """
1426
1427
  view = self.selected_view
1427
1428
  if not frames:
1428
- frames = view.all_frames
1429
+ frames = view.get_all_frames()
1429
1430
  if not frames:
1430
1431
  return None
1431
1432
 
@@ -1691,7 +1692,7 @@ class Frame(mwx.Frame):
1691
1692
  def save_buffers_as_tiffs(self, path=None, frames=None):
1692
1693
  """Save buffers to a file as a multi-page tiff."""
1693
1694
  if not frames:
1694
- frames = self.selected_view.all_frames
1695
+ frames = self.selected_view.get_all_frames()
1695
1696
  if not frames:
1696
1697
  return None
1697
1698
 
@@ -1810,7 +1811,7 @@ class Frame(mwx.Frame):
1810
1811
 
1811
1812
  def _save(view):
1812
1813
  name = view.Name
1813
- paths = [x.pathname for x in view.all_frames if x.pathname]
1814
+ paths = [x.pathname for x in view.get_all_frames() if x.pathname]
1814
1815
  o.write(f"self.{name}.unit = {view.unit:g}\n")
1815
1816
  o.write(f"self.load_frame({paths!r}, self.{name})\n")
1816
1817
  try:
mwx/matplot2.py CHANGED
@@ -457,12 +457,12 @@ class MatplotPanel(wx.Panel):
457
457
  self.canvas.draw()
458
458
 
459
459
  @property
460
- def Selector(self):
460
+ def selector(self):
461
461
  """Selected points array [[x],[y]]."""
462
462
  return np.array(self.selected.get_data(orig=0))
463
463
 
464
- @Selector.setter
465
- def Selector(self, v):
464
+ @selector.setter
465
+ def selector(self, v):
466
466
  x, y = v
467
467
  if not hasattr(x, '__iter__'):
468
468
  x, y = [x], [y]
@@ -472,8 +472,8 @@ class MatplotPanel(wx.Panel):
472
472
  self.draw(self.selected)
473
473
  self.trace_point(*v)
474
474
 
475
- @Selector.deleter
476
- def Selector(self):
475
+ @selector.deleter
476
+ def selector(self):
477
477
  self.selected.set_visible(0)
478
478
  self.selected.set_data([], [])
479
479
  self.handler('selector_removed', self.frame)
@@ -502,7 +502,7 @@ class MatplotPanel(wx.Panel):
502
502
  self.__isMenu = 0
503
503
 
504
504
  def on_pick(self, evt): #<matplotlib.backend_bases.PickEvent>
505
- """Find index near (x,y) and set the Selector.
505
+ """Find index near (x,y) and set the selector.
506
506
  Called (maybe) after mouse button pressed.
507
507
  """
508
508
  if evt.mouseevent.button != 1 or not evt.artist.get_visible():
@@ -527,7 +527,7 @@ class MatplotPanel(wx.Panel):
527
527
  evt.index = k = indices[distances.argmin()] # index of the nearest point
528
528
  evt.xdata = x = xs[k]
529
529
  evt.ydata = y = ys[k]
530
- self.Selector = ([x], [y])
530
+ self.selector = ([x], [y])
531
531
  self.canvas.draw_idle()
532
532
  self.handler('art_picked', evt)
533
533
  self.message("({:g}, {:g}) index {}".format(x, y, evt.index))
@@ -634,7 +634,7 @@ class MatplotPanel(wx.Panel):
634
634
 
635
635
  def OnMotion(self, evt):
636
636
  """Called when mouse moves in axes."""
637
- if not self.Selector.size:
637
+ if not self.selector.size:
638
638
  self.trace_point(evt.xdata, evt.ydata)
639
639
 
640
640
  def OnForwardPosition(self, evt):
@@ -656,7 +656,7 @@ class MatplotPanel(wx.Panel):
656
656
 
657
657
  def OnEscapeSelection(self, evt):
658
658
  """Escape from selection."""
659
- del self.Selector
659
+ del self.selector
660
660
  self.canvas.draw_idle()
661
661
 
662
662
  def zoomlim(self, lim, M, c=None):