Feat: Add Prev/Next subpage navigation buttons
This commit is contained in:
@@ -61,8 +61,19 @@ class MainWindow(QMainWindow):
|
|||||||
self.subpage_combo = QComboBox()
|
self.subpage_combo = QComboBox()
|
||||||
self.subpage_combo.setMinimumWidth(250)
|
self.subpage_combo.setMinimumWidth(250)
|
||||||
self.subpage_combo.currentIndexChanged.connect(self.on_subpage_changed)
|
self.subpage_combo.currentIndexChanged.connect(self.on_subpage_changed)
|
||||||
|
|
||||||
|
self.btn_prev_sub = QPushButton("<")
|
||||||
|
self.btn_prev_sub.setFixedWidth(30)
|
||||||
|
self.btn_prev_sub.clicked.connect(self.prev_subpage)
|
||||||
|
|
||||||
|
self.btn_next_sub = QPushButton(">")
|
||||||
|
self.btn_next_sub.setFixedWidth(30)
|
||||||
|
self.btn_next_sub.clicked.connect(self.next_subpage)
|
||||||
|
|
||||||
top_bar.addWidget(self.subpage_label)
|
top_bar.addWidget(self.subpage_label)
|
||||||
|
top_bar.addWidget(self.btn_prev_sub)
|
||||||
top_bar.addWidget(self.subpage_combo)
|
top_bar.addWidget(self.subpage_combo)
|
||||||
|
top_bar.addWidget(self.btn_next_sub)
|
||||||
top_bar.addStretch()
|
top_bar.addStretch()
|
||||||
|
|
||||||
center_layout.addLayout(top_bar)
|
center_layout.addLayout(top_bar)
|
||||||
@@ -139,6 +150,22 @@ class MainWindow(QMainWindow):
|
|||||||
self.canvas.redraw()
|
self.canvas.redraw()
|
||||||
self.canvas.update()
|
self.canvas.update()
|
||||||
|
|
||||||
|
def prev_subpage(self):
|
||||||
|
count = self.subpage_combo.count()
|
||||||
|
if count <= 1: return
|
||||||
|
|
||||||
|
current = self.subpage_combo.currentIndex()
|
||||||
|
new_index = (current - 1) % count
|
||||||
|
self.subpage_combo.setCurrentIndex(new_index)
|
||||||
|
|
||||||
|
def next_subpage(self):
|
||||||
|
count = self.subpage_combo.count()
|
||||||
|
if count <= 1: return
|
||||||
|
|
||||||
|
current = self.subpage_combo.currentIndex()
|
||||||
|
new_index = (current + 1) % count
|
||||||
|
self.subpage_combo.setCurrentIndex(new_index)
|
||||||
|
|
||||||
def close_file(self):
|
def close_file(self):
|
||||||
# Reset everything
|
# Reset everything
|
||||||
self.service = TeletextService()
|
self.service = TeletextService()
|
||||||
|
|||||||
Reference in New Issue
Block a user