mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 00:14:09 -04:00
Store last backlight color and last LCD buffer for use later
This commit is contained in:
parent
6feee44d16
commit
a384ce2daf
@ -74,6 +74,8 @@ class DeviceManager(threading.Thread, Observer):
|
|||||||
self._lastProfile = None
|
self._lastProfile = None
|
||||||
self._grabNextKey = False
|
self._grabNextKey = False
|
||||||
self._leds = 0
|
self._leds = 0
|
||||||
|
self._lastBacklightColor = [0, 0, 0]
|
||||||
|
self._lastBuffer = [0] * LCD_BUFFER_SIZE
|
||||||
|
|
||||||
self._appletManager = AppletManager(self, prefs)
|
self._appletManager = AppletManager(self, prefs)
|
||||||
|
|
||||||
@ -201,6 +203,8 @@ class DeviceManager(threading.Thread, Observer):
|
|||||||
self._commandQueue.put([self._setBacklightColor, (r, g, b)])
|
self._commandQueue.put([self._setBacklightColor, (r, g, b)])
|
||||||
|
|
||||||
def _setBacklightColor(self, r, g, b):
|
def _setBacklightColor(self, r, g, b):
|
||||||
|
self._lastBacklightColor = [r, g, b]
|
||||||
|
|
||||||
data = [5, int(r), int(g), int(b), 0]
|
data = [5, int(r), int(g), int(b), 0]
|
||||||
type = usb.util.CTRL_TYPE_CLASS | usb.util.CTRL_RECIPIENT_INTERFACE
|
type = usb.util.CTRL_TYPE_CLASS | usb.util.CTRL_RECIPIENT_INTERFACE
|
||||||
|
|
||||||
@ -208,6 +212,10 @@ class DeviceManager(threading.Thread, Observer):
|
|||||||
type, bRequest=9, wValue=0x307, wIndex=0,
|
type, bRequest=9, wValue=0x307, wIndex=0,
|
||||||
data_or_wLength=data)
|
data_or_wLength=data)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lastBacklightColor(self):
|
||||||
|
return self._lastBacklightColor
|
||||||
|
|
||||||
def setLCDBuffer(self, buffer):
|
def setLCDBuffer(self, buffer):
|
||||||
"""Updates the LCD screen with the contents of buffer.
|
"""Updates the LCD screen with the contents of buffer.
|
||||||
|
|
||||||
@ -227,6 +235,12 @@ class DeviceManager(threading.Thread, Observer):
|
|||||||
usb.util.CTRL_OUT | G13Endpoints.LCD.value,
|
usb.util.CTRL_OUT | G13Endpoints.LCD.value,
|
||||||
bytes(header) + bytes(buffer))
|
bytes(header) + bytes(buffer))
|
||||||
|
|
||||||
|
self._lastBuffer = buffer
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lastBuffer(self):
|
||||||
|
return self._lastBuffer
|
||||||
|
|
||||||
def _processCommands(self):
|
def _processCommands(self):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user