def drag_button_to_template(self, button, btn_index=-1, template=None, tmpl_index=-1, threshold=0.7, duration=0.1, cache=False): template, tmpl_index = utils.split_to_name_and_index(template, tmpl_index) template_pos = self.templates[template].find_template(tmpl_index, threshold, cache) if not template_pos.found: #todo: save images and stuff raise RuntimeError("Template {} not found on screen".format(template)) button, btn_index = utils.split_to_name_and_index(button, btn_index) return self.buttons[button].drag_button_to_position(btn_index, template_pos.get_pos(), duration)
def get_value_from_config(self, value, index=None): value, index = utils.split_to_name_and_index(value, index) assert index is not None, "Index must be set" return self.values[value].get_value_from_config(index)
def is_dynamic_button_on_screen(self, button, index=-1): button, index = utils.split_to_name_and_index(button, index) return self.buttons[button].is_dynamic_button_on_screen(index)
def wait_for_dynamic_button(self, button, index=-1, timeout=15, threshold=0.99): button, index = utils.split_to_name_and_index(button, index) return self.buttons[button].wait_for_dynamic_button(index, timeout, threshold)
def is_button_active(self, button, index=-1): button, index = utils.split_to_name_and_index(button, index) return self.buttons[button].is_button_active(index)
def wait_for_activate_and_press(self, button, index=-1, times=1, timeout=15): button, index = utils.split_to_name_and_index(button, index) return self.buttons[button].wait_for_activate_and_press(index, timeout)
def button_should_be_on_state(self, button, index=-1, state="normal"): button, index = utils.split_to_name_and_index(button, index) return self.buttons[button].button_should_be_on_state(index, state)
def wait_for_button_state(self, button, index=-1, state="normal", timeout=15): button, index = utils.split_to_name_and_index(button, index) return self.buttons[button].wait_for_button_state(index, state, timeout)
def press_button(self, button, index=-1, times=1): button, index = utils.split_to_name_and_index(button, index) return self.buttons[button].press_button(index, times)
def get_button_state(self, button, index=-1): button, index = utils.split_to_name_and_index(button, index) return self.buttons[button].get_button_state(index)
def is_template_in_zone(self, template, index=-1, threshold=None, cache=False, zone=None): template, index = utils.split_to_name_and_index(template, index) if zone is not None: zone, zindex = utils.split_to_name_and_index(zone, None) zone = self.zones[zone].get_area(zindex) if zone is not None else None return self.templates[template].match_template_in_zone(index, threshold, cache, zone)
def get_templates_count(self, template, index=-1, threshold=None, cache=False, zone=None, window=None, wind_index=-1): template, index = utils.split_to_name_and_index(template, index) zone = self.zones[zone].get_area() if zone is not None else None return self.templates[template].get_templates_count(index, threshold, cache, zone)
def template_should_not_be_on_screen(self, template, index=1, threshold=None, cache=False, zone=None): template, index = utils.split_to_name_and_index(template, index) zone = self.zones[zone].get_area() if zone is not None else None return self.templates[template].template_should_not_be_on_screen(index, threshold, cache, zone)
def wait_for_template_to_stop(self, template, index=-1, threshold=None, timeout=15, move_threshold=0.99, step=0.1): template, index = utils.split_to_name_and_index(template, index) return self.templates[template].wait_for_template_to_stop(index, threshold, timeout, move_threshold, step)
def wait_for_template_to_hide(self, template, index=-1, threshold=None, timeout=15, zone=None): template, index = utils.split_to_name_and_index(template, index) zone = self.zones[zone].get_area() if zone is not None else None return self.templates[template].wait_for_template_to_hide(index, threshold, timeout, zone)