def validate_cmd(value, action_type): if action_type == '1': if not value.isdigit(): return False if len(value) > 1 and value[0] == '0': return False setattr(app.bot_config, attr_name, int(value if value != '' else str(def_value))) write_bot_config(app.bot_config, app.device.serial.replace(':', "_")) return True
def start(self): if self.bot_building_pos is None: self.bot_config.hasBuildingPos = False self.bot_building_pos = {} self.bot.config = self.bot_config self.bot.building_pos = self.bot_building_pos self.bot.text_update_event = self.on_task_update self.bot.building_pos_update_event = lambda **kw: write_building_pos( kw['building_pos'], kw['prefix']) self.bot.config_update_event = lambda **kw: write_bot_config( kw['config'], kw['prefix']) self.bot.start(self.bot.do_task)
def start(self): bot = Bot(self.device) self.bot = bot if self.bot_building_pos is None: self.bot_config.hasBuildingPos = False self.bot_building_pos = {} bot.config = self.bot_config bot.building_pos = self.bot_building_pos bot.text_update_event = self.on_task_update bot.building_pos_update_event = lambda **kw: write_building_pos(kw['building_pos'], kw['prefix']) bot.config_update_event = lambda **kw: write_bot_config(kw['config'], kw['prefix']) self.bot_thread = threading.Thread(target=bot.start) self.bot_thread.start()
def command(value): app.bot_config.breakTime = int(value.replace(' Minute', '')) * 60 write_bot_config(app.bot_config, app.device.serial.replace(':', "_"))