[add] prev/next event button (~~had to remove min button width)
This commit is contained in:
parent
78d5ee58b5
commit
0ebc6e11f8
34
PyLoT.py
34
PyLoT.py
@ -563,20 +563,29 @@ class MainWindow(QMainWindow):
|
|||||||
style = settings.value('style')
|
style = settings.value('style')
|
||||||
self.set_style(style)
|
self.set_style(style)
|
||||||
|
|
||||||
# add event combo box and ref/test buttons
|
# add event combo box, forward, backward and ref/test buttons
|
||||||
self.eventBox = self.createEventBox()
|
self.eventBox = self.createEventBox()
|
||||||
self.eventBox.setMaxVisibleItems(30)
|
self.eventBox.setMaxVisibleItems(30)
|
||||||
self.eventBox.setEnabled(False)
|
self.eventBox.setEnabled(False)
|
||||||
|
self.previous_button = QPushButton('<')
|
||||||
|
self.next_button = QPushButton('>')
|
||||||
self.init_ref_test_buttons()
|
self.init_ref_test_buttons()
|
||||||
self._event_layout = QHBoxLayout()
|
self._event_layout = QHBoxLayout()
|
||||||
self._event_layout.addWidget(QLabel('Event: '))
|
self._event_layout.addWidget(QLabel('Event: '))
|
||||||
self._event_layout.addWidget(self.eventBox)
|
self._event_layout.addWidget(self.eventBox)
|
||||||
|
self._event_layout.addWidget(self.previous_button)
|
||||||
|
self._event_layout.addWidget(self.next_button)
|
||||||
self._event_layout.addWidget(self.ref_event_button)
|
self._event_layout.addWidget(self.ref_event_button)
|
||||||
self._event_layout.addWidget(self.test_event_button)
|
self._event_layout.addWidget(self.test_event_button)
|
||||||
self._event_layout.setStretch(1, 1) # set stretch of item 1 to 1
|
self._event_layout.setStretch(1, 1) # set stretch of item 1 to 1
|
||||||
self._main_layout.addLayout(self._event_layout)
|
self._main_layout.addLayout(self._event_layout)
|
||||||
self.eventBox.activated.connect(self.refreshEvents)
|
self.eventBox.activated.connect(self.refreshEvents)
|
||||||
|
|
||||||
|
self.previous_button.clicked.connect(self.previous_event)
|
||||||
|
self.next_button.clicked.connect(self.next_event)
|
||||||
|
self.previous_button.setEnabled(False)
|
||||||
|
self.next_button.setEnabled(False)
|
||||||
|
|
||||||
# add main tab widget
|
# add main tab widget
|
||||||
self.tabs = QTabWidget(self)
|
self.tabs = QTabWidget(self)
|
||||||
self._main_layout.addWidget(self.tabs)
|
self._main_layout.addWidget(self.tabs)
|
||||||
@ -652,6 +661,8 @@ class MainWindow(QMainWindow):
|
|||||||
'''
|
'''
|
||||||
self.ref_event_button = QtGui.QPushButton('Tune')
|
self.ref_event_button = QtGui.QPushButton('Tune')
|
||||||
self.test_event_button = QtGui.QPushButton('Test')
|
self.test_event_button = QtGui.QPushButton('Test')
|
||||||
|
self.ref_event_button.setMinimumWidth(100)
|
||||||
|
self.test_event_button.setMinimumWidth(100)
|
||||||
self.ref_event_button.setToolTip('Set manual picks of current ' +
|
self.ref_event_button.setToolTip('Set manual picks of current ' +
|
||||||
'event as reference picks for autopicker tuning.')
|
'event as reference picks for autopicker tuning.')
|
||||||
self.test_event_button.setToolTip('Set manual picks of current ' +
|
self.test_event_button.setToolTip('Set manual picks of current ' +
|
||||||
@ -1473,6 +1484,26 @@ class MainWindow(QMainWindow):
|
|||||||
if self.tap:
|
if self.tap:
|
||||||
self.tap.fill_eventbox()
|
self.tap.fill_eventbox()
|
||||||
|
|
||||||
|
def checkEventButtons(self):
|
||||||
|
if self.eventBox.currentIndex() == 0:
|
||||||
|
prev_state = False
|
||||||
|
else:
|
||||||
|
prev_state = True
|
||||||
|
if self.eventBox.currentIndex() == len(self.project.eventlist) - 1:
|
||||||
|
next_state = False
|
||||||
|
else:
|
||||||
|
next_state = True
|
||||||
|
self.previous_button.setEnabled(prev_state)
|
||||||
|
self.next_button.setEnabled(next_state)
|
||||||
|
|
||||||
|
def previous_event(self):
|
||||||
|
self.eventBox.setCurrentIndex(self.eventBox.currentIndex() - 1)
|
||||||
|
self.eventBox.activated.emit(-1)
|
||||||
|
|
||||||
|
def next_event(self):
|
||||||
|
self.eventBox.setCurrentIndex(self.eventBox.currentIndex() + 1)
|
||||||
|
self.eventBox.activated.emit(+1)
|
||||||
|
|
||||||
def refreshEvents(self):
|
def refreshEvents(self):
|
||||||
'''
|
'''
|
||||||
Refresh GUI when events get changed.
|
Refresh GUI when events get changed.
|
||||||
@ -1483,6 +1514,7 @@ class MainWindow(QMainWindow):
|
|||||||
# array_map refresh is not necessary when changing event in waveform plot tab,
|
# array_map refresh is not necessary when changing event in waveform plot tab,
|
||||||
# but gets necessary when switching from one to another after changing an event.
|
# but gets necessary when switching from one to another after changing an event.
|
||||||
self._eventChanged = [True, True]
|
self._eventChanged = [True, True]
|
||||||
|
self.checkEventButtons()
|
||||||
self.refreshTabs()
|
self.refreshTabs()
|
||||||
|
|
||||||
def refreshTabs(self):
|
def refreshTabs(self):
|
||||||
|
@ -1 +1 @@
|
|||||||
8d6de0-dirty
|
78d5e-dirty
|
||||||
|
@ -1300,6 +1300,8 @@ class PickDlg(QDialog):
|
|||||||
# create buttons for P and S filter and picking
|
# create buttons for P and S filter and picking
|
||||||
self.p_button = QPushButton('P', self)
|
self.p_button = QPushButton('P', self)
|
||||||
self.s_button = QPushButton('S', self)
|
self.s_button = QPushButton('S', self)
|
||||||
|
self.p_button.setMinimumWidth(100)
|
||||||
|
self.s_button.setMinimumWidth(100)
|
||||||
self.p_button.setCheckable(True)
|
self.p_button.setCheckable(True)
|
||||||
self.s_button.setCheckable(True)
|
self.s_button.setCheckable(True)
|
||||||
# set button tooltips
|
# set button tooltips
|
||||||
|
@ -124,7 +124,6 @@ color:rgba(0, 0, 0, 255);
|
|||||||
border-style: outset;
|
border-style: outset;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-color: rgba(100, 100, 120, 255);
|
border-color: rgba(100, 100, 120, 255);
|
||||||
min-width: 6em;
|
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
padding-left:5px;
|
padding-left:5px;
|
||||||
padding-right:5px;
|
padding-right:5px;
|
||||||
|
@ -123,7 +123,6 @@ color:rgba(255, 255, 255, 255);
|
|||||||
border-style: outset;
|
border-style: outset;
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-color: rgba(50, 50, 60, 255);
|
border-color: rgba(50, 50, 60, 255);
|
||||||
min-width: 6em;
|
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
padding-left:5px;
|
padding-left:5px;
|
||||||
padding-right:5px;
|
padding-right:5px;
|
||||||
|
Loading…
Reference in New Issue
Block a user