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

master-3.5
parent 3163e12ef9
commit ab75ab90ac

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

Loading…
Cancel
Save