def remove_from_current_menu(self): menu = functions.get_current_menu() if self.launched in menu.get_population(): menu.remove_from_population(self.launched) else: functions.debug_msg("The launched element of the launcher has been\ removed from the current menu by another element!")
def activate_focus(self): self.save_active_records() if self.focus: menu = functions.get_current_menu() for e in menu.get_population(): e.active = False for e in self.exceptions: e.active = True else: for e in self.exceptions: e.active = False
def reac_func_norestart(event): if event.what == constants.LAUNCH_DONE: w,h = varset.get_value("screen_w"), varset.get_value("screen_h") mdm = MetaDataManager() mdm.read_data(fn) mdm.data["screen_w"] = w mdm.data["screen_h"] = h mdm.data["fullscreen"] = varset.get_value("fullscreen") ## print("writing", mdm.data, fn) mdm.write_data(fn) #restart script flags = functions.get_screen().get_flags() if varset.get_value("fullscreen"): flags |= pygame.FULLSCREEN else: flags = 0 pygame.display.set_mode((w,h), flags) functions.get_current_menu()._elements[0].get_oldest_ancester().unblit_and_reblit() button.launched.blit() button.launched.update()
def default_func_after(self): r = self.launched.get_family_rect() ## self.launched.unblit() a = functions.get_current_menu()._elements[0].get_oldest_ancester() a.partial_blit(exception=None, rect=r) ## self.launched.update() import pygame pygame.display.update(r) if self.launching: aa = self.launching.get_oldest_ancester() if aa: aa.blit() aa.update()
def pause_until(self, event_type, **event_args): stay = True clock = pygame.time.Clock() from thorpy.miscgui import functions, constants fps = functions.get_current_menu().fps while stay: clock.tick(fps) for e in pygame.event.get(): if e.type == pygame.constants.QUIT: pygame.font.quit() pygame.quit() exit() elif e.type == event_type: if event_args: for arg in event_args: if hasattr(e, arg): if getattr(e, arg) != event_args[arg]: break else: break else: stay = False else: stay = False
def save_active_records(self): self.active_record = {} menu = functions.get_current_menu() for e in menu.get_population(): self.active_record[e] = e.active
def add_to_current_menu(self): menu = functions.get_current_menu() menu.add_to_population(self.launched)