mwxlib 0.94.5__py3-none-any.whl → 0.94.6__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
@@ -741,7 +741,7 @@ class ControlPanel(scrolled.ScrolledPanel):
741
741
  except AttributeError:
742
742
  p.value = v
743
743
  except Exception as e: # failed to eval
744
- print("- Failed to reset {!r}: {}".format(p, e))
744
+ print(f"- Failed to reset {p!r}:", e)
745
745
  pass
746
746
 
747
747
  reset_params = set_params #: for backward compatibility
mwx/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "0.94.5"
4
+ __version__ = "0.94.6"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from functools import wraps, partial
@@ -294,12 +294,14 @@ class KeyCtrlInterfaceMixin:
294
294
  key += ' pressed'
295
295
 
296
296
  if map not in self.handler:
297
- warnings.warn(f"New map to define_key {keymap!r} in {self}.", stacklevel=2)
297
+ warnings.warn(f"New map to define_key {keymap!r} in {self}.",
298
+ stacklevel=2)
298
299
  self.make_keymap(map) # make new keymap
299
300
 
300
301
  transaction = self.handler[map].get(key, [state])
301
302
  if len(transaction) > 1:
302
- warnings.warn(f"Duplicate define_key {keymap!r} in {self}.", stacklevel=2)
303
+ warnings.warn(f"Duplicate define_key {keymap!r} in {self}.",
304
+ stacklevel=2)
303
305
 
304
306
  if action is None:
305
307
  self.handler[map].pop(key, None) # cf. undefine_key
@@ -325,7 +327,8 @@ class CtrlInterface(KeyCtrlInterfaceMixin):
325
327
 
326
328
  def __init__(self):
327
329
  if hasattr(self, 'handler'):
328
- warnings.warn(f"Duplicate iniheritance of CtrlInterface by {self}.", stacklevel=2)
330
+ warnings.warn(f"Duplicate iniheritance of CtrlInterface by {self}.",
331
+ stacklevel=2)
329
332
  return
330
333
  self.__key = ''
331
334
  self.__button = ''
@@ -630,7 +633,8 @@ class MenuBar(wx.MenuBar, TreeList):
630
633
  Call when the menulist is changed.
631
634
  """
632
635
  if not self.Parent:
633
- warnings.warn(f"No parents bound to {self}.", stacklevel=2)
636
+ warnings.warn(f"No parents bound to {self}.",
637
+ stacklevel=2)
634
638
  return
635
639
 
636
640
  menu = self.getmenu(key)
@@ -657,7 +661,8 @@ class MenuBar(wx.MenuBar, TreeList):
657
661
  Call when the menulist is changed.
658
662
  """
659
663
  if not self.Parent:
660
- warnings.warn(f"No parents bound to {self}.", stacklevel=2)
664
+ warnings.warn(f"No parents bound to {self}.",
665
+ stacklevel=2)
661
666
  return
662
667
 
663
668
  for j in range(self.GetMenuCount()): # remove and del all top-level menu
@@ -1173,15 +1178,18 @@ class ShellFrame(MiniFrame):
1173
1178
  self._mgr.SetDockSizeConstraint(0.5, 0.5) # (w, h)/N
1174
1179
 
1175
1180
  self._mgr.AddPane(self.console,
1176
- aui.AuiPaneInfo().Name("console").CenterPane().Show(1))
1181
+ aui.AuiPaneInfo().Name("console").CenterPane()
1182
+ .MaximizeButton().Show(1))
1177
1183
 
1178
1184
  self._mgr.AddPane(self.ghost,
1179
1185
  aui.AuiPaneInfo().Name("ghost")
1180
- .Caption("Ghost in the Shell").Right().Show(0))
1186
+ .Caption("Ghost in the Shell").Right()
1187
+ .MaximizeButton().Show(0))
1181
1188
 
