mwxlib 1.2.7__py3-none-any.whl → 1.2.9__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
@@ -337,13 +337,9 @@ class Knob(wx.Panel):
337
337
  label = self.__par.name + ' '
338
338
 
339
339
  if style == 'chkbox' or style == 'checkbox':
340
- if lw >= 0:
341
- lw += 16
342
340
  self.label = wx.CheckBox(self, label=label, size=(lw,-1))
343
341
  self.label.Bind(wx.EVT_CHECKBOX, self.OnCheck)
344
342
  elif style == 'button':
345
- if lw >= 0:
346
- lw += 16
347
343
  self.label = pb.PlateButton(self, label=label, size=(lw,-1),
348
344
  style=pb.PB_STYLE_DEFAULT|pb.PB_STYLE_SQUARE)
349
345
  self.label.Bind(wx.EVT_BUTTON, self.OnPress)
mwx/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "1.2.7"
4
+ __version__ = "1.2.9"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from contextlib import contextmanager
@@ -1484,7 +1484,7 @@ class ShellFrame(MiniFrame):
1484
1484
  style=wx.YES_NO|wx.ICON_INFORMATION) != wx.YES:
1485
1485
  self.__autoload = False # Don't ask any more.
1486
1486
  return
1487
- book.load_file(buf.filename)
1487
+ book.load_file(buf.filename, buf.markline+1)
1488
1488
  ## Reinitialize self-specific builtins if other instances are destroyed.
1489
1489
  if evt.Active:
1490
1490
  self.Init()
mwx/graphman.py CHANGED
@@ -1410,7 +1410,7 @@ class Frame(mwx.Frame):
1410
1410
  frames = self.load_buffer(paths, view)
1411
1411
  if frames:
1412
1412
  for frame in frames:
1413
- frame.set_attributes(res.get(frame.name))
1413
+ frame.update_attr(res.get(frame.name))
1414
1414
 
1415
1415
  n = len(frames)
