qmk_settings: implement reset command
parent
7129fca01f
commit
6c90d164c0
|
|
@ -55,6 +55,7 @@ CMD_VIAL_LOCK = 0x08
|
|||
CMD_VIAL_QMK_SETTINGS_QUERY = 0x09
|
||||
CMD_VIAL_QMK_SETTINGS_GET = 0x0A
|
||||
CMD_VIAL_QMK_SETTINGS_SET = 0x0B
|
||||
CMD_VIAL_QMK_SETTINGS_RESET = 0x0C
|
||||
|
||||
# how much of a macro/keymap buffer we can read/write per packet
|
||||
BUFFER_FETCH_CHUNK = 28
|
||||
|
|
@ -658,6 +659,9 @@ class Keyboard:
|
|||
print("resp", data.hex())
|
||||
return data[0]
|
||||
|
||||
def qmk_settings_reset(self):
|
||||
self.usb_send(self.dev, struct.pack("BB", CMD_VIA_VIAL_PREFIX, CMD_VIAL_QMK_SETTINGS_RESET))
|
||||
|
||||
|
||||
class DummyKeyboard(Keyboard):
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from collections import defaultdict
|
|||
|
||||
from PyQt5 import QtCore
|
||||
from PyQt5.QtWidgets import QVBoxLayout, QCheckBox, QGridLayout, QLabel, QWidget, QSizePolicy, QTabWidget, QSpinBox, \
|
||||
QHBoxLayout, QPushButton
|
||||
QHBoxLayout, QPushButton, QMessageBox
|
||||
|
||||
from basic_editor import BasicEditor
|
||||
from util import tr
|
||||
|
|
@ -150,8 +150,11 @@ class QmkSettings(BasicEditor):
|
|||
self.keyboard.qmk_settings_set(qsid, value)
|
||||
|
||||
def reset_settings(self):
|
||||
# TODO: implement this
|
||||
raise NotImplementedError
|
||||
if QMessageBox.question(self.widget(), "",
|
||||
tr("QmkSettings", "Reset all settings to default values?"),
|
||||
QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
|
||||
self.keyboard.qmk_settings_reset()
|
||||
self.reload_settings()
|
||||
|
||||
def valid(self):
|
||||
return isinstance(self.device, VialKeyboard) and \
|
||||
|
|
|
|||
Loading…
Reference in New Issue