Рефакторинг. Вынос логики чтения /sys через отдельный класс.

master-3.5
parent 3163e12ef9
commit ab75ab90ac

@ -24,6 +24,7 @@ from calculate.lib.datavars import (Variable, VariableError, ReadonlyVariable,
VariableInterface)
from calculate.lib.utils.common import getValueFromConfig
from calculate.lib.variables import user
from calculate.lib.utils.device import sysfs
from calculate.lib.utils.files import (readLinesFile, process,
listDirectory, readFile)
from calculate.desktop._cl_keys import getKey
@ -211,9 +212,9 @@ class VariableClDesktopXfcePointers(ReadonlyVariable):
def get(self):
def generate():
for name_fn in sorted(
glob.glob("/sys/class/input/mouse*/device/name")):
data = readFile(name_fn)
for input_device_name in sorted(
sysfs.glob(sysfs.Path.Input, "mouse*/device/name")):
data = sysfs.read(input_device_name)
if data:
yield data.strip().replace(" ", "_").replace("/","")

Loading…
Cancel
Save