mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-10-21 11:42:12 +00:00
refactor: streamline platform imports and remove redundant type method
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import collections
|
import collections
|
||||||
import sys
|
|
||||||
|
|
||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
from module.device.app_control import AppControl
|
from module.device.app_control import AppControl
|
||||||
from module.device.control import Control
|
from module.device.control import Control
|
||||||
|
from module.device.platform import Platform
|
||||||
from module.device.screenshot import Screenshot
|
from module.device.screenshot import Screenshot
|
||||||
from module.exception import (
|
from module.exception import (
|
||||||
EmulatorNotRunningError,
|
EmulatorNotRunningError,
|
||||||
@@ -14,11 +14,6 @@ from module.exception import (
|
|||||||
)
|
)
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
|
||||||
from module.device.platform.platform_windows import PlatformWindows as Platform
|
|
||||||
else:
|
|
||||||
from module.device.platform.platform_base import PlatformBase as Platform
|
|
||||||
|
|
||||||
|
|
||||||
def show_function_call():
|
def show_function_call():
|
||||||
"""
|
"""
|
||||||
@@ -85,7 +80,7 @@ class Device(Screenshot, Control, AppControl, Platform):
|
|||||||
# Auto-fill emulator info
|
# Auto-fill emulator info
|
||||||
if self.config.EmulatorInfo_Emulator == 'auto':
|
if self.config.EmulatorInfo_Emulator == 'auto':
|
||||||
_ = self.emulator_instance
|
_ = self.emulator_instance
|
||||||
|
|
||||||
self.screenshot_interval_set()
|
self.screenshot_interval_set()
|
||||||
|
|
||||||
# Auto-select the fastest screenshot method
|
# Auto-select the fastest screenshot method
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
from module.device.platform.platform_windows import PlatformWindows as Platform
|
||||||
|
else:
|
||||||
|
from module.device.platform.platform_base import PlatformBase as Platform
|
||||||
@@ -54,7 +54,7 @@ class EmulatorInstanceBase:
|
|||||||
Returns:
|
Returns:
|
||||||
str: Emulator type, such as Emulator.NoxPlayer
|
str: Emulator type, such as Emulator.NoxPlayer
|
||||||
"""
|
"""
|
||||||
return EmulatorBase.path_to_type(self.path)
|
return self.emulator.type
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def emulator(self):
|
def emulator(self):
|
||||||
|
|||||||
@@ -56,14 +56,6 @@ def abspath(path):
|
|||||||
|
|
||||||
|
|
||||||
class EmulatorInstance(EmulatorInstanceBase):
|
class EmulatorInstance(EmulatorInstanceBase):
|
||||||
@cached_property
|
|
||||||
def type(self) -> str:
|
|
||||||
"""
|
|
||||||
Returns:
|
|
||||||
str: Emulator type, such as Emulator.NoxPlayer
|
|
||||||
"""
|
|
||||||
return Emulator.path_to_type(self.path)
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def emulator(self):
|
def emulator(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user