pyredshift 1.14__tar.gz → 1.16__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyredshift
3
- Version: 1.14
3
+ Version: 1.16
4
4
  Summary: Interactive redshifting of 1D astronomical spectra (Python successor of pdlredshift / redshift.f)
5
5
  Home-page: https://github.com/karlglazebrook/pyredshift
6
6
  Author: Karl Glazebrook
@@ -13,7 +13,7 @@ from setuptools import setup
13
13
 
14
14
  setup(
15
15
  name="pyredshift",
16
- version="1.14",
16
+ version="1.16",
17
17
  description="Interactive redshifting of 1D astronomical spectra "
18
18
  "(Python successor of pdlredshift / redshift.f)",
19
19
  long_description=open("README.md").read(),
@@ -8,7 +8,8 @@ ported with Claude, 2026) — same keys, same beautiful crosshair,
8
8
  faster carriage.</p>
9
9
 
10
10
  <p class="lineage">Karl Glazebrook, Swinburne University of Technology.
11
- MIT license.</p>
11
+ MIT license.
12
+ <a href="https://github.com/karlglazebrook/pyredshift">github.com/karlglazebrook/pyredshift</a></p>
12
13
 
13
14
  <input type="radio" name="tabs" id="tab-keys" checked>
14
15
  <input type="radio" name="tabs" id="tab-lines">
@@ -66,6 +66,15 @@ V1.14 - Saving works properly: the toolbar save button no longer
66
66
  choosing it, so a python without Qt falls back to MacOSX
67
67
  instead of crashing at the first figure.
68
68
  - Lineage/credits at the top of the help page.