1182
1189
  self._mgr.AddPane(self.watcher,
1183
1190
  aui.AuiPaneInfo().Name("watcher")
1184
- .Caption("Watchdog in the Shell").Right().Position(1).Show(0))
1191
+ .Caption("Watchdog in the Shell").Right().Position(1)
1192
+ .MaximizeButton().Show(0))
1185
1193
 
1186
1194
  self._mgr.Update()
1187
1195
 
@@ -1261,35 +1269,30 @@ class ShellFrame(MiniFrame):
1261
1269
  },
1262
1270
  })
1263
1271
 
1264
- ## py-mode
1265
1272
  self.Scratch.set_attributes(Style=Nautilus.STYLE)
1273
+ self.Log.set_attributes(ReadOnly=True)
1274
+ self.Help.set_attributes(ReadOnly=True)
1266
1275
 
1267
1276
  self.set_hookable(self.Scratch)
1277
+ self.set_hookable(self.Log)
1268
1278
 
1269
1279
  @self.Scratch.define_key('C-j')
1270
- @postcall
1271
1280
  def eval_line():
1272
1281
  shell = self.current_shell
1273
1282
  self.Scratch.buffer.py_eval_line(shell.globals, shell.locals)
1274
1283
 
1275
1284
  @self.Scratch.define_key('C-S-j')
1276
- @postcall
1277
1285
  def eval_buffer():
1278
1286
  shell = self.current_shell
1279
1287
  self.Scratch.buffer.py_exec_region(shell.globals, shell.locals)
1280
1288
 
1281
- ## text-mode
1282
- self.set_hookable(self.Log)
1283
-
1284
- self.Log.set_attributes(ReadOnly=True)
1285
- self.Help.set_attributes(ReadOnly=True)
1286
-
1287
- self.load_session(
1288
- os.path.abspath(debrc) if debrc else self.SESSION_FILE)
1289
+ ## Session
1290
+ self.SESSION_FILE = get_rootpath(".debrc")
1291
+ self.SCRATCH_FILE = get_rootpath("scratch.py")
1292
+ self.LOGGING_FILE = get_rootpath("deb-logging.log")
1289
1293
 
1290
- SESSION_FILE = get_rootpath(".debrc")
1291
- SCRATCH_FILE = get_rootpath("scratch.py")
1292
- LOGGING_FILE = get_rootpath("deb-logging.log")
1294
+ wx.CallAfter(self.load_session,
1295
+ os.path.abspath(debrc) if debrc else self.SESSION_FILE)
1293
1296
 
1294
1297
  def load_session(self, filename):
1295
1298
  """Load session from file."""
@@ -1301,14 +1304,11 @@ class ShellFrame(MiniFrame):
1301
1304
  except Exception:
1302
1305
  pass
1303
1306
 
1304
- for book in self.all_editors:
1305
- book.delete_all_buffers() # Note: *log* is also flushed.
1307
+ _fload(self.Scratch, self.SCRATCH_FILE) # restore scratch
1306
1308
 
1307
1309
  ## Re-open the *log* file.
1308
1310
  self.add_log("#! Opened: <{}>\r\n".format(datetime.datetime.now()))
1309
1311
 
1310
- _fload(self.Scratch, self.SCRATCH_FILE) # restore scratch
1311
-
1312
1312
  fn = os.path.abspath(filename)
1313
1313
  try:
1314
1314
  with open(fn, encoding='utf-8', newline='') as i:
@@ -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
- "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()),
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()),
1354
1354
  "self._mgr.Update()\n",
1355
1355
  )))
1356
1356
 
mwx/graphman.py CHANGED
@@ -473,7 +473,7 @@ class LayerInterface(CtrlInterface):
473
473
  if canvas:
474
474
  canvas.draw_idle()
475
475
  except Exception as e:
476
- print("- Failed to draw Arts of {}: {}".format(self.__module__, e))
476
+ print(f"- Failed to draw Arts of {self.__module__}:", e)
477
477
  del self.Arts
