mwxlib 0.94.6__py3-none-any.whl → 0.94.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/bookshelf.py CHANGED
@@ -27,8 +27,7 @@ class EditorTreeCtrl(wx.TreeCtrl, CtrlInterface):
27
27
  'buffer_deleted' : [ None, self.on_buffer_deleted ],
28
28
  'buffer_activated' : [ None, self.on_buffer_selected ],
29
29
  'buffer_inactivated' : [ None, ],
30
- 'buffer_caption_reset' : [ None, self.on_buffer_filename ],
31
- 'buffer_filename_reset' : [ None, self.on_buffer_filename ],
30
+ 'buffer_caption_updated' : [ None, self.on_buffer_filename ],
32
31
  },
33
32
  }
34
33
 
mwx/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "0.94.6"
4
+ __version__ = "0.94.8"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from functools import wraps, partial
@@ -1252,7 +1252,7 @@ class ShellFrame(MiniFrame):
1252
1252
  'add_log' : [ None, self.add_log ],
1253
1253
  'add_help' : [ None, self.add_help ],
1254
1254
  'title_window' : [ None, self.on_title_window ],
1255
- 'buffer_caption_reset' : [ None, self.on_buffer_caption ], # => self.OnActivate
1255
+ 'buffer_caption_updated' : [ None, self.on_buffer_caption ], # => self.OnActivate
1256
1256
  },
1257
1257
  0 : {
1258
1258
  '* pressed' : (0, fork_debugger),
@@ -1262,9 +1262,9 @@ class ShellFrame(MiniFrame):
1262
1262
  'C-f pressed' : (0, self.OnFindText),
1263
1263
  'f3 pressed' : (0, self.OnFindNext),
1264
1264
  'S-f3 pressed' : (0, self.OnFindPrev),
1265
- 'f11 pressed' : (0, _F(self.toggle_window, self.ghost, doc="Toggle ghost")),
1266
- 'S-f11 pressed' : (0, _F(self.toggle_window, self.watcher, doc="Toggle watcher")),
1267
- 'f12 pressed' : (0, _F(self.Close, alias="close", doc="Close the window")),
1265
+ 'f11 pressed' : (0, _F(self.toggle_window, self.ghost, alias='toggle_ghost')),
1266
+ 'S-f11 pressed' : (0, _F(self.toggle_window, self.watcher, alias='toggle_watcher')),
1267
+ 'f12 pressed' : (0, _F(self.Close, alias="close")),
1268
1268
  '*f[0-9]* pressed' : (0, ),
1269
1269
  },
1270
1270
  })
@@ -1291,8 +1291,8 @@ class ShellFrame(MiniFrame):
1291
1291
  self.SCRATCH_FILE = get_rootpath("scratch.py")
1292
1292
  self.LOGGING_FILE = get_rootpath("deb-logging.log")
1293
1293
 
1294
- wx.CallAfter(self.load_session,
1295
- os.path.abspath(debrc) if debrc else self.SESSION_FILE)
1294
+ self.load_session(
1295
+ os.path.abspath(debrc) if debrc else self.SESSION_FILE)
1296
1296
 
1297
1297
  def load_session(self, filename):
1298
1298
  """Load session from file."""
@@ -1348,9 +1348,9 @@ class ShellFrame(MiniFrame):
1348
1348
  "self.ghost.SetSelection({})".format(self.ghost.Selection),
1349
1349
  "self.watcher.SetSelection({})".format(self.watcher.Selection),
1350
1350
  ## Note: Perspectives should be called after all pages have been added.
1351
- "self._mgr.LoadPerspective({!r})".format(self._mgr.SavePerspective()),
1352
- "self.ghost.loadPerspective({!r})".format(self.ghost.savePerspective()),
1353
- "self.watcher.loadPerspective({!r})".format(self.watcher.savePerspective()),
1351
+ "wx.CallAfter(self._mgr.LoadPerspective, {!r})".format(self._mgr.SavePerspective()),
1352
+ "wx.CallAfter(self.ghost.loadPerspective, {!r})".format(self.ghost.savePerspective()),
1353
+ "wx.CallAfter(self.watcher.loadPerspective, {!r})".format(self.watcher.savePerspective()),
1354
1354
  "self._mgr.Update()\n",
