def check_for_choosing_key(self, button, label): if button.state == ButtonState.RELEASED: in_key_choosing = True while in_key_choosing: for event in pygame.event.get(): if event.type != pygame.KEYDOWN: continue if event.key == pygame.locals.K_ESCAPE: in_key_choosing = False break button.set_label(pygame.key.name(KEYBOARD[event.key]), RM.readable_font) in_key_choosing = False # Change key in configuration, too if label == 'Up': CONFIG.KEY_UP = KEYBOARD[event.key] elif label == 'Down': CONFIG.KEY_DOWN = KEYBOARD[event.key] elif label == 'Right': CONFIG.KEY_RIGHT = KEYBOARD[event.key] elif label == 'Left': CONFIG.KEY_LEFT = KEYBOARD[event.key] CONFIG.save() break
def set_printer(vendor, product): """ Set the printer now and forever """ CONFIG['vendor'] = vendor CONFIG['product'] = product CONFIG.save() return redirect(url_for('administration'))
def config(self, **kwargs: Any) -> dict: """CONFIG System""" if kwargs: for key, value in kwargs.items(): key = key.replace("[]", "") key_list = key.split("_") self.__add_val_to_config(key, CONFIG, key_list, value) try: CONFIG.save() except OSError: print("ERROR WRITING Config FILE") config_dict = CONFIG.html_dict() return {"config": config_dict}
def shutdown(): """Shutdown commands""" print("STOPPING WEB SERVICES...", end=" ") Webserver.stop() print("DONE") if Ripper.running: print("STOPPING RIPPER...", end=" ") Ripper.stop() print("DONE") print("STOPPING LIBRARIES...", end=" ") Library.stop() print("DONE") print("SAVING Config FILE...", end=" ") CONFIG.save() print("DONE") print("SHUTDOWN COMPLETED")