示例#1
0
 def SlotPushbutton_UseThisPara(self):
     """设置使用该参数列表"""
     if self.tableinfor_2Save!=self.tableinfor_2:#保存修改后的参数
         if self.currentfilepath is not None and self.currentfilepath['type'] == 0:
             FiveFileParser.updataTable(dict(self.tableinfor_2Save), 'MUBAN',
                                        self.currentfilepath['path'])
     self.Signal_UpdataParas.emit(dict(self.tableinfor_2Save))
     #创建数据表(包含参数,用一个data来存数据在数据库中的位置)
     #当前参数表对应的名字,不要后缀
     name="D"+os.path.split(self.currentfilepath['path'])[1].rstrip('.txt')+"时间"+time.strftime('%Y%m%d%M',time.localtime())
     #检测当前名字是否合适
     while os.path.exists("".join([os.path.join(self.AnotherSavingDir,name),'.d'])):
         name+='cp'
     #数据表路径
     path=os.path.join(self.AnotherSavingDir,''.join([name,'.d']))#数据表后缀变为‘.d’
     FiveFileParser.createTable(path)
     FiveFileParser.insertTable(dict(self.tableinfor_2Save), '参数',path,0)
     FiveFileParser.writeComments(path,'\nDataBaseDir*{}\nDataTable*{}'.format(self.AnotherSavingDir,name))
     QtWidgets.QMessageBox.information(self, '提示', '参数选择成功:'
                                       '数据表为:{}\n立即搜集数据'.format(name),
                                       QtWidgets.QMessageBox.Yes)
     self.Signal_SaveDirChanged_ForDB.emit(self.AnotherSavingDir,name)
     self.Signal_UseThisParaTable.emit(name)
     self.Siganl_ManagerWidget.emit('ShuJuBiao',''.join(name))
     self.log.info('Create DataTable:  {}.d'.format(name))
示例#2
0
 def SlotPushbutton_Save_TJCS(self):
     """保存参数处保存按钮"""
     file=self.tableinfor[self.tableinfor.keys()[0]]#文件名
     path=os.path.join(self.ParasDir,file)
     while os.path.exists("".join([path,'.txt'])):
         path="".join([path,'_backup'])
     temp = copy.deepcopy(self.tableinfor)
     temp.popitem(False)#
     temp=dict(temp)
     FiveFileParser.createTable("".join([path,'.txt']))
     FiveFileParser.insertTable(temp,'MUBAN',"".join([path,'.txt']),0)
     QtWidgets.QMessageBox.information(self,'提示','保存为:\n'
             '{}'.format("".join([path,'.txt'])),QtWidgets.QMessageBox.Yes)