[change] replaced all occurrences of PySide and QtGui references with the PySide2 substitue
This commit is contained in:
parent
21f4567236
commit
b5ba62e86f
@ -18,7 +18,7 @@ import pylot.core.loc.hypodd as hypodd
|
|||||||
import pylot.core.loc.hyposat as hyposat
|
import pylot.core.loc.hyposat as hyposat
|
||||||
import pylot.core.loc.nll as nll
|
import pylot.core.loc.nll as nll
|
||||||
import pylot.core.loc.velest as velest
|
import pylot.core.loc.velest as velest
|
||||||
# from PySide.QtGui import QWidget, QInputDialog
|
# from PySide2.QtWidgets import QWidget, QInputDialog
|
||||||
from pylot.core.analysis.magnitude import MomentMagnitude, LocalMagnitude
|
from pylot.core.analysis.magnitude import MomentMagnitude, LocalMagnitude
|
||||||
from pylot.core.io.data import Data
|
from pylot.core.io.data import Data
|
||||||
from pylot.core.io.inputs import PylotParameter
|
from pylot.core.io.inputs import PylotParameter
|
||||||
|
@ -8,7 +8,7 @@ from obspy.core import read, Stream, UTCDateTime
|
|||||||
from obspy.core.event import Event as ObsPyEvent
|
from obspy.core.event import Event as ObsPyEvent
|
||||||
from obspy.io.sac import SacIOError
|
from obspy.io.sac import SacIOError
|
||||||
|
|
||||||
from PySide.QtGui import QMessageBox
|
from PySide2.QtWidgets import QMessageBox
|
||||||
|
|
||||||
import pylot.core.loc.velest as velest
|
import pylot.core.loc.velest as velest
|
||||||
import pylot.core.loc.focmec as focmec
|
import pylot.core.loc.focmec as focmec
|
||||||
@ -26,9 +26,9 @@ class Data(object):
|
|||||||
"""
|
"""
|
||||||
Data container with attributes wfdata holding ~obspy.core.stream.
|
Data container with attributes wfdata holding ~obspy.core.stream.
|
||||||
|
|
||||||
:type parent: PySide.QtGui.QWidget object, optional
|
:type parent: PySide2.QtWidgets.QWidget object, optional
|
||||||
:param parent: A PySide.QtGui.QWidget object utilized when
|
:param parent: A PySide2.QtWidgets.QWidget object utilized when
|
||||||
called by a GUI to display a PySide.QtGui.QMessageBox instead of printing
|
called by a GUI to display a PySide2.QtWidgets.QMessageBox instead of printing
|
||||||
to standard out.
|
to standard out.
|
||||||
:type evtdata: ~obspy.core.event.Event object, optional
|
:type evtdata: ~obspy.core.event.Event object, optional
|
||||||
:param evtdata ~obspy.core.event.Event object containing all derived or
|
:param evtdata ~obspy.core.event.Event object containing all derived or
|
||||||
@ -128,7 +128,7 @@ class Data(object):
|
|||||||
|
|
||||||
def getParent(self):
|
def getParent(self):
|
||||||
"""
|
"""
|
||||||
Get PySide.QtGui.QWidget parent object
|
Get PySide2.QtWidgets.QWidget parent object
|
||||||
"""
|
"""
|
||||||
return self._parent
|
return self._parent
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import matplotlib.pyplot as plt
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import obspy
|
import obspy
|
||||||
import traceback
|
import traceback
|
||||||
from PySide import QtGui
|
from PySide2 import QtWidgets
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
||||||
from mpl_toolkits.basemap import Basemap
|
from mpl_toolkits.basemap import Basemap
|
||||||
@ -18,7 +18,7 @@ from pylot.core.pick.utils import get_quality_class
|
|||||||
plt.interactive(False)
|
plt.interactive(False)
|
||||||
|
|
||||||
|
|
||||||
class Array_map(QtGui.QWidget):
|
class Array_map(QtWidgets.QWidget):
|
||||||
def __init__(self, parent, metadata, parameter=None, figure=None, annotate=True, pointsize=25.,
|
def __init__(self, parent, metadata, parameter=None, figure=None, annotate=True, pointsize=25.,
|
||||||
linewidth=1.5, width=5e6, height=2e6):
|
linewidth=1.5, width=5e6, height=2e6):
|
||||||
'''
|
'''
|
||||||
@ -27,7 +27,7 @@ class Array_map(QtGui.QWidget):
|
|||||||
:param parameter: object of PyLoT parameter class
|
:param parameter: object of PyLoT parameter class
|
||||||
:param figure:
|
:param figure:
|
||||||
'''
|
'''
|
||||||
QtGui.QWidget.__init__(self)
|
QtWidgets.QWidget.__init__(self)
|
||||||
assert (parameter != None or parent != None), 'either parent or parameter has to be set'
|
assert (parameter != None or parent != None), 'either parent or parameter has to be set'
|
||||||
self._parent = parent
|
self._parent = parent
|
||||||
self.metadata = metadata
|
self.metadata = metadata
|
||||||
@ -224,43 +224,43 @@ class Array_map(QtGui.QWidget):
|
|||||||
if not self.figure:
|
if not self.figure:
|
||||||
self.figure = Figure()
|
self.figure = Figure()
|
||||||
|
|
||||||
self.status_label = QtGui.QLabel()
|
self.status_label = QtWidgets.QLabel()
|
||||||
|
|
||||||
self.main_ax = self.figure.add_subplot(111)
|
self.main_ax = self.figure.add_subplot(111)
|
||||||
#self.main_ax.set_facecolor('0.7')
|
#self.main_ax.set_facecolor('0.7')
|
||||||
self.canvas = PylotCanvas(self.figure, parent=self._parent, multicursor=True,
|
self.canvas = PylotCanvas(self.figure, parent=self._parent, multicursor=True,
|
||||||
panZoomX=False, panZoomY=False)
|
panZoomX=False, panZoomY=False)
|
||||||
|
|
||||||
self.main_box = QtGui.QVBoxLayout()
|
self.main_box = QtWidgets.QVBoxLayout()
|
||||||
self.setLayout(self.main_box)
|
self.setLayout(self.main_box)
|
||||||
|
|
||||||
self.top_row = QtGui.QHBoxLayout()
|
self.top_row = QtWidgets.QHBoxLayout()
|
||||||
self.main_box.addLayout(self.top_row, 1)
|
self.main_box.addLayout(self.top_row, 1)
|
||||||
|
|
||||||
self.comboBox_phase = QtGui.QComboBox()
|
self.comboBox_phase = QtWidgets.QComboBox()
|
||||||
self.comboBox_phase.insertItem(0, 'P')
|
self.comboBox_phase.insertItem(0, 'P')
|
||||||
self.comboBox_phase.insertItem(1, 'S')
|
self.comboBox_phase.insertItem(1, 'S')
|
||||||
|
|
||||||
self.comboBox_am = QtGui.QComboBox()
|
self.comboBox_am = QtWidgets.QComboBox()
|
||||||
self.comboBox_am.insertItem(0, 'hybrid (prefer manual)')
|
self.comboBox_am.insertItem(0, 'hybrid (prefer manual)')
|
||||||
self.comboBox_am.insertItem(1, 'manual')
|
self.comboBox_am.insertItem(1, 'manual')
|
||||||
self.comboBox_am.insertItem(2, 'auto')
|
self.comboBox_am.insertItem(2, 'auto')
|
||||||
|
|
||||||
self.annotations_box = QtGui.QCheckBox('Annotate')
|
self.annotations_box = QtWidgets.QCheckBox('Annotate')
|
||||||
self.annotations_box.setChecked(True)
|
self.annotations_box.setChecked(True)
|
||||||
self.auto_refresh_box = QtGui.QCheckBox('Automatic refresh')
|
self.auto_refresh_box = QtWidgets.QCheckBox('Automatic refresh')
|
||||||
self.auto_refresh_box.setChecked(True)
|
self.auto_refresh_box.setChecked(True)
|
||||||
self.refresh_button = QtGui.QPushButton('Refresh')
|
self.refresh_button = QtWidgets.QPushButton('Refresh')
|
||||||
self.cmaps_box = QtGui.QComboBox()
|
self.cmaps_box = QtWidgets.QComboBox()
|
||||||
self.cmaps_box.setMaxVisibleItems(20)
|
self.cmaps_box.setMaxVisibleItems(20)
|
||||||
[self.cmaps_box.addItem(map_name) for map_name in sorted(plt.colormaps())]
|
[self.cmaps_box.addItem(map_name) for map_name in sorted(plt.colormaps())]
|
||||||
# try to set to hsv as default
|
# try to set to hsv as default
|
||||||
self.cmaps_box.setCurrentIndex(self.cmaps_box.findText('hsv'))
|
self.cmaps_box.setCurrentIndex(self.cmaps_box.findText('hsv'))
|
||||||
|
|
||||||
self.top_row.addWidget(QtGui.QLabel('Select a phase: '))
|
self.top_row.addWidget(QtWidgets.QLabel('Select a phase: '))
|
||||||
self.top_row.addWidget(self.comboBox_phase)
|
self.top_row.addWidget(self.comboBox_phase)
|
||||||
self.top_row.setStretch(1, 1) # set stretch of item 1 to 1
|
self.top_row.setStretch(1, 1) # set stretch of item 1 to 1
|
||||||
self.top_row.addWidget(QtGui.QLabel('Pick type: '))
|
self.top_row.addWidget(QtWidgets.QLabel('Pick type: '))
|
||||||
self.top_row.addWidget(self.comboBox_am)
|
self.top_row.addWidget(self.comboBox_am)
|
||||||
self.top_row.setStretch(3, 1) # set stretch of item 1 to 1
|
self.top_row.setStretch(3, 1) # set stretch of item 1 to 1
|
||||||
self.top_row.addWidget(self.cmaps_box)
|
self.top_row.addWidget(self.cmaps_box)
|
||||||
@ -633,6 +633,6 @@ class Array_map(QtGui.QWidget):
|
|||||||
map.ax.figure.canvas.draw()
|
map.ax.figure.canvas.draw()
|
||||||
|
|
||||||
def _warn(self, message):
|
def _warn(self, message):
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Warning,
|
||||||
'Warning', message)
|
'Warning', message)
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
@ -98,7 +98,7 @@ def plot_pdf(_axes, x, y, annotation, bbox_props, xlabel=None, ylabel=None,
|
|||||||
def createAction(parent, text, slot=None, shortcut=None, icon=None,
|
def createAction(parent, text, slot=None, shortcut=None, icon=None,
|
||||||
tip=None, checkable=False):
|
tip=None, checkable=False):
|
||||||
"""
|
"""
|
||||||
:rtype : ~PySide.QtGui.QAction
|
:rtype : ~PySide2.QtWidgets.QAction
|
||||||
"""
|
"""
|
||||||
action = QAction(text, parent)
|
action = QAction(text, parent)
|
||||||
if icon is not None:
|
if icon is not None:
|
||||||
@ -439,17 +439,17 @@ class PlotWidget(FigureCanvas):
|
|||||||
return self._parent
|
return self._parent
|
||||||
|
|
||||||
|
|
||||||
class WaveformWidgetPG(QtGui.QWidget):
|
class WaveformWidgetPG(QtWidgets.QWidget):
|
||||||
def __init__(self, parent, title='Title'):
|
def __init__(self, parent, title='Title'):
|
||||||
QtGui.QWidget.__init__(self, parent=parent)
|
QtWidgets.QWidget.__init__(self, parent=parent)
|
||||||
self.pg = self.parent().pg
|
self.pg = self.parent().pg
|
||||||
# added because adding widget to scrollArea will set scrollArea to parent
|
# added because adding widget to scrollArea will set scrollArea to parent
|
||||||
self.orig_parent = parent
|
self.orig_parent = parent
|
||||||
# attribute plotdict is a dictionary connecting position and a name
|
# attribute plotdict is a dictionary connecting position and a name
|
||||||
self.plotdict = dict()
|
self.plotdict = dict()
|
||||||
# create plot
|
# create plot
|
||||||
self.main_layout = QtGui.QVBoxLayout()
|
self.main_layout = QtWidgets.QVBoxLayout()
|
||||||
self.label = QtGui.QLabel()
|
self.label = QtWidgets.QLabel()
|
||||||
self.setLayout(self.main_layout)
|
self.setLayout(self.main_layout)
|
||||||
self.plotWidget = self.pg.PlotWidget(self.parent(), title=title, autoDownsample=True)
|
self.plotWidget = self.pg.PlotWidget(self.parent(), title=title, autoDownsample=True)
|
||||||
self.main_layout.addWidget(self.plotWidget)
|
self.main_layout.addWidget(self.plotWidget)
|
||||||
@ -745,7 +745,7 @@ class PylotCanvas(FigureCanvas):
|
|||||||
|
|
||||||
def saveFigure(self):
|
def saveFigure(self):
|
||||||
if self.figure:
|
if self.figure:
|
||||||
fd = QtGui.QFileDialog()
|
fd = QtWidgets.QFileDialog()
|
||||||
fname, filter = fd.getSaveFileName(self.parent(), filter='Images (*.png)')
|
fname, filter = fd.getSaveFileName(self.parent(), filter='Images (*.png)')
|
||||||
if not fname:
|
if not fname:
|
||||||
return
|
return
|
||||||
@ -1036,15 +1036,15 @@ class PylotCanvas(FigureCanvas):
|
|||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
|
|
||||||
class PhaseDefaults(QtGui.QDialog):
|
class PhaseDefaults(QtWidgets.QDialog):
|
||||||
def __init__(self, parent=None, nrow=10,
|
def __init__(self, parent=None, nrow=10,
|
||||||
phase_defaults=['P', 'S'],
|
phase_defaults=['P', 'S'],
|
||||||
current_phases=[]):
|
current_phases=[]):
|
||||||
super(PhaseDefaults, self).__init__(parent)
|
super(PhaseDefaults, self).__init__(parent)
|
||||||
self.nrow = nrow
|
self.nrow = nrow
|
||||||
self.checktoggle = True
|
self.checktoggle = True
|
||||||
self.main_layout = QtGui.QVBoxLayout()
|
self.main_layout = QtWidgets.QVBoxLayout()
|
||||||
self.sub_layout = QtGui.QGridLayout()
|
self.sub_layout = QtWidgets.QGridLayout()
|
||||||
self.phase_names = phase_defaults
|
self.phase_names = phase_defaults
|
||||||
self.current_phases = current_phases
|
self.current_phases = current_phases
|
||||||
self.setButtons()
|
self.setButtons()
|
||||||
@ -1054,7 +1054,7 @@ class PhaseDefaults(QtGui.QDialog):
|
|||||||
self.selected_phases = []
|
self.selected_phases = []
|
||||||
|
|
||||||
def setButtons(self):
|
def setButtons(self):
|
||||||
self._check_all_button = QtGui.QPushButton('Check/Uncheck all')
|
self._check_all_button = QtWidgets.QPushButton('Check/Uncheck all')
|
||||||
self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
|
self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
|
||||||
QDialogButtonBox.Cancel)
|
QDialogButtonBox.Cancel)
|
||||||
|
|
||||||
@ -1091,7 +1091,7 @@ class PhaseDefaults(QtGui.QDialog):
|
|||||||
row += 1
|
row += 1
|
||||||
|
|
||||||
def create_phase_box(self, phase_name):
|
def create_phase_box(self, phase_name):
|
||||||
checkbox = QtGui.QCheckBox(phase_name)
|
checkbox = QtWidgets.QCheckBox(phase_name)
|
||||||
return checkbox
|
return checkbox
|
||||||
|
|
||||||
def update_selected_phases(self):
|
def update_selected_phases(self):
|
||||||
@ -1102,7 +1102,7 @@ class PhaseDefaults(QtGui.QDialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
self.update_selected_phases()
|
self.update_selected_phases()
|
||||||
QtGui.QDialog.accept(self)
|
QtWidgets.QDialog.accept(self)
|
||||||
|
|
||||||
|
|
||||||
class PickDlg(QDialog):
|
class PickDlg(QDialog):
|
||||||
@ -1150,7 +1150,7 @@ class PickDlg(QDialog):
|
|||||||
else:
|
else:
|
||||||
self.filteroptions = FILTERDEFAULTS
|
self.filteroptions = FILTERDEFAULTS
|
||||||
self.pick_block = False
|
self.pick_block = False
|
||||||
self.nextStation = QtGui.QCheckBox('Continue with next station.')
|
self.nextStation = QtWidgets.QCheckBox('Continue with next station.')
|
||||||
|
|
||||||
# initialize panning attributes
|
# initialize panning attributes
|
||||||
self.press = None
|
self.press = None
|
||||||
@ -1215,10 +1215,10 @@ class PickDlg(QDialog):
|
|||||||
self.setWindowTitle('Pickwindow on station: {}'.format(self.getStation()))
|
self.setWindowTitle('Pickwindow on station: {}'.format(self.getStation()))
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
menuBar = QtGui.QMenuBar(self)
|
menuBar = QtWidgets.QMenuBar(self)
|
||||||
if not self._embedded:
|
if not self._embedded:
|
||||||
exitMenu = menuBar.addMenu('File')
|
exitMenu = menuBar.addMenu('File')
|
||||||
exitAction = QtGui.QAction('Close', self)
|
exitAction = QtWidgets.QAction('Close', self)
|
||||||
exitAction.triggered.connect(self.close)
|
exitAction.triggered.connect(self.close)
|
||||||
exitMenu.addAction(exitAction)
|
exitMenu.addAction(exitAction)
|
||||||
|
|
||||||
@ -1276,7 +1276,7 @@ class PickDlg(QDialog):
|
|||||||
self.disable_ar_buttons()
|
self.disable_ar_buttons()
|
||||||
|
|
||||||
# add hotkeys
|
# add hotkeys
|
||||||
self._shortcut_space = QtGui.QShortcut(QtGui.QKeySequence(' '), self)
|
self._shortcut_space = QtWidgets.QShortcut(QtWidgets.QKeySequence(' '), self)
|
||||||
self._shortcut_space.activated.connect(self.accept_button.clicked)
|
self._shortcut_space.activated.connect(self.accept_button.clicked)
|
||||||
# button shortcuts (1 for P-button, 2 for S-button)
|
# button shortcuts (1 for P-button, 2 for S-button)
|
||||||
# self.p_button.setShortcut(QKeySequence('1'))
|
# self.p_button.setShortcut(QKeySequence('1'))
|
||||||
@ -1314,7 +1314,7 @@ class PickDlg(QDialog):
|
|||||||
|
|
||||||
# layout the innermost widget
|
# layout the innermost widget
|
||||||
_innerlayout = QVBoxLayout()
|
_innerlayout = QVBoxLayout()
|
||||||
_innerinnerlayout = QtGui.QHBoxLayout()
|
_innerinnerlayout = QtWidgets.QHBoxLayout()
|
||||||
_innerinnerlayout.addWidget(self.multicompfig)
|
_innerinnerlayout.addWidget(self.multicompfig)
|
||||||
_innerinnerlayout.addWidget(self.phaseplot)
|
_innerinnerlayout.addWidget(self.phaseplot)
|
||||||
_innerlayout.addLayout(_innerinnerlayout)
|
_innerlayout.addLayout(_innerinnerlayout)
|
||||||
@ -1554,10 +1554,10 @@ class PickDlg(QDialog):
|
|||||||
def set_button_border_color(self, button, color=None):
|
def set_button_border_color(self, button, color=None):
|
||||||
'''
|
'''
|
||||||
Set background color of a button.
|
Set background color of a button.
|
||||||
button: type = QtGui.QAbstractButton
|
button: type = QtWidgets.QAbstractButton
|
||||||
color: type = QtGui.QColor or type = str (RGBA)
|
color: type = QtWidgets.QColor or type = str (RGBA)
|
||||||
'''
|
'''
|
||||||
if type(color) == QtGui.QColor:
|
if type(color) == QtWidgets.QColor:
|
||||||
button.setStyleSheet({'QPushButton{background-color:transparent}'})
|
button.setStyleSheet({'QPushButton{background-color:transparent}'})
|
||||||
palette = button.palette()
|
palette = button.palette()
|
||||||
role = button.backgroundRole()
|
role = button.backgroundRole()
|
||||||
@ -1759,7 +1759,7 @@ class PickDlg(QDialog):
|
|||||||
data.filter(**filteroptions)
|
data.filter(**filteroptions)
|
||||||
wfdata.filter(**filteroptions)
|
wfdata.filter(**filteroptions)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Information,
|
||||||
'Denied', 'setIniPickP: Could not filter waveform: {}'.format(e))
|
'Denied', 'setIniPickP: Could not filter waveform: {}'.format(e))
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
@ -1817,7 +1817,7 @@ class PickDlg(QDialog):
|
|||||||
data.filter(**filteroptions)
|
data.filter(**filteroptions)
|
||||||
wfdata.filter(**filteroptions)
|
wfdata.filter(**filteroptions)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Information,
|
||||||
'Denied', 'setIniPickS: Could not filter waveform: {}'.format(e))
|
'Denied', 'setIniPickS: Could not filter waveform: {}'.format(e))
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
@ -1883,7 +1883,7 @@ class PickDlg(QDialog):
|
|||||||
try:
|
try:
|
||||||
wfdata.filter(**filteroptions)
|
wfdata.filter(**filteroptions)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Information,
|
||||||
'Denied', 'setPick: Could not filter waveform: {}'.format(e))
|
'Denied', 'setPick: Could not filter waveform: {}'.format(e))
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
@ -2185,7 +2185,7 @@ class PickDlg(QDialog):
|
|||||||
QDialog.reject(self)
|
QDialog.reject(self)
|
||||||
else:
|
else:
|
||||||
self.resetPlot()
|
self.resetPlot()
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Information,
|
||||||
'Denied', 'New picks rejected!')
|
'Denied', 'New picks rejected!')
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
@ -2194,7 +2194,7 @@ class PickDlg(QDialog):
|
|||||||
if not self._embedded:
|
if not self._embedded:
|
||||||
QDialog.accept(self)
|
QDialog.accept(self)
|
||||||
else:
|
else:
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Information,
|
||||||
'Accepted', 'New picks applied!')
|
'Accepted', 'New picks applied!')
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
@ -2213,9 +2213,9 @@ class CanvasWidget(QWidget):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, parent, canvas):
|
def __init__(self, parent, canvas):
|
||||||
QtGui.QWidget.__init__(self, parent)#, 1)
|
QtWidgets.QWidget.__init__(self, parent)#, 1)
|
||||||
canvas = canvas
|
canvas = canvas
|
||||||
self.main_layout = QtGui.QVBoxLayout()
|
self.main_layout = QtWidgets.QVBoxLayout()
|
||||||
self.setLayout(self.main_layout)
|
self.setLayout(self.main_layout)
|
||||||
self.main_layout.addWidget(canvas)
|
self.main_layout.addWidget(canvas)
|
||||||
canvas.setZoomBorders2content()
|
canvas.setZoomBorders2content()
|
||||||
@ -2227,7 +2227,7 @@ class MultiEventWidget(QWidget):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
def __init__(self, options=None, parent=None, windowflag=1):
|
def __init__(self, options=None, parent=None, windowflag=1):
|
||||||
QtGui.QWidget.__init__(self, parent, windowflag)
|
QtWidgets.QWidget.__init__(self, parent, windowflag)
|
||||||
|
|
||||||
self.options = options
|
self.options = options
|
||||||
self.setupUi()
|
self.setupUi()
|
||||||
@ -2236,16 +2236,16 @@ class MultiEventWidget(QWidget):
|
|||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
# init main layout
|
# init main layout
|
||||||
self.main_layout = QtGui.QVBoxLayout()
|
self.main_layout = QtWidgets.QVBoxLayout()
|
||||||
self.setLayout(self.main_layout)
|
self.setLayout(self.main_layout)
|
||||||
# init main splitter
|
# init main splitter
|
||||||
self.main_splitter = QtGui.QSplitter()
|
self.main_splitter = QtWidgets.QSplitter()
|
||||||
self.main_splitter.setChildrenCollapsible(False)
|
self.main_splitter.setChildrenCollapsible(False)
|
||||||
|
|
||||||
self.init_checkboxes()
|
self.init_checkboxes()
|
||||||
|
|
||||||
self.eventbox = QtGui.QComboBox()
|
self.eventbox = QtWidgets.QComboBox()
|
||||||
self.button_clear = QtGui.QPushButton('Clear')
|
self.button_clear = QtWidgets.QPushButton('Clear')
|
||||||
|
|
||||||
self.main_layout.insertWidget(1, self.main_splitter)
|
self.main_layout.insertWidget(1, self.main_splitter)
|
||||||
|
|
||||||
@ -2255,14 +2255,14 @@ class MultiEventWidget(QWidget):
|
|||||||
self.main_splitter.setStretchFactor(1, 2)
|
self.main_splitter.setStretchFactor(1, 2)
|
||||||
|
|
||||||
def init_checkboxes(self):
|
def init_checkboxes(self):
|
||||||
self.rb_layout = QtGui.QHBoxLayout()
|
self.rb_layout = QtWidgets.QHBoxLayout()
|
||||||
|
|
||||||
self.rb_dict = {}
|
self.rb_dict = {}
|
||||||
|
|
||||||
self.start_button = QtGui.QPushButton('Start')
|
self.start_button = QtWidgets.QPushButton('Start')
|
||||||
|
|
||||||
for index, (key, func, color) in enumerate(self.options):
|
for index, (key, func, color) in enumerate(self.options):
|
||||||
rb = QtGui.QRadioButton(key)
|
rb = QtWidgets.QRadioButton(key)
|
||||||
rb.toggled.connect(self.check_rb_selection)
|
rb.toggled.connect(self.check_rb_selection)
|
||||||
if color:
|
if color:
|
||||||
color = 'rgba{}'.format(color)
|
color = 'rgba{}'.format(color)
|
||||||
@ -2283,7 +2283,7 @@ class MultiEventWidget(QWidget):
|
|||||||
|
|
||||||
self.rb_layout.addWidget(self.start_button)
|
self.rb_layout.addWidget(self.start_button)
|
||||||
|
|
||||||
self.rb_layout.addWidget(QtGui.QWidget())
|
self.rb_layout.addWidget(QtWidgets.QWidget())
|
||||||
self.rb_layout.setStretch(len(self.options) + 1, 1)
|
self.rb_layout.setStretch(len(self.options) + 1, 1)
|
||||||
|
|
||||||
self.main_layout.insertLayout(0, self.rb_layout)
|
self.main_layout.insertLayout(0, self.rb_layout)
|
||||||
@ -2339,21 +2339,21 @@ class AutoPickWidget(MultiEventWidget):
|
|||||||
|
|
||||||
def init_plot_layout(self):
|
def init_plot_layout(self):
|
||||||
# init tab widget
|
# init tab widget
|
||||||
self.tab_plots = QtGui.QTabWidget()
|
self.tab_plots = QtWidgets.QTabWidget()
|
||||||
self.gb_plots = QtGui.QGroupBox('Plots')
|
self.gb_plots = QtWidgets.QGroupBox('Plots')
|
||||||
self.gb_plots.setMinimumSize(100, 100)
|
self.gb_plots.setMinimumSize(100, 100)
|
||||||
self.main_splitter.insertWidget(1, self.gb_plots)
|
self.main_splitter.insertWidget(1, self.gb_plots)
|
||||||
self.plot_layout = QtGui.QVBoxLayout()
|
self.plot_layout = QtWidgets.QVBoxLayout()
|
||||||
self.plot_layout.insertWidget(1, self.tab_plots)
|
self.plot_layout.insertWidget(1, self.tab_plots)
|
||||||
self.gb_plots.setLayout(self.plot_layout)
|
self.gb_plots.setLayout(self.plot_layout)
|
||||||
|
|
||||||
def init_log_layout(self):
|
def init_log_layout(self):
|
||||||
self.gb_log = QtGui.QGroupBox('Log')
|
self.gb_log = QtWidgets.QGroupBox('Log')
|
||||||
self.gb_log.setMinimumSize(100, 100)
|
self.gb_log.setMinimumSize(100, 100)
|
||||||
self.main_splitter.insertWidget(0, self.gb_log)
|
self.main_splitter.insertWidget(0, self.gb_log)
|
||||||
|
|
||||||
def insert_log_widget(self, widget):
|
def insert_log_widget(self, widget):
|
||||||
vl = QtGui.QVBoxLayout()
|
vl = QtWidgets.QVBoxLayout()
|
||||||
vl.addWidget(widget)
|
vl.addWidget(widget)
|
||||||
self.gb_log.setLayout(vl)
|
self.gb_log.setLayout(vl)
|
||||||
|
|
||||||
@ -2381,7 +2381,7 @@ class AutoPickWidget(MultiEventWidget):
|
|||||||
def update_plots(self):
|
def update_plots(self):
|
||||||
self.refresh_plot_tabs()
|
self.refresh_plot_tabs()
|
||||||
if len(self.events2plot) > 0:
|
if len(self.events2plot) > 0:
|
||||||
self.eventbox_layout = QtGui.QHBoxLayout()
|
self.eventbox_layout = QtWidgets.QHBoxLayout()
|
||||||
self.generate_combobox()
|
self.generate_combobox()
|
||||||
self.eventbox_layout.addWidget(self.eventbox)
|
self.eventbox_layout.addWidget(self.eventbox)
|
||||||
self.eventbox_layout.addWidget(self.button_clear)
|
self.eventbox_layout.addWidget(self.button_clear)
|
||||||
@ -2416,7 +2416,7 @@ class CompareEventsWidget(MultiEventWidget):
|
|||||||
MultiEventWidget.__init__(self, options, parent, 1)
|
MultiEventWidget.__init__(self, options, parent, 1)
|
||||||
self.eventdict = eventdict
|
self.eventdict = eventdict
|
||||||
self.comparisons = comparisons
|
self.comparisons = comparisons
|
||||||
self.compare_widget = QtGui.QWidget()
|
self.compare_widget = QtWidgets.QWidget()
|
||||||
self.init_eventbox()
|
self.init_eventbox()
|
||||||
self.init_event_area()
|
self.init_event_area()
|
||||||
self.fill_eventbox()
|
self.fill_eventbox()
|
||||||
@ -2436,7 +2436,7 @@ class CompareEventsWidget(MultiEventWidget):
|
|||||||
self.main_layout.insertWidget(1, self.event_area)
|
self.main_layout.insertWidget(1, self.event_area)
|
||||||
|
|
||||||
def init_eventbox(self):
|
def init_eventbox(self):
|
||||||
self.eventbox_layout = QtGui.QHBoxLayout()
|
self.eventbox_layout = QtWidgets.QHBoxLayout()
|
||||||
self.eventbox_layout.addWidget(self.eventbox)
|
self.eventbox_layout.addWidget(self.eventbox)
|
||||||
self.eventbox.currentIndexChanged.connect(self.update_comparison)
|
self.eventbox.currentIndexChanged.connect(self.update_comparison)
|
||||||
|
|
||||||
@ -2478,7 +2478,7 @@ class TuneAutopicker(QWidget):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QtGui.QWidget.__init__(self, parent, 1)
|
QtWidgets.QWidget.__init__(self, parent, 1)
|
||||||
self._style = parent._style
|
self._style = parent._style
|
||||||
self.setWindowTitle('PyLoT - Tune Autopicker')
|
self.setWindowTitle('PyLoT - Tune Autopicker')
|
||||||
self.parameter = self.parent()._inputs
|
self.parameter = self.parent()._inputs
|
||||||
@ -2512,10 +2512,10 @@ class TuneAutopicker(QWidget):
|
|||||||
self.fig_dict = fig_dict
|
self.fig_dict = fig_dict
|
||||||
|
|
||||||
def init_main_layouts(self):
|
def init_main_layouts(self):
|
||||||
self.main_layout = QtGui.QVBoxLayout()
|
self.main_layout = QtWidgets.QVBoxLayout()
|
||||||
self.tune_layout = QtGui.QHBoxLayout()
|
self.tune_layout = QtWidgets.QHBoxLayout()
|
||||||
self.trace_layout = QtGui.QHBoxLayout()
|
self.trace_layout = QtWidgets.QHBoxLayout()
|
||||||
self.parameter_layout = QtGui.QVBoxLayout()
|
self.parameter_layout = QtWidgets.QVBoxLayout()
|
||||||
|
|
||||||
self.main_layout.addLayout(self.trace_layout)
|
self.main_layout.addLayout(self.trace_layout)
|
||||||
self.main_layout.addLayout(self.tune_layout)
|
self.main_layout.addLayout(self.tune_layout)
|
||||||
@ -2528,7 +2528,7 @@ class TuneAutopicker(QWidget):
|
|||||||
self.trace_layout.addWidget(self.eventBox)
|
self.trace_layout.addWidget(self.eventBox)
|
||||||
|
|
||||||
def init_stationlist(self):
|
def init_stationlist(self):
|
||||||
self.stationBox = QtGui.QComboBox()
|
self.stationBox = QtWidgets.QComboBox()
|
||||||
self.stationBox.setMaxVisibleItems(42)
|
self.stationBox.setMaxVisibleItems(42)
|
||||||
self.trace_layout.addWidget(self.stationBox)
|
self.trace_layout.addWidget(self.stationBox)
|
||||||
self.fill_stationbox()
|
self.fill_stationbox()
|
||||||
@ -2564,17 +2564,17 @@ class TuneAutopicker(QWidget):
|
|||||||
stations.sort()
|
stations.sort()
|
||||||
model = self.stationBox.model()
|
model = self.stationBox.model()
|
||||||
for network, station in stations:
|
for network, station in stations:
|
||||||
item = QtGui.QStandardItem(network + '.' + station)
|
item = QtWidgets.QStandardItem(network + '.' + station)
|
||||||
if station in self.get_current_event().pylot_picks:
|
if station in self.get_current_event().pylot_picks:
|
||||||
item.setBackground(self.parent()._ref_test_colors['ref'])
|
item.setBackground(self.parent()._ref_test_colors['ref'])
|
||||||
model.appendRow(item)
|
model.appendRow(item)
|
||||||
|
|
||||||
def init_figure_tabs(self):
|
def init_figure_tabs(self):
|
||||||
self.figure_tabs = QtGui.QTabWidget()
|
self.figure_tabs = QtWidgets.QTabWidget()
|
||||||
self.fill_figure_tabs()
|
self.fill_figure_tabs()
|
||||||
|
|
||||||
def init_pbwidget(self):
|
def init_pbwidget(self):
|
||||||
self.pb_widget = QtGui.QWidget()
|
self.pb_widget = QtWidgets.QWidget()
|
||||||
|
|
||||||
def init_tab_names(self):
|
def init_tab_names(self):
|
||||||
self.ptb_names = ['aicFig', 'slength', 'checkZ4s', 'refPpick', 'el_Ppick', 'fm_picker']
|
self.ptb_names = ['aicFig', 'slength', 'checkZ4s', 'refPpick', 'el_Ppick', 'fm_picker']
|
||||||
@ -2589,17 +2589,17 @@ class TuneAutopicker(QWidget):
|
|||||||
self.tune_layout.insertLayout(1, self.parameter_layout)
|
self.tune_layout.insertLayout(1, self.parameter_layout)
|
||||||
|
|
||||||
def add_buttons(self):
|
def add_buttons(self):
|
||||||
self.pick_button = QtGui.QPushButton('Pick Trace')
|
self.pick_button = QtWidgets.QPushButton('Pick Trace')
|
||||||
self.pick_button.setStyleSheet('QPushButton{border-color: rgba(110, 200, 0, 255)}')
|
self.pick_button.setStyleSheet('QPushButton{border-color: rgba(110, 200, 0, 255)}')
|
||||||
self.pick_button.clicked.connect(self.call_picker)
|
self.pick_button.clicked.connect(self.call_picker)
|
||||||
self.close_button = QtGui.QPushButton('Close')
|
self.close_button = QtWidgets.QPushButton('Close')
|
||||||
self.close_button.clicked.connect(self.hide)
|
self.close_button.clicked.connect(self.hide)
|
||||||
self.trace_layout.addWidget(self.pick_button)
|
self.trace_layout.addWidget(self.pick_button)
|
||||||
self.trace_layout.setStretch(0, 1)
|
self.trace_layout.setStretch(0, 1)
|
||||||
self.parameter_layout.addWidget(self.close_button)
|
self.parameter_layout.addWidget(self.close_button)
|
||||||
|
|
||||||
def add_log(self):
|
def add_log(self):
|
||||||
self.listWidget = QtGui.QListWidget()
|
self.listWidget = QtWidgets.QListWidget()
|
||||||
self.figure_tabs.insertTab(4, self.listWidget, 'log')
|
self.figure_tabs.insertTab(4, self.listWidget, 'log')
|
||||||
|
|
||||||
def add_log_item(self, text):
|
def add_log_item(self, text):
|
||||||
@ -2630,8 +2630,8 @@ class TuneAutopicker(QWidget):
|
|||||||
return str(self.stationBox.currentText()).split('.')[-1]
|
return str(self.stationBox.currentText()).split('.')[-1]
|
||||||
|
|
||||||
def gen_tab_widget(self, name, canvas):
|
def gen_tab_widget(self, name, canvas):
|
||||||
widget = QtGui.QWidget()
|
widget = QtWidgets.QWidget()
|
||||||
v_layout = QtGui.QVBoxLayout()
|
v_layout = QtWidgets.QVBoxLayout()
|
||||||
v_layout.addWidget(canvas)
|
v_layout.addWidget(canvas)
|
||||||
widget.setLayout(v_layout)
|
widget.setLayout(v_layout)
|
||||||
return widget
|
return widget
|
||||||
@ -2659,8 +2659,8 @@ class TuneAutopicker(QWidget):
|
|||||||
self.pickDlg.update_picks.connect(lambda: self.parent().setDirty(True))
|
self.pickDlg.update_picks.connect(lambda: self.parent().setDirty(True))
|
||||||
self.pickDlg.update_picks.connect(self.parent().enableSaveEventAction)
|
self.pickDlg.update_picks.connect(self.parent().enableSaveEventAction)
|
||||||
self.pickDlg.update_picks.connect(self.plot_manual_picks_to_figs)
|
self.pickDlg.update_picks.connect(self.plot_manual_picks_to_figs)
|
||||||
self.pdlg_widget = QtGui.QWidget(self)
|
self.pdlg_widget = QtWidgets.QWidget(self)
|
||||||
hl = QtGui.QHBoxLayout()
|
hl = QtWidgets.QHBoxLayout()
|
||||||
self.pdlg_widget.setLayout(hl)
|
self.pdlg_widget.setLayout(hl)
|
||||||
hl.addWidget(self.pickDlg)
|
hl.addWidget(self.pickDlg)
|
||||||
|
|
||||||
@ -2789,8 +2789,8 @@ class TuneAutopicker(QWidget):
|
|||||||
|
|
||||||
def fill_figure_tabs(self):
|
def fill_figure_tabs(self):
|
||||||
self.clear_all()
|
self.clear_all()
|
||||||
self.p_tabs = QtGui.QTabWidget()
|
self.p_tabs = QtWidgets.QTabWidget()
|
||||||
self.s_tabs = QtGui.QTabWidget()
|
self.s_tabs = QtWidgets.QTabWidget()
|
||||||
self.tune_layout.insertWidget(0, self.figure_tabs)
|
self.tune_layout.insertWidget(0, self.figure_tabs)
|
||||||
self.init_tab_names()
|
self.init_tab_names()
|
||||||
|
|
||||||
@ -2915,13 +2915,13 @@ class TuneAutopicker(QWidget):
|
|||||||
self.figure_tabs.setTabEnabled(3, bool)
|
self.figure_tabs.setTabEnabled(3, bool)
|
||||||
|
|
||||||
def _warn(self, message, info=None):
|
def _warn(self, message, info=None):
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Warning,
|
||||||
'Warning', message)
|
'Warning', message)
|
||||||
self.qmb.setDetailedText(str(info))
|
self.qmb.setDetailedText(str(info))
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
|
|
||||||
class PylotParaBox(QtGui.QWidget):
|
class PylotParaBox(QtWidgets.QWidget):
|
||||||
accepted = QtCore.Signal(str)
|
accepted = QtCore.Signal(str)
|
||||||
rejected = QtCore.Signal(str)
|
rejected = QtCore.Signal(str)
|
||||||
|
|
||||||
@ -2933,10 +2933,10 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
:type: PylotParameter (object)
|
:type: PylotParameter (object)
|
||||||
|
|
||||||
'''
|
'''
|
||||||
QtGui.QWidget.__init__(self, parent, windowflag)
|
QtWidgets.QWidget.__init__(self, parent, windowflag)
|
||||||
self.parameter = parameter
|
self.parameter = parameter
|
||||||
self.tabs = QtGui.QTabWidget()
|
self.tabs = QtWidgets.QTabWidget()
|
||||||
self.layout = QtGui.QVBoxLayout()
|
self.layout = QtWidgets.QVBoxLayout()
|
||||||
self._init_save_buttons()
|
self._init_save_buttons()
|
||||||
self._init_tabs()
|
self._init_tabs()
|
||||||
self._init_dialog_buttons()
|
self._init_dialog_buttons()
|
||||||
@ -2956,15 +2956,15 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
self.rejected.connect(self.params_to_gui)
|
self.rejected.connect(self.params_to_gui)
|
||||||
|
|
||||||
def _init_sublayouts(self):
|
def _init_sublayouts(self):
|
||||||
self._main_layout = QtGui.QVBoxLayout()
|
self._main_layout = QtWidgets.QVBoxLayout()
|
||||||
self._advanced_layout = QtGui.QVBoxLayout()
|
self._advanced_layout = QtWidgets.QVBoxLayout()
|
||||||
self._create_advanced_cb()
|
self._create_advanced_cb()
|
||||||
|
|
||||||
def _init_save_buttons(self):
|
def _init_save_buttons(self):
|
||||||
self._buttons_layout = QtGui.QHBoxLayout()
|
self._buttons_layout = QtWidgets.QHBoxLayout()
|
||||||
self.loadButton = QtGui.QPushButton('&Load settings')
|
self.loadButton = QtWidgets.QPushButton('&Load settings')
|
||||||
self.saveButton = QtGui.QPushButton('&Save settings')
|
self.saveButton = QtWidgets.QPushButton('&Save settings')
|
||||||
self.defaultsButton = QtGui.QPushButton('&Defaults')
|
self.defaultsButton = QtWidgets.QPushButton('&Defaults')
|
||||||
self._buttons_layout.addWidget(self.loadButton)
|
self._buttons_layout.addWidget(self.loadButton)
|
||||||
self._buttons_layout.addWidget(self.saveButton)
|
self._buttons_layout.addWidget(self.saveButton)
|
||||||
self._buttons_layout.addWidget(self.defaultsButton)
|
self._buttons_layout.addWidget(self.defaultsButton)
|
||||||
@ -2977,10 +2977,10 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
self.layout.addWidget(self.tabs)
|
self.layout.addWidget(self.tabs)
|
||||||
|
|
||||||
def _init_dialog_buttons(self):
|
def _init_dialog_buttons(self):
|
||||||
self._dialog_buttons = QtGui.QHBoxLayout()
|
self._dialog_buttons = QtWidgets.QHBoxLayout()
|
||||||
self._okay = QtGui.QPushButton('Ok')
|
self._okay = QtWidgets.QPushButton('Ok')
|
||||||
self._close = QtGui.QPushButton('Close')
|
self._close = QtWidgets.QPushButton('Close')
|
||||||
self._apply = QtGui.QPushButton('Apply')
|
self._apply = QtWidgets.QPushButton('Apply')
|
||||||
self._dialog_buttons.addWidget(self._okay)
|
self._dialog_buttons.addWidget(self._okay)
|
||||||
self._dialog_buttons.addWidget(self._close)
|
self._dialog_buttons.addWidget(self._close)
|
||||||
self._dialog_buttons.addWidget(self._apply)
|
self._dialog_buttons.addWidget(self._apply)
|
||||||
@ -2991,7 +2991,7 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
self.layout.addLayout(self._dialog_buttons)
|
self.layout.addLayout(self._dialog_buttons)
|
||||||
|
|
||||||
def _create_advanced_cb(self):
|
def _create_advanced_cb(self):
|
||||||
self._advanced_cb = QtGui.QCheckBox('Enable Advanced Settings')
|
self._advanced_cb = QtWidgets.QCheckBox('Enable Advanced Settings')
|
||||||
self._advanced_layout.insertWidget(0, self._advanced_cb)
|
self._advanced_layout.insertWidget(0, self._advanced_cb)
|
||||||
self._advanced_cb.toggled.connect(self._toggle_advanced_settings)
|
self._advanced_cb.toggled.connect(self._toggle_advanced_settings)
|
||||||
|
|
||||||
@ -3026,7 +3026,7 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
self._close.show()
|
self._close.show()
|
||||||
|
|
||||||
def init_boxes(self, parameter_names):
|
def init_boxes(self, parameter_names):
|
||||||
grid = QtGui.QGridLayout()
|
grid = QtWidgets.QGridLayout()
|
||||||
|
|
||||||
for index1, name in enumerate(parameter_names):
|
for index1, name in enumerate(parameter_names):
|
||||||
default_item = self.parameter.get_defaults()[name]
|
default_item = self.parameter.get_defaults()[name]
|
||||||
@ -3048,7 +3048,7 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
self.boxes[name] = boxes
|
self.boxes[name] = boxes
|
||||||
namestring = default_item['namestring'][0]
|
namestring = default_item['namestring'][0]
|
||||||
text = namestring + ' [?]'
|
text = namestring + ' [?]'
|
||||||
label = QtGui.QLabel(text)
|
label = QtWidgets.QLabel(text)
|
||||||
self.labels[name] = label
|
self.labels[name] = label
|
||||||
label.setToolTip(tooltip)
|
label.setToolTip(tooltip)
|
||||||
grid.addWidget(label, index1, 1)
|
grid.addWidget(label, index1, 1)
|
||||||
@ -3057,28 +3057,28 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
|
|
||||||
def create_box(self, typ, tooltip):
|
def create_box(self, typ, tooltip):
|
||||||
if typ == str:
|
if typ == str:
|
||||||
box = QtGui.QLineEdit()
|
box = QtWidgets.QLineEdit()
|
||||||
elif typ == float:
|
elif typ == float:
|
||||||
box = QtGui.QDoubleSpinBox()
|
box = QtWidgets.QDoubleSpinBox()
|
||||||
box.setDecimals(4)
|
box.setDecimals(4)
|
||||||
box.setRange(-10e4, 10e4)
|
box.setRange(-10e4, 10e4)
|
||||||
elif typ == int:
|
elif typ == int:
|
||||||
box = QtGui.QSpinBox()
|
box = QtWidgets.QSpinBox()
|
||||||
elif typ == bool:
|
elif typ == bool:
|
||||||
box = QtGui.QCheckBox()
|
box = QtWidgets.QCheckBox()
|
||||||
else:
|
else:
|
||||||
raise TypeError('Unrecognized type {}'.format(typ))
|
raise TypeError('Unrecognized type {}'.format(typ))
|
||||||
return box
|
return box
|
||||||
|
|
||||||
def create_multi_box(self, boxes, headline=None):
|
def create_multi_box(self, boxes, headline=None):
|
||||||
box = QtGui.QWidget()
|
box = QtWidgets.QWidget()
|
||||||
gl = QtGui.QGridLayout()
|
gl = QtWidgets.QGridLayout()
|
||||||
column = 0
|
column = 0
|
||||||
if headline:
|
if headline:
|
||||||
for index, item in enumerate(headline):
|
for index, item in enumerate(headline):
|
||||||
if not item:
|
if not item:
|
||||||
continue
|
continue
|
||||||
gl.addWidget(QtGui.QLabel(item), index, 0, 2)
|
gl.addWidget(QtWidgets.QLabel(item), index, 0, 2)
|
||||||
column = 1
|
column = 1
|
||||||
for index, b in enumerate(boxes):
|
for index, b in enumerate(boxes):
|
||||||
gl.addWidget(b, index, column)
|
gl.addWidget(b, index, column)
|
||||||
@ -3086,8 +3086,8 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
return box, column
|
return box, column
|
||||||
|
|
||||||
def add_tab(self, layout, name):
|
def add_tab(self, layout, name):
|
||||||
widget = QtGui.QWidget()
|
widget = QtWidgets.QWidget()
|
||||||
scrollA = QtGui.QScrollArea()
|
scrollA = QtWidgets.QScrollArea()
|
||||||
scrollA.setWidgetResizable(True)
|
scrollA.setWidgetResizable(True)
|
||||||
scrollA.setWidget(widget)
|
scrollA.setWidget(widget)
|
||||||
widget.setLayout(layout)
|
widget.setLayout(layout)
|
||||||
@ -3120,13 +3120,13 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
self.add_tab(self._advanced_layout, 'Advanced Settings')
|
self.add_tab(self._advanced_layout, 'Advanced Settings')
|
||||||
|
|
||||||
# def gen_h_separator(self):
|
# def gen_h_separator(self):
|
||||||
# separator = QtGui.QFrame()
|
# separator = QtWidgets.QFrame()
|
||||||
# separator.setFrameShape(QtGui.QFrame.HLine)
|
# separator.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
# return separator
|
# return separator
|
||||||
|
|
||||||
# def gen_headline(self, text):
|
# def gen_headline(self, text):
|
||||||
# label=QtGui.QLabel(text)
|
# label=QtWidgets.QLabel(text)
|
||||||
# font=QtGui.QFont()
|
# font=QtWidgets.QFont()
|
||||||
# font.setBold(True)
|
# font.setBold(True)
|
||||||
# label.setFont(font)
|
# label.setFont(font)
|
||||||
# return label
|
# return label
|
||||||
@ -3138,8 +3138,8 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
layout.insertWidget(position, groupbox)
|
layout.insertWidget(position, groupbox)
|
||||||
|
|
||||||
def get_groupbox_exclusive(self, name):
|
def get_groupbox_exclusive(self, name):
|
||||||
widget = QtGui.QWidget(self, 1)
|
widget = QtWidgets.QWidget(self, 1)
|
||||||
layout = QtGui.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
widget.setLayout(layout)
|
widget.setLayout(layout)
|
||||||
layout.addWidget(self.groupboxes[name])
|
layout.addWidget(self.groupboxes[name])
|
||||||
self._exclusive_widgets.append(widget)
|
self._exclusive_widgets.append(widget)
|
||||||
@ -3147,10 +3147,10 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
|
|
||||||
def get_groupbox_dialog(self, name):
|
def get_groupbox_dialog(self, name):
|
||||||
widget = self.get_groupbox_exclusive(name)
|
widget = self.get_groupbox_exclusive(name)
|
||||||
dialog = QtGui.QDialog(self.parent())
|
dialog = QtWidgets.QDialog(self.parent())
|
||||||
layout = QtGui.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
dialog.setLayout(layout)
|
dialog.setLayout(layout)
|
||||||
buttonbox = QtGui.QDialogButtonBox(QDialogButtonBox.Ok |
|
buttonbox = QtWidgets.QDialogButtonBox(QDialogButtonBox.Ok |
|
||||||
QDialogButtonBox.Cancel)
|
QDialogButtonBox.Cancel)
|
||||||
buttonbox.accepted.connect(dialog.accept)
|
buttonbox.accepted.connect(dialog.accept)
|
||||||
buttonbox.accepted.connect(self.refresh)
|
buttonbox.accepted.connect(self.refresh)
|
||||||
@ -3164,7 +3164,7 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
return dialog
|
return dialog
|
||||||
|
|
||||||
def add_to_layout(self, layout, name, items, position):
|
def add_to_layout(self, layout, name, items, position):
|
||||||
groupbox = QtGui.QGroupBox(name)
|
groupbox = QtWidgets.QGroupBox(name)
|
||||||
groupbox._position = position
|
groupbox._position = position
|
||||||
groupbox._parentLayout = layout
|
groupbox._parentLayout = layout
|
||||||
self.groupboxes[name] = groupbox
|
self.groupboxes[name] = groupbox
|
||||||
@ -3254,13 +3254,13 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
self.setValue(box, value)
|
self.setValue(box, value)
|
||||||
|
|
||||||
def setValue(self, box, value):
|
def setValue(self, box, value):
|
||||||
if type(box) == QtGui.QLineEdit:
|
if type(box) == QtWidgets.QLineEdit:
|
||||||
box.setText(str(value))
|
box.setText(str(value))
|
||||||
elif type(box) == QtGui.QSpinBox or type(box) == QtGui.QDoubleSpinBox:
|
elif type(box) == QtWidgets.QSpinBox or type(box) == QtWidgets.QDoubleSpinBox:
|
||||||
if not value:
|
if not value:
|
||||||
value = 0.
|
value = 0.
|
||||||
box.setValue(value)
|
box.setValue(value)
|
||||||
elif type(box) == QtGui.QCheckBox:
|
elif type(box) == QtWidgets.QCheckBox:
|
||||||
if value == 'True':
|
if value == 'True':
|
||||||
value = True
|
value = True
|
||||||
if value == 'False' or value is None:
|
if value == 'False' or value is None:
|
||||||
@ -3271,11 +3271,11 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
self.setValue(b, value[index])
|
self.setValue(b, value[index])
|
||||||
|
|
||||||
def getValue(self, box):
|
def getValue(self, box):
|
||||||
if type(box) == QtGui.QLineEdit:
|
if type(box) == QtWidgets.QLineEdit:
|
||||||
value = str(box.text())
|
value = str(box.text())
|
||||||
elif type(box) == QtGui.QSpinBox or type(box) == QtGui.QDoubleSpinBox:
|
elif type(box) == QtWidgets.QSpinBox or type(box) == QtWidgets.QDoubleSpinBox:
|
||||||
value = box.value()
|
value = box.value()
|
||||||
elif type(box) == QtGui.QCheckBox:
|
elif type(box) == QtWidgets.QCheckBox:
|
||||||
value = box.isChecked()
|
value = box.isChecked()
|
||||||
elif type(box) == list:
|
elif type(box) == list:
|
||||||
value = []
|
value = []
|
||||||
@ -3285,7 +3285,7 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def openFile(self):
|
def openFile(self):
|
||||||
fd = QtGui.QFileDialog()
|
fd = QtWidgets.QFileDialog()
|
||||||
fname = fd.getOpenFileName(self, 'Browse for settings file.',
|
fname = fd.getOpenFileName(self, 'Browse for settings file.',
|
||||||
filter='PyLoT input file (*.in)')
|
filter='PyLoT input file (*.in)')
|
||||||
if fname[0]:
|
if fname[0]:
|
||||||
@ -3297,7 +3297,7 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def saveFile(self):
|
def saveFile(self):
|
||||||
fd = QtGui.QFileDialog()
|
fd = QtWidgets.QFileDialog()
|
||||||
fname = fd.getSaveFileName(self, 'Browse for settings file.',
|
fname = fd.getSaveFileName(self, 'Browse for settings file.',
|
||||||
filter='PyLoT input file (*.in)')
|
filter='PyLoT input file (*.in)')
|
||||||
if fname[0]:
|
if fname[0]:
|
||||||
@ -3322,17 +3322,17 @@ class PylotParaBox(QtGui.QWidget):
|
|||||||
if hasattr(self, '_exclusive_dialog'):
|
if hasattr(self, '_exclusive_dialog'):
|
||||||
self._exclusive_dialog.close()
|
self._exclusive_dialog.close()
|
||||||
self._exclusive_widgets = []
|
self._exclusive_widgets = []
|
||||||
QtGui.QWidget.show(self)
|
QtWidgets.QWidget.show(self)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.rejected.emit('reject')
|
self.rejected.emit('reject')
|
||||||
QtGui.QWidget.close(self)
|
QtWidgets.QWidget.close(self)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
self.accepted.emit('accept')
|
self.accepted.emit('accept')
|
||||||
|
|
||||||
def _warn(self, message):
|
def _warn(self, message):
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning,
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Warning,
|
||||||
'Warning', message)
|
'Warning', message)
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
@ -3713,7 +3713,7 @@ class PhasesTab(PropTab):
|
|||||||
self.PphasesEdit = QLineEdit()
|
self.PphasesEdit = QLineEdit()
|
||||||
self.SphasesEdit = QLineEdit()
|
self.SphasesEdit = QLineEdit()
|
||||||
|
|
||||||
self.pickDefaultsButton = QtGui.QPushButton('Choose default phases...')
|
self.pickDefaultsButton = QtWidgets.QPushButton('Choose default phases...')
|
||||||
PphasesLabel = QLabel("P Phases to pick")
|
PphasesLabel = QLabel("P Phases to pick")
|
||||||
SphasesLabel = QLabel("S Phases to pick")
|
SphasesLabel = QLabel("S Phases to pick")
|
||||||
|
|
||||||
@ -3724,7 +3724,7 @@ class PhasesTab(PropTab):
|
|||||||
self.PphasesEdit.setText("%s" % Pphases)
|
self.PphasesEdit.setText("%s" % Pphases)
|
||||||
self.SphasesEdit.setText("%s" % Sphases)
|
self.SphasesEdit.setText("%s" % Sphases)
|
||||||
|
|
||||||
self.main_layout = QtGui.QHBoxLayout()
|
self.main_layout = QtWidgets.QHBoxLayout()
|
||||||
layout = QGridLayout()
|
layout = QGridLayout()
|
||||||
layout.addWidget(PphasesLabel, 0, 0)
|
layout.addWidget(PphasesLabel, 0, 0)
|
||||||
layout.addWidget(SphasesLabel, 1, 0)
|
layout.addWidget(SphasesLabel, 1, 0)
|
||||||
@ -3809,7 +3809,7 @@ class GraphicsTab(PropTab):
|
|||||||
def add_style_settings(self):
|
def add_style_settings(self):
|
||||||
styles = self.pylot_mainwindow._styles
|
styles = self.pylot_mainwindow._styles
|
||||||
active_stylename = self.pylot_mainwindow._stylename
|
active_stylename = self.pylot_mainwindow._stylename
|
||||||
label = QtGui.QLabel('Application style (might require Application restart):')
|
label = QtWidgets.QLabel('Application style (might require Application restart):')
|
||||||
self.style_cb = QComboBox()
|
self.style_cb = QComboBox()
|
||||||
for stylename, style in styles.items():
|
for stylename, style in styles.items():
|
||||||
self.style_cb.addItem(stylename, style)
|
self.style_cb.addItem(stylename, style)
|
||||||
@ -3825,7 +3825,7 @@ class GraphicsTab(PropTab):
|
|||||||
if not nth_sample:
|
if not nth_sample:
|
||||||
nth_sample = 1
|
nth_sample = 1
|
||||||
|
|
||||||
self.spinbox_nth_sample = QtGui.QSpinBox()
|
self.spinbox_nth_sample = QtWidgets.QSpinBox()
|
||||||
label = QLabel('nth sample')
|
label = QLabel('nth sample')
|
||||||
label.setToolTip('Plot every nth sample (to speed up plotting)')
|
label.setToolTip('Plot every nth sample (to speed up plotting)')
|
||||||
self.spinbox_nth_sample.setMinimum(1)
|
self.spinbox_nth_sample.setMinimum(1)
|
||||||
@ -3846,7 +3846,7 @@ class GraphicsTab(PropTab):
|
|||||||
label = QLabel('PyQt graphic')
|
label = QLabel('PyQt graphic')
|
||||||
label.setToolTip(text[bool(pg)])
|
label.setToolTip(text[bool(pg)])
|
||||||
label.setEnabled(bool(pg))
|
label.setEnabled(bool(pg))
|
||||||
self.checkbox_pg = QtGui.QCheckBox()
|
self.checkbox_pg = QtWidgets.QCheckBox()
|
||||||
self.checkbox_pg.setEnabled(bool(pg))
|
self.checkbox_pg.setEnabled(bool(pg))
|
||||||
self.checkbox_pg.setChecked(bool(pg))
|
self.checkbox_pg.setChecked(bool(pg))
|
||||||
self.main_layout.addWidget(label, 0, 0)
|
self.main_layout.addWidget(label, 0, 0)
|
||||||
@ -4117,17 +4117,17 @@ class FilterOptionsDialog(QDialog):
|
|||||||
self.connectButtons()
|
self.connectButtons()
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.main_layout = QtGui.QVBoxLayout()
|
self.main_layout = QtWidgets.QVBoxLayout()
|
||||||
self.filter_layout = QtGui.QHBoxLayout()
|
self.filter_layout = QtWidgets.QHBoxLayout()
|
||||||
self.groupBoxes = {'P': QtGui.QGroupBox('P Filter'),
|
self.groupBoxes = {'P': QtWidgets.QGroupBox('P Filter'),
|
||||||
'S': QtGui.QGroupBox('S Filter')}
|
'S': QtWidgets.QGroupBox('S Filter')}
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |
|
||||||
QDialogButtonBox.Cancel)
|
QDialogButtonBox.Cancel)
|
||||||
|
|
||||||
for key in ['P', 'S']:
|
for key in ['P', 'S']:
|
||||||
groupbox = self.groupBoxes[key]
|
groupbox = self.groupBoxes[key]
|
||||||
box_layout = QtGui.QVBoxLayout()
|
box_layout = QtWidgets.QVBoxLayout()
|
||||||
groupbox.setLayout(box_layout)
|
groupbox.setLayout(box_layout)
|
||||||
|
|
||||||
self.filter_layout.addWidget(groupbox)
|
self.filter_layout.addWidget(groupbox)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user