def set_mode(mode, config): configurator = Configurator(config) config = configurator.from_yaml() if mode not in AVAILABLE_MODES: return 'Wrong mode name' config['mode'] = mode configurator.dump_yaml(config) return 'I change mode to ' + mode
class BuffScreen(Screen): # another option for future buttons = ['Buff', 'Logout', 'Spawn', 'Back'] def __init__(self, message, bot): super().__init__(message, bot) self.title = 'Buffer menu:' self.load_config() # Try to move this method do Screen class def load_config(self): self.configfile = Configurator(self.config['buffer']) self.config = self.configfile.from_yaml() def back(self, call, state): screen = 'StartScreen' ss = state[screen] ss.render(call=call) return 'StartScreen', ss def buff(self, call, state): self.config['refresh'] = True self.config['logout'] = True self.config['spawn'] = False self.configfile.dump_yaml(self.config) return self.run_action(call) def logout(self, call, state): self.config['spawn'] = True self.config['logout'] = True self.configfile.dump_yaml(self.config) return self.run_action(call) def spawn(self, call, state): self.config['spawn'] = True self.config['logout'] = False self.configfile.dump_yaml(self.config) return self.run_action(call) def run_action(self, call): self.bot.answer_callback_query(call.id, 'Start ' + call.data) Buffer(self.config).process() return self.name, self
def set_combination_mode(mode, config): configurator = Configurator(config['enhancer']) config = configurator.from_yaml() config['combination']['mode'] = mode configurator.dump_yaml(config)
def set_logout(config): configurator = Configurator(config['buffer']) config = configurator.from_yaml() config['spawn'] = True config['logout'] = True configurator.dump_yaml(config)
def set_buff(params, config): configurator = Configurator(config['buffer']) config = configurator.from_yaml() config['refresh'] = True config['spawn'] = False configurator.dump_yaml(config)
def set_enhance_mode(mode, config): configurator = Configurator(config['enhancer']) config = configurator.from_yaml() config['mode'] = mode configurator.dump_yaml(config)
def set_cycles(params, config): configurator = Configurator(config['enhancer']) config = configurator.from_yaml() config['enhancement']['cycles'] = params configurator.dump_yaml(config)
def set_cube(params, config): configurator = Configurator(config['enhancer']) config = configurator.from_yaml() config['enhancement']['cube'] = [params[0], params[1]] configurator.dump_yaml(config)