feat: add Flash/Steady toggle button to sidebar
Some checks failed
Build Linux / Build Linux (push) Successful in 1m26s
Build Windows / Build Windows (push) Has been cancelled

This commit is contained in:
2026-02-21 12:50:28 +01:00
parent 38884c8f33
commit 6b9bf47504

View File

@@ -301,6 +301,14 @@ class MainWindow(QMainWindow):
btn_release.clicked.connect(lambda: self.insert_char(0x1F))
right_layout.addWidget(btn_release)
# Flash / Steady Toggle (0x08 / 0x09)
self.btn_flash_toggle = QPushButton("Flash/Steady")
self.btn_flash_toggle.setFixedSize(100, 30)
self.btn_flash_toggle.setStyleSheet("background-color: #FFCC00; color: black; font-weight: bold; border: 1px solid #555; border-radius: 3px;")
self.btn_flash_toggle.setToolTip("Toggles between Start Flashing (0x08) and Steady (0x09) at cursor.")
self.btn_flash_toggle.clicked.connect(self.toggle_flashing_attr)
right_layout.addWidget(self.btn_flash_toggle)
right_layout.addSpacing(10)
# Page Language Setting
@@ -926,6 +934,29 @@ class MainWindow(QMainWindow):
self.canvas.move_cursor(1, 0)
self.canvas.setFocus()
def toggle_flashing_attr(self):
self.push_undo_state()
val = self.canvas.get_byte_at(self.canvas.cursor_x, self.canvas.cursor_y)
if val == 0x08:
new_val = 0x09 # Toggle to Steady
elif val == 0x07: # Let's say if we are on white, maybe we toggle flash?
new_val = 0x08 # No, that's not intuitive.
# If not flashing, make it flash.
# If flashing, make it steady.
else:
new_val = 0x08 # Default to flash if something else
if val == 0x08:
new_val = 0x09
elif val == 0x09:
new_val = 0x08
else:
new_val = 0x08 # Default
self.canvas.set_byte_at_cursor(new_val)
# We DON'T move cursor here so user can toggle again
self.canvas.setFocus()
def insert_color(self, base_code):
code = base_code
if self.chk_graphics.isChecked():