firmware_flasher: add checkbox to not restore current layout

main
Ilya Zhuravlev 2021-01-01 05:13:21 -05:00
parent 476ed41b52
commit 5d03299f78
1 changed files with 8 additions and 3 deletions

View File

@ -8,7 +8,8 @@ import threading
from PyQt5.QtCore import pyqtSignal, QCoreApplication from PyQt5.QtCore import pyqtSignal, QCoreApplication
from PyQt5.QtGui import QFontDatabase 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 basic_editor import BasicEditor
from unlocker import Unlocker from unlocker import Unlocker
@ -139,6 +140,9 @@ class FirmwareFlasher(BasicEditor):
self.btn_flash.setText(tr("Flasher", "Flash")) self.btn_flash.setText(tr("Flasher", "Flash"))
self.btn_flash.clicked.connect(self.on_click_flash) self.btn_flash.clicked.connect(self.on_click_flash)
progress_flash.addWidget(self.btn_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.addLayout(progress_flash)
self.device = None self.device = None
@ -197,6 +201,7 @@ class FirmwareFlasher(BasicEditor):
if isinstance(self.device, VialKeyboard): if isinstance(self.device, VialKeyboard):
# back up current layout # back up current layout
if self.chk_restore_keymap.isChecked():
self.log("Backing up current layout...") self.log("Backing up current layout...")
self.layout_restore = self.device.keyboard.save_layout() self.layout_restore = self.device.keyboard.save_layout()