From 5d03299f785b9024a5093b6d422e57490909b7d7 Mon Sep 17 00:00:00 2001 From: Ilya Zhuravlev Date: Fri, 1 Jan 2021 05:13:21 -0500 Subject: [PATCH] firmware_flasher: add checkbox to not restore current layout --- src/main/python/firmware_flasher.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/python/firmware_flasher.py b/src/main/python/firmware_flasher.py index 738a5b4..95c8d23 100644 --- a/src/main/python/firmware_flasher.py +++ b/src/main/python/firmware_flasher.py @@ -8,7 +8,8 @@ import threading from PyQt5.QtCore import pyqtSignal, QCoreApplication from PyQt5.QtGui import QFontDatabase -from PyQt5.QtWidgets import QHBoxLayout, QLineEdit, QToolButton, QPlainTextEdit, QProgressBar,QFileDialog, QDialog +from PyQt5.QtWidgets import QHBoxLayout, QLineEdit, QToolButton, QPlainTextEdit, QProgressBar, QFileDialog, QDialog, \ + QCheckBox from basic_editor import BasicEditor from unlocker import Unlocker @@ -139,6 +140,9 @@ class FirmwareFlasher(BasicEditor): self.btn_flash.setText(tr("Flasher", "Flash")) self.btn_flash.clicked.connect(self.on_click_flash) progress_flash.addWidget(self.btn_flash) + self.chk_restore_keymap = QCheckBox(tr("Flasher", "Restore current layout after flashing")) + self.chk_restore_keymap.setChecked(True) + self.addWidget(self.chk_restore_keymap) self.addLayout(progress_flash) self.device = None @@ -197,8 +201,9 @@ class FirmwareFlasher(BasicEditor): if isinstance(self.device, VialKeyboard): # back up current layout - self.log("Backing up current layout...") - self.layout_restore = self.device.keyboard.save_layout() + if self.chk_restore_keymap.isChecked(): + self.log("Backing up current layout...") + self.layout_restore = self.device.keyboard.save_layout() # keep track of which keyboard we should restore saved layout to self.uid_restore = self.device.keyboard.get_uid()