def manage_projectors(self, control, minutes): inactivity_time = self.get_minutes( self.cast_time_to_timedelta( control.inactivity_time ) ) logger.debug("Projector inactivity time = %s\ndiff time = %s\nis_projectors_on = %s" % (inactivity_time, minutes, self.projectors_on)) if minutes > inactivity_time and self.projectors_on: logger.info("Turning Projectors Off") self.turn_projectors_power(0)
def bring_window_to_front(toApp=False): ''' Bring the WallManager window to the front''' from mtmenu import self_hwnd hwnd = None w = WindowMgr() if toApp: for i in range(MAX_ATTEMPTS): # loop for the open windows on the desktop for handler, name in w.getWindows(): logger.debug("Window opened with name %s" % name) if handler != self_hwnd and name not in NATIVE_APP_NAMES: hwnd = handler logger.info('Changing context to handler %d with name %s' % (handler, name)) break if hwnd != None: break sleep(SLEEP_SECONDS_BETWEEN_ATTEMPTS) logger.debug("Got handler %d" % hwnd) if hwnd == None: hwnd = self_hwnd else: hwnd = self_hwnd logger.info("Going back to the main application") for handler, name in w.getWindows(): logger.debug("Window opened with name %s" % name) if handler != self_hwnd and name not in NATIVE_APP_NAMES: tid, pid = win32process.GetWindowThreadProcessId(handler) if PRODUCTION: Popen("taskkill /F /T /PID %i" % pid, shell=True) logger.debug('killing %s with PID %d' % (name, pid)) w.set_foreground(hwnd)
def bring_window_to_front(toApp = False): ''' Bring the WallManager window to the front''' from mtmenu import self_hwnd hwnd = None w = WindowMgr() if toApp: for i in range(MAX_ATTEMPTS): # loop for the open windows on the desktop for handler, name in w.getWindows(): logger.debug("Window opened with name %s" % name) if handler != self_hwnd and name not in NATIVE_APP_NAMES: hwnd = handler logger.info('Changing context to handler %d with name %s' % (handler, name)) break if hwnd != None: break sleep(SLEEP_SECONDS_BETWEEN_ATTEMPTS) logger.debug("Got handler %d" % hwnd) if hwnd == None: hwnd = self_hwnd else: hwnd = self_hwnd logger.info("Going back to the main application") for handler, name in w.getWindows(): logger.debug("Window opened with name %s" % name) if handler != self_hwnd and name not in NATIVE_APP_NAMES: tid, pid = win32process.GetWindowThreadProcessId(handler) if PRODUCTION: Popen("taskkill /F /T /PID %i" % pid, shell=True) logger.debug('killing %s with PID %d' % (name, pid)) w.set_foreground(hwnd)
def on_gesture(self, gesture, touch): logger.debug("PROJECTORS STATE: %d" % self.activity_checker.projectors_on) if not self.activity_checker.projectors_on: logger.info('Turning Projectors On') self.activity_checker.turn_projectors_power(1) self.activity_checker.set_last_activity() logger.debug('gesture: %d' % self.counter) self.counter += 1 #print self.gestures.gesture_to_str(gesture) # gesture recognition if self.gestures.find(gesture, GESTURE_ACCEPTANCE_MARGIN) and is_app_running(): logger.debug("gesture recognized") kill_app_running()