478
478
 
479
479
 
@@ -1055,7 +1055,8 @@ class Frame(mwx.Frame):
1055
1055
 
1056
1056
  if issubclass(cls, LayerInterface):
1057
1057
  cls.__module__ = module.__name__ # __main__ to module
1058
- warnings.warn(f"Duplicate iniheritance of LayerInterface by {cls}.", stacklevel=2)
1058
+ warnings.warn(f"Duplicate iniheritance of LayerInterface by {cls}.",
1059
+ stacklevel=2)
1059
1060
  module.Plugin = cls
1060
1061
  return cls
1061
1062
 
@@ -1099,13 +1100,14 @@ class Frame(mwx.Frame):
1099
1100
  else:
1100
1101
  module = import_module(name)
1101
1102
  except Exception as e:
1102
- print("- Unable to load {!r}: {}".format(root, e))
1103
+ print(f"- Unable to load {root!r}:", e)
1103
1104
  return False
1104
1105
 
1105
1106
  ## the module must have a class `Plugin`.
1106
1107
  if not hasattr(module, 'Plugin'):
1107
1108
  if isinstance(root, type):
1108
- warnings.warn(f"Use dummy plug for debugging {name!r}.", stacklevel=3)
1109
+ warnings.warn(f"Use dummy plug for debugging {name!r}.",
1110
+ stacklevel=3)
1109
1111
  module.__dummy_plug__ = root
1110
1112
  self.register(root, module)
1111
1113
  else:
mwx/nutshell.py CHANGED
@@ -1995,7 +1995,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
1995
1995
  return True
1996
1996
  return False
1997
1997
  except Exception as e:
1998
- self.post_message("Failed to load {!r}: {}".format(buf.name, e))
1998
+ self.post_message(f"Failed to load {filename!r}:", e)
1999
1999
  self.delete_buffer(buf)
2000
2000
  if org:
2001
2001
  self.swap_buffer(org)
@@ -2031,7 +2031,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2031
2031
  return True
2032
2032
  return False
2033
2033
  except Exception as e:
2034
- self.post_message("Failed to save {!r}: {}".format(buf.name, e))
2034
+ self.post_message(f"Failed to save {filename!r}:", e)
2035
2035
  return False
2036
2036
 
2037
2037
  def load_buffer(self, buf=None):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 0.94.5
3
+ Version: 0.94.6
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
2
  mwx/bookshelf.py,sha256=UVVIwHaGO4aEHwZ8x5SKjpL-3MmQ1s6kkyuyRZqKWvU,5070
3
- mwx/controls.py,sha256=1eguX5eofsA6hmS2y7R4hvlFjFikVoZ8v2S1ES7rjEU,47196
4
- mwx/framework.py,sha256=Hi16j2sajupXq2_m37VMfxumj6eXwfaGq8Le26IMfFc,75494
5
- mwx/graphman.py,sha256=kntmZcVxIubUtH7mLiDyDr2rXw_2iEvtV9DkFDYtt8s,69991
3
+ mwx/controls.py,sha256=prp1NhZqv1XANhi2PPxW9jtrgwj_02XMOOyyzZ48klM,47185
4
+ mwx/framework.py,sha256=Wxpr9WDshKkKG4x91POCHgU2TZoFhW9X4U8O6Lbxnck,75581
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=VcUDTzqdBdHztVGfkjqEL9DUO6cKaGYvYCAME0Jl0qk,135647
11
+ mwx/nutshell.py,sha256=qz4qnEuGm5vEUtltux6caBLAoth92qc1zAyEmL6nbCg,135625
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.5.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-0.94.5.dist-info/METADATA,sha256=tMDN9Giu-NWqUZx5Pzf0OzlAtx_P6HSMW8EVWd0scMw,1925
26
- mwxlib-0.94.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
27
- mwxlib-0.94.5.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-0.94.5.dist-info/RECORD,,
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,,