def initComboBox(self): """训练模型下拉框初始化, 从设置中读取配置""" conf = util.getConfig(CONFIG_PATH) modelList = conf.options(CONF_MODEL_LIST_NAME) for m in modelList: curModelPath = conf.get(CONF_MODEL_LIST_NAME, m) self.comboBox.addItem(m)
def initData(self): """初始化列表中的数据""" self.modelListView.clear() self.conf = util.getConfig(CONFIG_PATH) modelList = self.conf.options(CONF_MODEL_LIST_NAME) for m in modelList: curModelPath = self.conf.get(CONF_MODEL_LIST_NAME, m) self.modelListView.addItem("{}: '{}'".format(m, curModelPath))
def accept(self): """确认""" modelName = self.modelNameInput.text() conf = util.getConfig(CONFIG_PATH) # print(modelName, self.modelPath) if modelName != None and self.modelPath != None: conf.set(CONF_MODEL_LIST_NAME, modelName, self.modelPath) with open(CONFIG_PATH, 'w') as f: conf.write(f) self.close()
def initData(self): """初始化数据""" self.conf = util.getConfig(CONFIG_PATH) self.picDefaultLoadDir = self.conf.get(DEFAULT_LOAD_DIR, "pic-default-load-dir")