Skip to content

Commit

Permalink
Fixed a spurious warning message in the log
Browse files Browse the repository at this point in the history
- when a Table or Plot viewer is running in the channel and one moves
  the cursor around in the Pan window
  • Loading branch information
ejeschke committed Jun 7, 2024
1 parent a82727e commit d4f5454
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
2 changes: 2 additions & 0 deletions doc/WhatsNew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Ver 5.2.0 (unreleased)
- Substituted puremagic package for python-magic (works better across
platforms)
- Fixed an issue with the mouse wheel event scrolling MDI workspaces
- Fixed a spurious warning when moving the cursor in the Pan plugin
window and a table or plot viewer is running in the channel

Ver 5.1.0 (2024-05-22)
======================
Expand Down
47 changes: 27 additions & 20 deletions ginga/rv/Control.py
Original file line number Diff line number Diff line change
Expand Up @@ -2196,6 +2196,8 @@ def _select_viewer_cb(w, dct):
wgts.table.set_tree(tree_dict)
# highlight first choice
path = [openers[0].name]
text = inspect.getdoc(openers[0].vclass)
wgts.descr.set_text(text)
wgts.table.select_path(path)

dialog = Widgets.Dialog(title="Choose viewer",
Expand Down Expand Up @@ -2737,27 +2739,32 @@ def _showxy(self, viewer, data_x, data_y):
"""
self._cursor_last_update = time.time()

try:
image = viewer.get_vip()
if image.ndim < 2:
return

settings = viewer.get_settings()
info = image.info_xy(data_x, data_y, settings)

# Are we reporting in data or FITS coordinates?
off = self.settings.get('pixel_coords_offset', 0.0)
info.x += off
info.y += off
if 'image_x' in info:
info.image_x += off
if 'image_y' in info:
info.image_y += off
if not hasattr(viewer, 'get_vip'):
info = Bunch.Bunch(itype='base', data_x=data_x, data_y=data_y,
x=data_x, y=data_y, value=None)
else:
try:
image = viewer.get_vip()
if image.ndim < 2:
return

settings = viewer.get_settings()
info = image.info_xy(data_x, data_y, settings)

# Are we reporting in data or FITS coordinates?
off = self.settings.get('pixel_coords_offset', 0.0)
info.x += off
info.y += off
if 'image_x' in info:
info.image_x += off
if 'image_y' in info:
info.image_y += off

except Exception as e:
self.logger.warning(
"Can't get info under the cursor: %s" % (str(e)), exc_info=True)
return
except Exception as e:
self.logger.warning(
"Can't get info under the cursor: %s" % (str(e)), exc_info=True)
info = Bunch.Bunch(itype='base', data_x=data_x, data_y=data_y,
x=data_x, y=data_y, value=None)

# TODO: can this be made more efficient?
chname = self.get_channel_name(viewer)
Expand Down

0 comments on commit d4f5454

Please sign in to comment.