예제 #1
0
 def _run():
     while True:
         ori = _refresh_by_ow()
         if ori is None:
             break
         LOGGING.info('update orientation %s->%s' % (self.current_orientation, ori))
         self.current_orientation = ori
         if is_exiting():
             break
         for cb in self.ow_callback:
             try:
                 cb(ori)
             except:
                 LOGGING.error("cb: %s error" % cb)
                 traceback.print_exc()
예제 #2
0
 def _run():
     while True:
         if ori_method == ORI_METHOD.ADB:
             ori = _refresh_by_adb()
             if self.current_orientation == ori:
                 time.sleep(3)
                 continue
         else:
             ori = _refresh_by_ow()
         if ori is None:
             break
         LOGGING.info('update orientation %s->%s' %
                      (self.current_orientation, ori))
         self.current_orientation = ori
         if is_exiting():
             break
         for cb in self.ow_callback:
             try:
                 cb(ori)
             except:
                 LOGGING.error("cb: %s error" % cb)
                 traceback.print_exc()
예제 #3
0
 def _run(kill_event):
     while not kill_event.is_set():
         if self.ori_method == ORI_METHOD.ADB:
             ori = _refresh_by_adb()
             if self.current_orientation == ori:
                 time.sleep(3)
                 continue
         else:
             ori = _refresh_by_ow()
         if ori is None:
             # 以前ori=None是进程结束,现在屏幕方向不变时会返回None
             continue
         LOGGING.info('update orientation %s->%s' % (self.current_orientation, ori))
         self.current_orientation = ori
         if is_exiting():
             self.teardown()
         for cb in self.ow_callback:
             try:
                 cb(ori)
             except:
                 LOGGING.error("cb: %s error" % cb)
                 traceback.print_exc()