From d4f5454e4cbce3b4ec80b326a427a8d673d618a0 Mon Sep 17 00:00:00 2001 From: Eric Jeschke Date: Thu, 6 Jun 2024 14:33:15 -1000 Subject: [PATCH] Fixed a spurious warning message in the log - when a Table or Plot viewer is running in the channel and one moves the cursor around in the Pan window --- doc/WhatsNew.rst | 2 ++ ginga/rv/Control.py | 47 ++++++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/doc/WhatsNew.rst b/doc/WhatsNew.rst index 3f050b603..18297cc4a 100644 --- a/doc/WhatsNew.rst +++ b/doc/WhatsNew.rst @@ -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) ====================== diff --git a/ginga/rv/Control.py b/ginga/rv/Control.py index 360f81204..338f49fe4 100644 --- a/ginga/rv/Control.py +++ b/ginga/rv/Control.py @@ -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", @@ -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)