pyredshift 1.15__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.15
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.15",
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(),
@@ -68,6 +68,13 @@ V1.14 - Saving works properly: the toolbar save button no longer
68
68
  - Lineage/credits at the top of the help page.
69
69
  V1.15 - Help-page credits link to the GitHub repo; lineage text in a
70
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.
71
78
  """
72
79
 
73
80
  import ctypes
@@ -113,7 +120,7 @@ try:
113
120
  except AttributeError:
114
121
  pass
115
122
 
116
- __version__ = "1.15"
123
+ __version__ = "1.16"
117
124
 
118
125
  C_LIGHT = 2.99792458e8 # m/s
119
126
 
@@ -365,7 +372,19 @@ class StickyCursor(Cursor):
365
372
 
366
373
  def __init__(self, ax_, **kwargs):
367
374
  self._last_event = None
368
- 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
369
388
  self.linev.set_clip_on(False) # let the crosshair escape the box
370
389
  self.lineh.set_clip_on(False)
371
390
  self.connect_event("draw_event", self._redraw)
@@ -380,9 +399,10 @@ class StickyCursor(Cursor):
380
399
  self.background = self.canvas.copy_from_bbox(self.canvas.figure.bbox)
381
400
 
382
401
  def onmove(self, event):
383
- # Copy of Cursor.onmove from matplotlib 3.9, minus the widgetlock
384
- # check (version sensitive - revisit if matplotlib is upgraded),
385
- # 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).
386
406
  if self.ignore(event):
387
407
  return
388
408
  xdata, ydata = surface_xy(self.ax, event)
@@ -443,6 +463,12 @@ class StickyCursor(Cursor):
443
463
  update_readout(readout_lastev)
444
464
 
445
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
+
446
472
  def normkey(ch):
447
473
  # Some backends report shifted letters as 'shift+b' - normalise to 'B'
448
474
  if ch is not None and ch.startswith("shift+") and len(ch) == 7:
@@ -484,6 +510,8 @@ def pgband(allow_drag=False):
484
510
  return surface_xy(ax, ev)
485
511
 
486
512
  def on_key(ev):
513
+ if ev.key in MODIFIER_KEYS:
514
+ return # a bare modifier press is not input
487
515
  xd, yd = data_xy(ev)
488
516
  done(xd, yd, normkey(ev.key))
489
517
 
@@ -649,6 +677,8 @@ def line_menu(xd, yd):
649
677
  fig.canvas.stop_event_loop()
650
678
 
651
679
  def on_key(ev):
680
+ if ev.key in MODIFIER_KEYS:
681
+ return # don't let a bare shift press close the menu
652
682
  state["picked"] = None
653
683
  fig.canvas.stop_event_loop()
654
684
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyredshift
3
- Version: 1.15
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