69
+ V1.15 - Help-page credits link to the GitHub repo; lineage text in a
70
+ readable muted grey in both themes.
71
+ V1.16 - Bare modifier presses are no longer input: ESC shift-O works
72
+ (the 'shift' keydown used to be read as the shortcut key), a
73
+ stray shift can't consume the second pick of x/y/e/m or close
74
+ the line menu.
75
+ - matplotlib 3.11 compatibility: keep full-figure blitting on
76
+ when another axes overlaps (3.11 would silently disable it on
77
+ tall windows), manage the cursor background ourselves.
69
78
  """
70
79
 
71
80
  import ctypes
@@ -111,7 +120,7 @@ try:
111
120
  except AttributeError:
112
121
  pass
113
122
 
114
- __version__ = "1.14"
123
+ __version__ = "1.16"
115
124
 
116
125
  C_LIGHT = 2.99792458e8 # m/s
117
126
 
@@ -363,7 +372,19 @@ class StickyCursor(Cursor):
363
372
 
364
373
  def __init__(self, ax_, **kwargs):
365
374
  self._last_event = None
366
- super().__init__(ax_, **kwargs)
375
+ with warnings.catch_warnings():
376
+ # mpl 3.11 warns + disables useblit on overlapping axes;
377
+ # we re-assert it below, so don't let the warning through
378
+ warnings.simplefilter("ignore", UserWarning)
379
+ super().__init__(ax_, **kwargs)
380
+ # matplotlib 3.11 disables useblit when another axes overlaps (the
381
+ # '?' button can overlap on tall windows) - a guard our full-figure
382
+ # blit doesn't need; it also no longer initialises self.background
383
+ # (we manage it ourselves in clear())
384
+ self.useblit = self.canvas.supports_blit
385
+ self.linev.set_animated(self.useblit)
386
+ self.lineh.set_animated(self.useblit)
387
+ self.background = None
367
388
  self.linev.set_clip_on(False) # let the crosshair escape the box
368
389
  self.lineh.set_clip_on(False)
369
390
  self.connect_event("draw_event", self._redraw)
@@ -378,9 +399,10 @@ class StickyCursor(Cursor):
378
399
  self.background = self.canvas.copy_from_bbox(self.canvas.figure.bbox)
379
400
 
380
401
  def onmove(self, event):
381
- # Copy of Cursor.onmove from matplotlib 3.9, minus the widgetlock
382
- # check (version sensitive - revisit if matplotlib is upgraded),
383
- # with whole-window coords and full-figure blitting.
402
+ # Based on Cursor.onmove from matplotlib 3.9, minus the widgetlock
403
+ # check, with whole-window coords and full-figure blitting. Checked
404
+ # against matplotlib 3.11 (which moved to _save/_load_blit_background
405
+ # helpers - we keep our own self.background instead).
384
406
  if self.ignore(event):
385
407
  return
386
408
  xdata, ydata = surface_xy(self.ax, event)
@@ -441,6 +463,12 @@ class StickyCursor(Cursor):
441
463
  update_readout(readout_lastev)
442
464
 
443
465
 
466
+ # Pressing a modifier fires its own key_press_event before the combination
467
+ # (ESC shift-O used to read the bare 'shift' as the shortcut key)
468
+ MODIFIER_KEYS = ("shift", "control", "ctrl", "alt", "cmd", "super", "meta",
469
+ "caps_lock", "fn")
470
+
471
+
444
472
  def normkey(ch):
445
473
  # Some backends report shifted letters as 'shift+b' - normalise to 'B'
446
474
  if ch is not None and ch.startswith("shift+") and len(ch) == 7:
@@ -482,6 +510,8 @@ def pgband(allow_drag=False):
482
510
  return surface_xy(ax, ev)
483
511
 
484
512
  def on_key(ev):
513
+ if ev.key in MODIFIER_KEYS:
514
+ return # a bare modifier press is not input
485
515
  xd, yd = data_xy(ev)
486
516
  done(xd, yd, normkey(ev.key))
487
517
 
@@ -647,6 +677,8 @@ def line_menu(xd, yd):
647
677
  fig.canvas.stop_event_loop()
648
678
 
649
679
  def on_key(ev):
680
+ if ev.key in MODIFIER_KEYS:
681
+ return # don't let a bare shift press close the menu
650
682
  state["picked"] = None
651
683
  fig.canvas.stop_event_loop()
652
684
 
@@ -1015,7 +1047,8 @@ body { font-family: -apple-system, "Helvetica Neue", sans-serif;
1015
1047
  color: %(fg)s; background: %(bg)s; line-height: 1.45; }
1016
1048
  h1 { font-size: 1.5em; border-bottom: 2px solid %(rule)s; padding-bottom: 0.2em; }
1017
1049
  h1 .ver { font-size: 0.6em; font-weight: normal; color: %(accent)s; }
1018
- p.lineage { font-size: 0.85em; color: %(rule)s; margin-top: -0.3em; }
1050
+ p.lineage { font-size: 0.85em; color: %(muted)s; margin-top: -0.3em; }
1051
+ a { color: %(accent)s; }
1019
1052
  h2 { font-size: 1.15em; color: %(accent)s; margin-top: 1.4em; }
1020
1053
  table { border-collapse: collapse; margin: 0.5em 0; }
1021
1054
  th, td { border: 1px solid %(rule)s; padding: 0.25em 0.7em; text-align: left; }
@@ -1051,8 +1084,10 @@ def show_help_browser(body):
1051
1084
  return False
1052
1085
  import webbrowser
1053
1086
  colours = ({"fg": "#ddd", "bg": "#111", "rule": "#555",
1087
+ "muted": "#aaa",
1054
1088
  "accent": "#f66", "thbg": "#222"} if dark_mode else
1055
1089
  {"fg": "#111", "bg": "#fff", "rule": "#bbb",
1090
+ "muted": "#555",
1056
1091
  "accent": "crimson", "thbg": "#f0f0f0"})
1057
1092
  html = ("<!DOCTYPE html><html><head><meta charset='utf-8'>"
1058
1093
  "<title>pyredshift help</title><style>%s</style></head>"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyredshift
3
- Version: 1.14
3
+ Version: 1.16
4
4
  Summary: Interactive redshifting of 1D astronomical spectra (Python successor of pdlredshift / redshift.f)
5
5
  Home-page: https://github.com/karlglazebrook/pyredshift
6
6
  Author: Karl Glazebrook
File without changes
File without changes
File without changes
File without changes
File without changes