1416
1416
  self.message(
@@ -1486,14 +1486,16 @@ class Frame(mwx.Frame):
1486
1486
  res.update(eval(i.read())) # read res <dict>
1487
1487
 
1488
1488
  for name, attr in tuple(res.items()):
1489
- fn = os.path.join(savedir, name)
1490
- if not os.path.exists(fn): # search by relpath (dir+name)
1491
- fn = attr.get('pathname')
1492
- if not os.path.exists(fn): # check & pop missing files
1493
- res.pop(name)
1494
- mis.update({name:attr})
1489
+ fn = os.path.join(savedir, name) # search by relpath (dir / name)
1490
+ if os.path.exists(fn):
1491
+ attr.update(pathname=fn) # if found, update pathname
1495
1492
  else:
1496
- attr.update(pathname=fn)
1493
+ fn = attr.get('pathname') # if not found, try pathname
1494
+ if fn.startswith(r'\\'):
1495
+ warn(f"The pathnme of {fn!r} contains network path, "
1496
+ f"so the search may take long time.", stacklevel=3)
1497
+ if not os.path.exists(fn):
1498
+ mis[name] = res.pop(name) # pop missing items
1497
1499
  except FileNotFoundError:
1498
1500
  pass
1499
1501
  except Exception as e:
@@ -1507,7 +1509,7 @@ class Frame(mwx.Frame):
1507
1509
  """Write attributes file."""
1508
1510
  try:
1509
1511
  res, mis = self.read_attributes(filename)
1510
- new = dict((x.name, x.get_attributes()) for x in frames)
1512
+ new = dict((x.name, x.attributes) for x in frames)
1511
1513
 
1512
1514
  ## `res` order may differ from that of given frames,
1513
1515
  ## so we take a few steps to merge `new` to be exported.
@@ -1540,7 +1542,7 @@ class Frame(mwx.Frame):
1540
1542
  res, mis = self.read_attributes(fn)
1541
1543
  savedirs[savedir] = res
1542
1544
  results = savedirs[savedir]
1543
- frame.set_attributes(results.get(frame.name))
1545
+ frame.update_attr(results.get(frame.name))
1544
1546
  return frames
1545
1547
 
1546
1548
  def save_frame(self, path=None, frame=None):
mwx/matplot2g.py CHANGED
@@ -157,11 +157,7 @@ class AxesImagePhantom:
157
157
  ## Called in `on_pick` and `__contains__` to check objects in.
158
158
  return x is self.__art
159
159
 
160
- def get_attributes(self):
161
- """Auxiliary info about the frame."""
162
- return self.__attributes
163
-
164
- def set_attributes(self, attr):
160
+ def update_attr(self, attr):
165
161
  """Update frame-specifc attributes:
166
162
 
167
163
  annotation : aux info (also displayed as a message in the infobar)
@@ -234,14 +230,18 @@ class AxesImagePhantom:
234
230
  lambda self,v: self.__art.set_clim(v),
235
231
  doc="Lower/Upper color limit values of the buffer.")
236
232
 
233
+ attributes = property(
234
+ lambda self: self.__attributes,
235
+ doc="Auxiliary info about the frame.")
236
+
237
237
  pathname = property(
238
238
  lambda self: self.__attributes.get('pathname'),
239
- lambda self,v: self.set_attributes({'pathname': v}),
239
+ lambda self,v: self.update_attr({'pathname': v}),
240
240
  doc="Fullpath of the buffer, if bound to a file.")
241
241
 
242
242
  annotation = property(
243
243
  lambda self: self.__attributes.get('annotation', ''),
244
- lambda self,v: self.set_attributes({'annotation': v}),
244
+ lambda self,v: self.update_attr({'annotation': v}),
245
245
  doc="Annotation of the buffer.")
246
246
 
247
247
  @property
@@ -648,8 +648,8 @@ class GraphPlot(MatplotPanel):
648
648
  j = names.index(name) # existing frame
649
649
  if j != -1:
650
650
  art = self.__Arts[j]
651
- art.update_buffer(buf) # => [frame_modified]
652
- art.set_attributes(kwargs) # => [frame_updated] localunit => [canvas_draw]
651
+ art.update_buffer(buf) # => [frame_modified]
652
+ art.update_attr(kwargs) # => [frame_updated] localunit => [canvas_draw]
653
653
  art.update_extent()
654
654
  if show:
655
655
  self.select(j)
mwx/nutshell.py CHANGED
@@ -2390,7 +2390,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2390
2390
  return True
2391
2391
  return False
2392
2392
 
2393
- def load_file(self, filename, lineno=0, verbose=True):
2393
+ def load_file(self, filename, lineno=0, verbose=True, **kwargs):
2394
2394
  """Load a file into an existing or new buffer.
2395
2395
  The requests module is required to use URL extension.
2396
2396
  """
@@ -2412,18 +2412,18 @@ class EditorBook(AuiNotebook, CtrlInterface):
2412
2412
  try:
2413
2413
  if re.match(url_re, filename):
2414
2414
  import requests
2415
- res = requests.get(filename, timeout=3.0)
2416
- if res.status_code == requests.codes.ok:
2415
+ kwargs.setdefault('timeout', 3.0)
2416
+ res = requests.get(filename, **kwargs)
2417
+ if res.status_code == requests.codes.OK:
2417
2418
  buf._load_textfile(res.text, filename)
2418
2419
  self.swap_buffer(buf, lineno)
2419
2420
  return True
2420
- ## raise Exception("URL not found:", filename)
2421
- res.raise_for_status() # raise HTTP error
2421
+ res.raise_for_status() # raise HTTP error; don't catch here.
2422
2422
  if buf._load_file(filename):
2423
2423
  self.swap_buffer(buf, lineno)
2424
2424
  return True
2425
2425
  return False
2426
- except (OSError, UnicodeDecodeError) as e:
2426
+ except (OSError, UnicodeDecodeError, ModuleNotFoundError) as e:
2427
2427
  self.post_message("Failed to load:", e)
2428
2428
  self.delete_buffer(buf)
2429
2429
  return False
@@ -3354,7 +3354,7 @@ class Nautilus(EditorInterface, Shell):
3354
3354
  ## cf. getMultilineCommand() -> caret-multi-line that starts with a prompt
3355
3355
  ## [BUG 4.1.1] Don't use for current prompt --> Fixed in 4.2.0.
3356
3356
 
3357
- def getMultilineCommand(self):
3357
+ def getMultilineCommand(self, rstrip=True):
3358
3358
  """Extract a multi-line command which starts with a prompt.
3359
3359
 
3360
3360
  (override) Don't remove trailing ps2 + spaces.
@@ -3364,7 +3364,12 @@ class Nautilus(EditorInterface, Shell):
3364
3364
  if region:
3365
3365
  p, q = (self.PositionFromLine(x) for x in region)
3366
3366
  p += len(sys.ps1)
3367
- return self.GetTextRange(p, q)
3367
+ command = self.GetTextRange(p, q).rstrip(os.linesep) # remove the last cr/lf
3368
+ if rstrip:
3369
+ command = command.replace(os.linesep + sys.ps2, '\n')
3370
+ command = command.rstrip()
3371
+ command = command.replace('\n', os.linesep + sys.ps2)
3372
+ return command
3368
3373
  return ''
3369
3374
 
3370
3375
  def get_region(self, line):
@@ -185,7 +185,7 @@ class CheckList(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
185
185
  if selected_frames:
186
186
  text = ''
187
187
  for frame in selected_frames:
188
- text += pformat(frame.get_attributes(), sort_dicts=0) # ALL attributes
188
+ text += pformat(frame.attributes, sort_dicts=0) # ALL attributes
189
189
  ## text += '{}\n{}\n'.format(frame.name, frame.annotation)
190
190
  Clipboard.write(text)
191
191
  else:
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: mwxlib
3
- Version: 1.2.7
3
+ Version: 1.2.9
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
@@ -21,6 +21,15 @@ Requires-Dist: wxpython>=4.2.0
21
21
  Requires-Dist: matplotlib
22
22
  Requires-Dist: opencv-python
23
23
  Requires-Dist: scipy
24
+ Dynamic: author
25
+ Dynamic: author-email
26
+ Dynamic: classifier
27
+ Dynamic: description
28
+ Dynamic: description-content-type
29
+ Dynamic: home-page
30
+ Dynamic: license
31
+ Dynamic: requires-dist
32
+ Dynamic: summary
24
33
 
25
34
  # mwxlib
26
35
 
@@ -1,14 +1,14 @@
1
1
  mwx/__init__.py,sha256=pS7ZG8QKRypiFFiaWAq_opBB6I_1viZ0zUMk2TbjzE0,667
2
2
  mwx/bookshelf.py,sha256=b_TMDaNIzLHoL0xbbqb3tt0BnRvhLAqaCn_pBdrigZw,7523
3
- mwx/controls.py,sha256=5PCy3zguDRuwYl89P9tOCUU7xAGUETs944qZBy5MS9g,48146
4
- mwx/framework.py,sha256=wurY8uvLFJW6Xig5kTTI84MkFWAK3v4-a6H2eSEwv7M,76125
5
- mwx/graphman.py,sha256=6ON1lckAyCbIMhIPHRbi9yvWYI2yT_CIWhNFbW31-mc,70110
3
+ mwx/controls.py,sha256=iSevLKxgB3vdGJr3Wv8nccbFNSw1Voazt_HYjp3RrmM,48044
4
+ mwx/framework.py,sha256=FU5XzSPNg-vWZPvG8lMi7u5htB3aUkdKgpbXlSqIFEU,76141
5
+ mwx/graphman.py,sha256=sKwPy31H4lwtShTAui_6upe_Ys2-MwBHhdFq-3onBNE,70328
6
6
  mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
7
7
  mwx/matplot2.py,sha256=Zwte-wwzCg_OHzsBniVgKdaNLzsvJaa1gc0n7VdAqxw,33150
8
- mwx/matplot2g.py,sha256=gs9U6VDdSX9wmzgrzDCWEZEL3DTOc5XkZOWZE5mffxc,64207
8
+ mwx/matplot2g.py,sha256=ceeAjFkrDz49aSLo_9dIWZZd4HhnSjxe8u9G_ipBHek,64195
9
9
  mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
10
10
  mwx/mgplt.py,sha256=8mXbHpCmm7lz3XbAxOg7IVC7DaSGBEby1UfTlMl9kjk,5604
11
- mwx/nutshell.py,sha256=7nQ7UUFM9kvjDjHNUEdOkkeqZPiU6zOERwamqBdJpQs,140856
11
+ mwx/nutshell.py,sha256=Cy2P4XZ0Wife66oXv3I0dRztlBmlSAlUkVhOq2tWPgs,141187
12
12
  mwx/testsuite.py,sha256=kiM3-BVhr42LRRN7xG7pYl3at8o2vnypWSxD8KRvA7c,1228
13
13
  mwx/utilus.py,sha256=bDeooo2bOcZwvkIdi0ElkT-qoblqzHNFsIveb72NFOo,37528
14
14
  mwx/wxmon.py,sha256=yzWqrbY6LzpfRwQeytYUeqFhFuLVm_XEvrVAL_k0HBQ,12756
@@ -18,12 +18,12 @@ mwx/wxwit.py,sha256=1hHtMi2YEy2T_LnUpwdmrIdtCuvxMOFyykqnbq6jLP0,7294
18
18
  mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
19
19
  mwx/plugins/ffmpeg_view.py,sha256=NIHFJLPeliOXH3ke0NvQzYBhY0oeEP6dgZQofB5Ry1c,11031
20
20
  mwx/plugins/fft_view.py,sha256=08A_Y73XirV7kXpwf-v0mUA0Hr0MOfdMXv3tvL1hvWA,2789
21
- mwx/plugins/frame_listview.py,sha256=z2mGbOTStjaICU7vkn-fs_C8uvCD1xMldSOdr-_IKH0,10426
21
+ mwx/plugins/frame_listview.py,sha256=gowjQ-ARNonMkDSXkQgPKq4U9YBJ-vQ0jK2krBVOdCs,10420
22
22
  mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
23
23
  mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
24
24
  mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
25
- mwxlib-1.2.7.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
26
- mwxlib-1.2.7.dist-info/METADATA,sha256=sEkzDsdCV7wSQmHtCWDZLv9-2pbqdEQ7XvuD_VSyo5o,7258
27
- mwxlib-1.2.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
28
- mwxlib-1.2.7.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
29
- mwxlib-1.2.7.dist-info/RECORD,,
25
+ mwxlib-1.2.9.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
26
+ mwxlib-1.2.9.dist-info/METADATA,sha256=zDuA9RxTUziGyT-aTZFZhLSh2fN1_USrpr6lpoTLuT0,7456
27
+ mwxlib-1.2.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
28
+ mwxlib-1.2.9.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
29
+ mwxlib-1.2.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5