mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
refactoring
This commit is contained in:
@@ -51,10 +51,10 @@ class Plugin(BaseHid):
|
||||
noop: bool,
|
||||
) -> None:
|
||||
|
||||
self.__state_notifier = aiomulti.AioProcessNotifier()
|
||||
self.__notifier = aiomulti.AioProcessNotifier()
|
||||
|
||||
self.__keyboard_proc = KeyboardProcess(noop=noop, state_notifier=self.__state_notifier, **keyboard)
|
||||
self.__mouse_proc = MouseProcess(noop=noop, state_notifier=self.__state_notifier, **mouse)
|
||||
self.__keyboard_proc = KeyboardProcess(noop=noop, notifier=self.__notifier, **keyboard)
|
||||
self.__mouse_proc = MouseProcess(noop=noop, notifier=self.__notifier, **mouse)
|
||||
|
||||
@classmethod
|
||||
def get_plugin_options(cls) -> Dict:
|
||||
@@ -101,7 +101,7 @@ class Plugin(BaseHid):
|
||||
if state != prev_state:
|
||||
yield state
|
||||
prev_state = state
|
||||
await self.__state_notifier.wait()
|
||||
await self.__notifier.wait()
|
||||
|
||||
async def reset(self) -> None:
|
||||
self.__keyboard_proc.send_reset_event()
|
||||
|
||||
@@ -47,7 +47,7 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in
|
||||
name: str,
|
||||
read_size: int,
|
||||
initial_state: Dict,
|
||||
state_notifier: aiomulti.AioProcessNotifier,
|
||||
notifier: aiomulti.AioProcessNotifier,
|
||||
|
||||
device_path: str,
|
||||
select_timeout: float,
|
||||
@@ -69,7 +69,7 @@ class BaseDeviceProcess(multiprocessing.Process): # pylint: disable=too-many-in
|
||||
|
||||
self.__fd = -1
|
||||
self.__events_queue: multiprocessing.queues.Queue = multiprocessing.Queue()
|
||||
self.__state_flags = aiomulti.AioSharedFlags({"online": True, **initial_state}, state_notifier)
|
||||
self.__state_flags = aiomulti.AioSharedFlags({"online": True, **initial_state}, notifier)
|
||||
self.__stop_event = multiprocessing.Event()
|
||||
|
||||
def run(self) -> None:
|
||||
|
||||
@@ -191,13 +191,13 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
|
||||
|
||||
self.__events_queue: multiprocessing.queues.Queue = multiprocessing.Queue()
|
||||
|
||||
self.__state_notifier = aiomulti.AioProcessNotifier()
|
||||
self.__notifier = aiomulti.AioProcessNotifier()
|
||||
self.__state_flags = aiomulti.AioSharedFlags({
|
||||
"online": True,
|
||||
"caps": False,
|
||||
"scroll": False,
|
||||
"num": False,
|
||||
}, self.__state_notifier)
|
||||
}, self.__notifier)
|
||||
|
||||
self.__stop_event = multiprocessing.Event()
|
||||
|
||||
@@ -243,7 +243,7 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
|
||||
if state != prev_state:
|
||||
yield state
|
||||
prev_state = state
|
||||
await self.__state_notifier.wait()
|
||||
await self.__notifier.wait()
|
||||
|
||||
@aiotools.atomic
|
||||
async def reset(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user