فهرست منبع

Merge pull request #1229 from BluettDream/dev_platform

Platform
huangrunheng 1 سال پیش
والد
کامیت
9f4aebf13d
2فایلهای تغییر یافته به همراه10 افزوده شده و 3 حذف شده
  1. 7 0
      module/base/timer.py
  2. 3 3
      module/device/platform2/platform_windows.py

+ 7 - 0
module/base/timer.py

@@ -159,6 +159,13 @@ class Timer:
         from module.logger import logger
         from module.logger import logger
         logger.info(str(self))
         logger.info(str(self))
 
 
+    def remain(self):
+        """
+        remain time
+        :return:
+        """
+        return self._current + self.limit - time.time()
+
     def __str__(self):
     def __str__(self):
         return f'Timer(limit={round(self.current(), 3)}/{self.limit}, count={self._reach_count}/{self.count})'
         return f'Timer(limit={round(self.current(), 3)}/{self.limit}, count={self._reach_count}/{self.count})'
 
 

+ 3 - 3
module/device/platform2/platform_windows.py

@@ -342,7 +342,7 @@ class PlatformWindows(PlatformBase, EmulatorManager):
                 else:
                 else:
                     new_window = 0
                     new_window = 0
             try:
             try:
-                logger.info('Try to connect emulator, please waiting......')
+                logger.info(f'Try to connect emulator, remain[{timeout.remain():.1f}s]')
                 # Check device connection
                 # Check device connection
                 devices = self.list_device().select(serial=serial)
                 devices = self.list_device().select(serial=serial)
                 # logger.info(devices)
                 # logger.info(devices)
@@ -417,7 +417,7 @@ class PlatformWindows(PlatformBase, EmulatorManager):
 
 
     def emulator_start(self):
     def emulator_start(self):
         logger.hr('Emulator start', level=1)
         logger.hr('Emulator start', level=1)
-        for _ in range(3):
+        for i in range(3):
             # Stop
             # Stop
             if not self._emulator_function_wrapper(self._emulator_stop):
             if not self._emulator_function_wrapper(self._emulator_stop):
                 return False
                 return False
@@ -426,7 +426,7 @@ class PlatformWindows(PlatformBase, EmulatorManager):
                 # Success
                 # Success
                 if self.emulator_start_watch():
                 if self.emulator_start_watch():
                     return True
                     return True
-                # Failed to connect or start, try again
+                logger.attr(2 - i, f'Failed to connect or start, try again')
                 continue
                 continue
             else:
             else:
                 # Failed to start, stop and start again
                 # Failed to start, stop and start again