1355
1355
  )))
1356
1356
 
@@ -1544,17 +1544,17 @@ class ShellFrame(MiniFrame):
1544
1544
  ))
1545
1545
  )
1546
1546
 
1547
- def toggle_window(self, win, focus=False):
1548
- self.popup_window(win, show=None, focus=focus)
1547
+ def toggle_window(self, win):
1548
+ pane = self._mgr.GetPane(win)
1549
+ if pane.IsDocked():
1550
+ if not self.console.IsShown():
1551
+ self._mgr.RestoreMaximizedPane()
1552
+ self._mgr.Update()
1553
+ return
1554
+ self.popup_window(win, not pane.IsShown())
1549
1555
 
1550
- def popup_window(self, win, show=True, focus=True):
1551
- """Show the notebook page and move the focus.
1552
-
1553
- Args:
1554
- win : window to popup
1555
- show : True, False, otherwise None:toggle
1556
- The pane window will be hidden if no show.
1557
- """
1556
+ def popup_window(self, win, show=True):
1557
+ """Show the notebook page and keep the focus."""
1558
1558
  wnd = wx.Window.FindFocus() # original focus
1559
1559
 
1560
1560
  for pane in self._mgr.GetAllPanes():
@@ -1569,12 +1569,7 @@ class ShellFrame(MiniFrame):
1569
1569
  else:
1570
1570
  return # no such pane.window
1571
1571
 
1572
- if show is None:
1573
- show = not pane.IsShown() # toggle show
1574
-
1575
- if focus and win.IsShown():
1576
- win.SetFocus() # move focus
1577
- elif wnd:
1572
+ if wnd:
1578
1573
  wnd.SetFocus() # restore focus
1579
1574
 
1580
1575
  ## Modify the floating position of the pane when displayed.
@@ -1605,14 +1600,14 @@ class ShellFrame(MiniFrame):
1605
1600
  self.indicator.Value = 1
1606
1601
  self.message("Quit")
1607
1602
 
1608
- def _load(self, filename, lineno, editor, verbose=False):
1603
+ def _load(self, filename, lineno, editor):
1609
1604
  """Load file in the session (internal use only)."""
1610
1605
  if isinstance(editor, str):
1611
1606
  editor = getattr(self, editor, None)
1612
1607
  if editor:
1613
- return editor.load_file(filename, lineno, verbose)
1608
+ return editor.load_file(filename, lineno, verbose=0)
1614
1609
 
1615
- def load(self, filename, lineno=0, show=True, focus=False):
1610
+ def load(self, filename, lineno=0, show=True):
1616
1611
  """Load file @where the object is defined.
1617
1612
 
1618
1613
  Args:
@@ -1620,7 +1615,6 @@ class ShellFrame(MiniFrame):
1620
1615
  It also supports <'filename:lineno'> format.
1621
1616
  lineno : Set mark to lineno on load.
1622
1617
  show : Show the page.
1623
- focus : Focus the window if visible.
1624
1618
  """
1625
1619
  if not isinstance(filename, str):
1626
1620
  filename = where(filename)
@@ -1634,7 +1628,7 @@ class ShellFrame(MiniFrame):
1634
1628
  editor = self.find_editor(filename) or self.Log
1635
1629
  ret = editor.load_file(filename, lineno, verbose=1)
1636
1630
  if ret:
1637
- self.popup_window(editor, show, focus)
1631
+ self.popup_window(editor, show)
1638
1632
  return ret
1639
1633
 
1640
1634
  def info(self, obj):
@@ -1646,11 +1640,11 @@ class ShellFrame(MiniFrame):
1646
1640
  def watch(self, obj):
