Commit ccc19f88 authored by skamann's avatar skamann
Browse files

In GUI code, removed usage of _active variable that is internal to NavigationToolbar2QT.

parent fb70f45d
......@@ -2,7 +2,7 @@
"""
pampelmuse_gui.py
=================
Copyright 2013-2020 Sebastian Kamann
Copyright 2013-2021 Sebastian Kamann
This file is part of PampelMuse.
......@@ -37,7 +37,7 @@ defines the methods that are called by Ui_PampelMuseGui.
Latest Git revision
-------------------
2020/03/27
2021/04/13
"""
import datetime
import logging
......@@ -52,7 +52,7 @@ from astropy import wcs
from astropy.io import fits
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt
from PyQt5.QtGui import QDoubleValidator
from PyQt5.QtWidgets import QMainWindow, QHBoxLayout, QVBoxLayout, QFileDialog
from PyQt5.QtWidgets import QAction, QMainWindow, QHBoxLayout, QVBoxLayout, QFileDialog
from .dynamic_plot_canvas import DynamicPlotCanvas
from .dynamic_ima_canvas import DynamicImaCanvas
from .Ui_pampelmuse_gui import Ui_PampelMuseGui
......@@ -64,19 +64,34 @@ from ..utils.fits import save_prm, read_config_from_header, make_header_from_con
__author__ = "Sebastian Kamann (s.kamann@ljmu.ac.uk)"
__revision__ = 20200327
__revision__ = 20210413
class ToolbarWithoutMessage(NavigationToolbar):
"""
A small subclass of the navigation toolbar that does not display the
coordinates under the mouse pointer. This is used for the reference
image and IFS data because to save space and because this information
image and IFS data in order to save space and because this information
is already displayed in the status bar.
The class also keeps track of the status of the toolbar buttons (checked
or unchecked), as this information is used to determine the interaction
status of the GUI.
"""
def __init__(self, canvas, parent, coordinates=True):
super(ToolbarWithoutMessage, self).__init__(canvas=canvas, parent=parent, coordinates=coordinates)
self.actionTriggered.connect(self.on_actionTriggered)
self.in_navigation_mode = False
def set_message(self, msg):
pass
@pyqtSlot(QAction)
def on_actionTriggered(self, action):
self.in_navigation_mode = action.isChecked()
class PampelMuseGui(QMainWindow, Ui_PampelMuseGui):
"""
......@@ -767,7 +782,7 @@ class PampelMuseGui(QMainWindow, Ui_PampelMuseGui):
"""
# do nothing if event happened outside axes
if event.inaxes != self.ifsPlot.axes or self.ifsInteractMode != 'grab' or self.ifsToolbar._active is not None:
if event.inaxes != self.ifsPlot.axes or self.ifsInteractMode != 'grab' or self.ifsToolbar.in_navigation_mode:
return
# check if click was inside field of view of IFU
......@@ -791,7 +806,7 @@ class PampelMuseGui(QMainWindow, Ui_PampelMuseGui):
event : a matplotlib.backend_bases.PickEvent instance
The mouse event that triggered the method call.
"""
if self.ifsInteractMode != 'pick' or self.ifsToolbar._active is not None:
if self.ifsInteractMode != 'pick' or self.ifsToolbar.in_navigation_mode:
return
if len(event.ind) != 1:
self.statusBar.showMessage("Multiple sources selected", 5000)
......@@ -812,7 +827,7 @@ class PampelMuseGui(QMainWindow, Ui_PampelMuseGui):
event : a matplotlib.backend_bases.PickEvent instance
The mouse event that triggered the method call.
"""
if self.refInteractMode != 'pick' or self.refToolbar._active is not None:
if self.refInteractMode != 'pick' or self.refToolbar.in_navigation_mode:
return
# do nothing if more than one source selected
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment