소스 검색

增加模拟器启动后最小化选项

yEs1do 1 년 전
부모
커밋
334bad7a12
2개의 변경된 파일과 19개의 추가작업 그리고 9개의 파일을 삭제
  1. 16 9
      module/device/platform2/platform_windows.py
  2. 3 0
      tasks/Script/config_device.py

+ 16 - 9
module/device/platform2/platform_windows.py

@@ -315,15 +315,22 @@ class PlatformWindows(PlatformBase, EmulatorManager):
             # All check passed
             # All check passed
             break
             break
 
 
-        if new_window != 0 and new_window != current_window:
-            logger.info(f'Minimize new window: {new_window}')
-            minimize_window(new_window)
-        if current_window:
-            logger.info(f'De-flash current window: {current_window}')
-            flash_window(current_window, flash=False)
-        if new_window:
-            logger.info(f'Flash new window: {new_window}')
-            flash_window(new_window, flash=True)
+        emulator_window_minimize = self.config.script.device.emulator_window_minimize
+        logger.info(f'Minimize new emulator window: {emulator_window_minimize}')
+        if emulator_window_minimize:
+            if new_window != 0 and new_window != current_window:
+                # 如果有新窗口且新窗口不是当前窗口,最小化新窗口
+                logger.info(f'Minimize new window: {new_window}')
+                minimize_window(new_window)
+            if current_window:
+                # 如果有当前窗口,取消当前窗口的闪烁
+                logger.info(f'De-flash current window: {current_window}')
+                flash_window(current_window, flash=False)
+            if new_window:
+                # 如果有新窗口,使新窗口闪烁
+                logger.info(f'Flash new window: {new_window}')
+                flash_window(new_window, flash=True)
+
         logger.info('Emulator start completed')
         logger.info('Emulator start completed')
         return True
         return True
 
 

+ 3 - 0
tasks/Script/config_device.py

@@ -70,6 +70,9 @@ class Device(BaseModel):
     emulatorinfo_path: str = Field(default='',
     emulatorinfo_path: str = Field(default='',
                                    description='emulatorinfo_path_help')
                                    description='emulatorinfo_path_help')
     # 举例, E:\ProgramFiles\MuMuPlayer-12.0\shell\MuMuPlayer.exe
     # 举例, E:\ProgramFiles\MuMuPlayer-12.0\shell\MuMuPlayer.exe
+    # 模拟器启动后最小化
+    emulator_window_minimize: bool = Field(default=False,
+                                             description='emulator_window_minimize_help')