1647
1641
  if isinstance(obj, wx.Object):
1648
1642
  self.monitor.watch(obj)
1649
- self.popup_window(self.monitor, focus=0)
1643
+ self.popup_window(self.monitor)
1650
1644
  elif hasattr(obj, '__dict__'):
1651
1645
  self.linfo.watch(obj.__dict__)
1652
1646
  self.ginfo.watch({})
1653
- self.popup_window(self.linfo, focus=0)
1647
+ self.popup_window(self.linfo)
1654
1648
 
1655
1649
  def highlight(self, obj, *args, **kwargs):
1656
1650
  self.inspector.highlight(obj, *args, **kwargs)
@@ -1732,8 +1726,8 @@ class ShellFrame(MiniFrame):
1732
1726
  shell.prompt()
1733
1727
  shell.SetFocus()
1734
1728
  self.Show()
1735
- self.popup_window(self.ghost, focus=0)
1736
- self.popup_window(self.linfo, focus=0)
1729
+ self.popup_window(self.ghost)
1730
+ self.popup_window(self.linfo)
1737
1731
  self.add_log("<-- Beginning of debugger\r\n")
1738
1732
  self.indicator.Value = 2
1739
1733
 
@@ -1749,7 +1743,7 @@ class ShellFrame(MiniFrame):
1749
1743
  if self.linfo.target is not ls:
1750
1744
  self.linfo.watch(ls)
1751
1745
  self.on_title_window(frame)
1752
- self.popup_window(self.debugger.editor, focus=0)
1746
+ self.popup_window(self.debugger.editor)
1753
1747
  dispatcher.send(signal='Interpreter.push',
1754
1748
  sender=shell, command=None, more=False)
1755
1749
  command = shell.cmdline
@@ -1855,7 +1849,7 @@ class ShellFrame(MiniFrame):
1855
1849
  with buf.off_readonly():
1856
1850
  buf.SetText(text)
1857
1851
  ## Overwrite text and popup the window.
1858
- self.popup_window(self.Help, focus=0)
1852
+ self.popup_window(self.Help)
1859
1853
 
1860
1854
  def clone_shell(self, target):
1861
1855
  if not hasattr(target, '__dict__'):
@@ -1865,8 +1859,8 @@ class ShellFrame(MiniFrame):
1865
1859
  style=wx.CLIP_CHILDREN|wx.BORDER_NONE)
1866
1860
  self.handler('shell_new', shell)
1867
1861
  self.console.AddPage(shell, typename(shell.target))
1868
- self.Show()
1869
- self.popup_window(shell, focus=1)
1862
+ self.popup_window(shell)
1863
+ shell.SetFocus()
1870
1864
  return shell
1871
1865
 
1872
1866
  def delete_shell(self, shell):
mwx/nutshell.py CHANGED
@@ -1386,15 +1386,13 @@ class Buffer(EditWindow, EditorInterface):
1386
1386
  def filename(self):
1387
1387
  return self.__filename
1388
1388
 
1389
- @filename.setter
1390
- def filename(self, fn):
1389
+ def update_filestamp(self, fn):
1391
1390
  if fn and os.path.isfile(fn):
1392
- self.__mtime = os.path.getmtime(fn)
1391
+ self.__mtime = os.path.getmtime(fn) # update timestamp (modified time)
1393
1392
  else:
1394
1393
  self.__mtime = None
1395
1394
  if self.__filename != fn:
1396
1395
  self.__filename = fn
1397
- self.parent.handler('buffer_filename_reset', self)
1398
1396
  self.update_caption()
1399
1397
 
1400
1398
  @property
@@ -1408,10 +1406,12 @@ class Buffer(EditWindow, EditorInterface):
1408
1406
  < 0 : a url file
