make the implementation of the picking dialog widget initialization method better readable
This commit is contained in:
parent
e99d2630a1
commit
f77ba344c3
@ -210,7 +210,6 @@ class PickDlg(QDialog):
|
|||||||
self.updateCurrentLimits()
|
self.updateCurrentLimits()
|
||||||
|
|
||||||
# set plot labels
|
# set plot labels
|
||||||
|
|
||||||
self.setPlotLabels()
|
self.setPlotLabels()
|
||||||
|
|
||||||
# connect button press event to an action
|
# connect button press event to an action
|
||||||
@ -228,11 +227,9 @@ class PickDlg(QDialog):
|
|||||||
# create icons
|
# create icons
|
||||||
filter_icon = QIcon()
|
filter_icon = QIcon()
|
||||||
filter_icon.addPixmap(QPixmap(':/icons/filter.png'))
|
filter_icon.addPixmap(QPixmap(':/icons/filter.png'))
|
||||||
|
|
||||||
zoom_icon = QIcon()
|
zoom_icon = QIcon()
|
||||||
zoom_icon.addPixmap(QPixmap(':/icons/zoom.png'))
|
zoom_icon.addPixmap(QPixmap(':/icons/zoom.png'))
|
||||||
|
|
||||||
|
|
||||||
# create actions
|
# create actions
|
||||||
self.filterAction = createAction(parent=self, text='Filter',
|
self.filterAction = createAction(parent=self, text='Filter',
|
||||||
slot=self.filterWFData,
|
slot=self.filterWFData,
|
||||||
@ -240,43 +237,47 @@ class PickDlg(QDialog):
|
|||||||
tip='Toggle filtered/original'
|
tip='Toggle filtered/original'
|
||||||
' waveforms',
|
' waveforms',
|
||||||
checkable=True)
|
checkable=True)
|
||||||
self.selectPhase = QComboBox()
|
|
||||||
phaseitems = [None] + FILTERDEFAULTS.keys()
|
|
||||||
self.selectPhase.addItems(phaseitems)
|
|
||||||
|
|
||||||
self.zoomAction = createAction(parent=self, text='Zoom',
|
self.zoomAction = createAction(parent=self, text='Zoom',
|
||||||
slot=self.zoom, icon=zoom_icon,
|
slot=self.zoom, icon=zoom_icon,
|
||||||
tip='Zoom into waveform',
|
tip='Zoom into waveform',
|
||||||
checkable=True)
|
checkable=True)
|
||||||
|
|
||||||
|
# create other widget elements
|
||||||
|
self.selectPhase = QComboBox()
|
||||||
|
phaseitems = [None] + FILTERDEFAULTS.keys()
|
||||||
|
self.selectPhase.addItems(phaseitems)
|
||||||
|
|
||||||
# layout the outermost appearance of the Pick Dialog
|
# layout the outermost appearance of the Pick Dialog
|
||||||
_outerlayout = QVBoxLayout()
|
_outerlayout = QVBoxLayout()
|
||||||
_dialtoolbar = QToolBar()
|
_dialtoolbar = QToolBar()
|
||||||
|
|
||||||
# fill toolbar with content
|
# fill toolbar with content
|
||||||
|
|
||||||
_dialtoolbar.addAction(self.filterAction)
|
_dialtoolbar.addAction(self.filterAction)
|
||||||
_dialtoolbar.addWidget(self.selectPhase)
|
_dialtoolbar.addWidget(self.selectPhase)
|
||||||
_dialtoolbar.addAction(self.zoomAction)
|
_dialtoolbar.addAction(self.zoomAction)
|
||||||
|
|
||||||
|
# layout the innermost widget
|
||||||
_innerlayout = QVBoxLayout()
|
_innerlayout = QVBoxLayout()
|
||||||
|
|
||||||
_innerlayout.addWidget(self.multicompfig)
|
_innerlayout.addWidget(self.multicompfig)
|
||||||
|
|
||||||
|
# add button box to the dialog
|
||||||
_buttonbox = QDialogButtonBox(QDialogButtonBox.Apply |
|
_buttonbox = QDialogButtonBox(QDialogButtonBox.Apply |
|
||||||
QDialogButtonBox.Ok |
|
QDialogButtonBox.Ok |
|
||||||
QDialogButtonBox.Cancel)
|
QDialogButtonBox.Cancel)
|
||||||
|
|
||||||
|
# merge widgets and layouts to establish the dialog
|
||||||
_innerlayout.addWidget(_buttonbox)
|
_innerlayout.addWidget(_buttonbox)
|
||||||
|
|
||||||
_outerlayout.addWidget(_dialtoolbar)
|
_outerlayout.addWidget(_dialtoolbar)
|
||||||
_outerlayout.addLayout(_innerlayout)
|
_outerlayout.addLayout(_innerlayout)
|
||||||
|
|
||||||
|
# connect widget element signals with slots (methods to the dialog
|
||||||
|
# object
|
||||||
self.selectPhase.currentIndexChanged.connect(self.verifyPhaseSelection)
|
self.selectPhase.currentIndexChanged.connect(self.verifyPhaseSelection)
|
||||||
|
|
||||||
_buttonbox.accepted.connect(self.accept)
|
_buttonbox.accepted.connect(self.accept)
|
||||||
_buttonbox.rejected.connect(self.reject)
|
_buttonbox.rejected.connect(self.reject)
|
||||||
_buttonbox.button(QDialogButtonBox.Apply).clicked.connect(self.apply)
|
_buttonbox.button(QDialogButtonBox.Apply).clicked.connect(self.apply)
|
||||||
|
|
||||||
|
# finally layout the entire dialog
|
||||||
self.setLayout(_outerlayout)
|
self.setLayout(_outerlayout)
|
||||||
|
|
||||||
def disconnectPressEvent(self):
|
def disconnectPressEvent(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user