def enter(self, query, index=None, alt=False): """ Enter into selected item, unless 'index' is passed Return boolean - True if Ulauncher window should be closed """ if index is not None: if not 0 <= index < len(self.result_widgets): raise IndexError self.select(index) return self.enter(query) if self.selected is not None: result = self.result_widgets[self.selected].result if not alt and result.searchable: query_history.save_query(str(query), result.get_name()) action = result.on_enter( query) if not alt else result.on_alt_enter(query) if not action: return True if isinstance(action, list): action = RenderResultListAction(action) action.run() return not action.keep_app_open() return None
def handle_response(self, response, controller): """ Calls :func:`response.action.run` """ if self.active_controller != controller or self.active_event != response.event: return self._cancel_loading() action = response.action if isinstance(action, list): action = RenderResultListAction(action) action.run() if not action.keep_app_open(): self._hide_window()