1409
1407
  """
1410
1408
  fn = self.filename
1411
- if fn and os.path.isfile(fn):
1412
- return os.path.getmtime(fn) - self.__mtime
1413
- if fn and re.match(url_re, fn):
1414
- return -1
1409
+ if fn:
1410
+ if os.path.isfile(fn):
1411
+ return os.path.getmtime(fn) - self.__mtime
1412
+ if re.match(url_re, fn):
1413
+ return -1
1414
+ return None
1415
1415
 
1416
1416
  @property
1417
1417
  def caption_prefix(self):
@@ -1429,9 +1429,10 @@ class Buffer(EditWindow, EditorInterface):
1429
1429
  return prefix
1430
1430
 
1431
1431
  def update_caption(self):
1432
+ caption = self.caption_prefix + self.name
1432
1433
  try:
1433
- if self.parent.set_caption(self, self.caption_prefix + self.name):
1434
- self.parent.handler('buffer_caption_reset', self)
1434
+ if self.parent.set_caption(self, caption):
1435
+ self.parent.handler('buffer_caption_updated', self)
1435
1436
  except AttributeError:
1436
1437
  pass
1437
1438
 
@@ -1465,7 +1466,7 @@ class Buffer(EditWindow, EditorInterface):
1465
1466
 
1466
1467
  self.parent = parent
1467
1468
  self.__filename = filename
1468
- self.filename = filename
1469
+ self.update_filestamp(filename)
1469
1470
  self.code = None
1470
1471
 
1471
1472
  self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdate) # skip to brace matching
@@ -1590,13 +1591,13 @@ class Buffer(EditWindow, EditorInterface):
1590
1591
  self.Text = text
1591
1592
  self.EmptyUndoBuffer()
1592
1593
  self.SetSavePoint()
1593
- self.filename = filename
1594
+ self.update_filestamp(filename)
1594
1595
  self.handler('buffer_loaded', self)
1595
1596
 
1596
1597
  def _load_file(self, filename):
1597
1598
  """Wrapped method of LoadFile."""
1598
1599
  if self.LoadFile(filename):
1599
- self.filename = filename
1600
+ self.update_filestamp(filename)
1600
1601
  self.EmptyUndoBuffer()
1601
1602
  self.SetSavePoint()
1602
1603
  self.handler('buffer_loaded', self)
@@ -1606,7 +1607,7 @@ class Buffer(EditWindow, EditorInterface):
1606
1607
  def _save_file(self, filename):
1607
1608
  """Wrapped method of SaveFile."""
1608
1609
  if self.SaveFile(filename):
1609
- self.filename = filename
1610
+ self.update_filestamp(filename)
1610
1611
  self.SetSavePoint()
1611
1612
  self.handler('buffer_saved', self)
1612
1613
  return True
@@ -1769,8 +1770,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
1769
1770
  'buffer_modified' : [ None, dispatch ],
1770
1771
  'buffer_activated' : [ None, dispatch, self.on_activated ],
1771
1772
  'buffer_inactivated' : [ None, dispatch, self.on_inactivated ],
1772
- 'buffer_caption_reset' : [ None, dispatch ],
1773
- 'buffer_filename_reset' : [ None, dispatch ],
1773
+ 'buffer_caption_updated' : [ None, dispatch ],
1774
1774
  '*button* pressed' : [ None, dispatch, skip ],
1775
1775
  '*button* released' : [ None, dispatch, skip ],
1776
1776
  },
@@ -2884,7 +2884,7 @@ class Nautilus(Shell, EditorInterface):
2884
2884
  wx.CallAfter(_del)
2885
2885
 
2886
2886
  def on_activated(self, shell):
2887
- """Called when shell:self is activated.
2887
+ """Called when the shell:self is activated.
2888
2888
  Reset localvars assigned for the shell target.
2889
2889
  """
2890
2890
  self.trace_position()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 0.94.6
3
+ Version: 0.94.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
@@ -1,14 +1,14 @@
1
1
  mwx/__init__.py,sha256=zLsXDgqyC5NsPCjRxjS2huvZ3uDyeOJ1vapotqe2ULM,834
