def emulate_ok_press(element=None, inserters=None): if inserters: for i in inserters: i.K_RETURN_pressed() e = event.Event(constants.THORPY_EVENT, id=constants.EVENT_DONE, el=element) event.post(e) functions.quit_menu_func()
def click(e): if element.get_fus_rect().collidepoint(e.pos): if hasattr(element,"e_ok"): emulate_ok_press(element.e_ok) elif hasattr(element, "e_cancel"): post_cancel(element) functions.quit_menu_func()
def quit_save(self): ev = Event(constants.THORPY_EVENT, name=constants.EVENT_DONE, el=self) post(ev) for (varset, varname), handler in iter(self.handlers.items()): # si varset self.varsets[varset].set_value(varname, handler.get_value()) # sinon si link # sinon si fonction functions.quit_menu_func()
def emulate_cancel_press(element, inserters=None): if inserters: for i in inserters: i.K_RETURN_pressed() post_cancel(element) functions.quit_menu_func()
def click_quit_reaction(self, pygame_event): """Makes the element disappear if click is not colliding it.""" self.click_quit = True (x, y) = pygame_event.pos if not self.collide((x, y), constants.STATE_NORMAL): functions.quit_menu_func()
def click_outside(e): if not box.get_fus_rect().collidepoint(e.pos): functions.quit_menu_func()