2
- mwx/bookshelf.py,sha256=UVVIwHaGO4aEHwZ8x5SKjpL-3MmQ1s6kkyuyRZqKWvU,5070
2
+ mwx/bookshelf.py,sha256=WEILqqxzGtdNUiUvn8oa4aTCSnzO11_MrV2L8sXKjXI,5000
3
3
  mwx/controls.py,sha256=prp1NhZqv1XANhi2PPxW9jtrgwj_02XMOOyyzZ48klM,47185
4
- mwx/framework.py,sha256=Wxpr9WDshKkKG4x91POCHgU2TZoFhW9X4U8O6Lbxnck,75581
4
+ mwx/framework.py,sha256=9ZWmc31eMBdtFPqTTd21dtyiYsiBA8U0MRuLzIMMVoI,75272
5
5
  mwx/graphman.py,sha256=9MG0BzQh5lDDadyPPXps2M0hf6mPN3G0MQbBGdplY_I,70027
6
6
  mwx/images.py,sha256=mrnUYH12I3XLVSZcEXlpVltX0XMxufbl2yRvDIQJZqc,49957
7
7
  mwx/matplot2.py,sha256=qaF_gvLoLn-TimLbRR59KUavNr1ZpZQdSMqjzJk47rk,32682
8
8
  mwx/matplot2g.py,sha256=mDaD367wjq6xsyIDX9ot8jLwYYGayoavWMhqsQVBHac,65442
9
9
  mwx/matplot2lg.py,sha256=tg8u7w4DxiJdPN-E197NOmbQpc_1gZkgDHYv_xUhbFA,27224
10
10
  mwx/mgplt.py,sha256=ITzxA97yDwr_35BUk5OqnyskSuKVDbpf2AQCKY1jHTI,5671
11
- mwx/nutshell.py,sha256=qz4qnEuGm5vEUtltux6caBLAoth92qc1zAyEmL6nbCg,135625
11
+ mwx/nutshell.py,sha256=SWlACsEHGtsLxw3l16TnNALNAB2_ObE7IO0eqo1s4eQ,135627
12
12
  mwx/utilus.py,sha256=FTJhVFmx6TAE5rvZ_nfxZgyyaW4zMpXEz74v72X6m7Y,37399
13
13
  mwx/wxmon.py,sha256=Qk86VbuuW2rR46pqEYLur13G_aloWz5SVv6sib30YY0,12717
14
14
  mwx/wxpdb.py,sha256=2z3ZD9Oo1H-ONBHlaprkB9hrTmAI7o03sqO46ppEFE4,19129
@@ -21,8 +21,8 @@ mwx/plugins/frame_listview.py,sha256=T-2xSv_D2bk9fJ64aiSEe1rJRTeqaIpLVAYEUXW5vz8
21
21
  mwx/plugins/line_profile.py,sha256=WJB5z7F53yg4dII2R36IFZvtkSOGWT669b1HmAAXSnQ,816
22
22
  mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
23
23
  mwx/py/filling.py,sha256=KaHooM32hrGGgqw75Cbt8lAvACwC6RXadob9LGgNnEc,16806
24
- mwxlib-0.94.6.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-0.94.6.dist-info/METADATA,sha256=jTXP1YrO9TOtK_CcgwIuZpoMNSKJ8H-VGmRfiqYoJgY,1925
26
- mwxlib-0.94.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
27
- mwxlib-0.94.6.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-0.94.6.dist-info/RECORD,,
24
+ mwxlib-0.94.8.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
+ mwxlib-0.94.8.dist-info/METADATA,sha256=fHCSJqHLZhgT8iK4xUBbA2apLus3rSQMqMh0w-O7DxU,1925
26
+ mwxlib-0.94.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
27
+ mwxlib-0.94.8.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
+ mwxlib-0.94.8.dist-info/RECORD,,