def SlotPushbutton_WatchData_CGCS(self): """查看数据""" if self.currentfilepath is not None and self.currentfilepath['type']==1: self.UI.tabWidget.setCurrentIndex(3) infor=FiveFileParser.getcomments(self.currentfilepath['path'],('DataTable','DataBaseDir')) name=infor['DataTable'][0].rstrip('\n') path=infor['DataBaseDir'][0].rstrip('\n') self.Signal_QuerrySQL.emit('cs', path,' select PRESSURE from {} '.format(name)) self.log.info('querry data :{},{}'.format(path,name))
def SlotPushbutton_DeleteTable_CGCS(self): """用与删除当前self.currentfilepath变量对应的表""" if self.currentfilepath is not None: if self.currentfilepath['type'] == 1:#如果是数据表就删除,而且数据库中对应的也删除 infor = FiveFileParser.getcomments(self.currentfilepath['path'], ('DataTable', 'DataBaseDir')) name = infor['DataTable'][0].rstrip('\n') path = infor['DataBaseDir'][0].rstrip('\n') self.Signal_DelSQL.emit( path, ' DROP TABLE {} '.format(name)) os.remove(self.currentfilepath['path']) QtWidgets.QMessageBox.information(self, '提示', '删除成功:' '{}'.format(os.path.split(self.currentfilepath['path'])[1]), QtWidgets.QMessageBox.Yes) self.log.info('delete file: {}'.format(self.currentfilepath['path'])) self.ClearTable_CGCS()
def CheckUsb(self): """检查USB""" path = self.FilesLists[0] usb = FiveFileParser.getcomments(path, ('usb', ))['usb'] if usb != []: #如果存在usb残留则删除记录 FiveFileParser.removeComments(path, ['usb']) FiveFileParser.writeComments(path, ['usb*']) tempusb = 'None' #暂存usb的路径 usbPATH = '/media/pi' #"/media/pi"#树莓派的Usb路径更改处 if os.path.exists(usbPATH): if len(os.listdir(usbPATH)) != 0: for i in os.listdir(usbPATH): if os.path.exists(os.path.join(usbPATH, i)): tempusb = os.path.join(usbPATH, i) self.usb = tempusb break tempusb = self.Savepath if tempusb == 'None' else tempusb FiveFileParser.updateComments(path, {'usb': r'{}'.format(tempusb)})
def SlotPushbutton_ExportData_CGCS(self): """导出数据""" if self.currentfilepath is not None and self.currentfilepath['type']==1: # self.UI.tabWidget.setCurrentIndex(3) #创建文件夹 basepath, exname = os.path.split(self.currentfilepath['path']) filename, suffix = os.path.splitext(exname) if not os.path.exists(os.path.join(self.AnotherSavingDir, filename)):#创建文件夹 os.mkdir(os.path.join(self.AnotherSavingDir, filename)) infor=FiveFileParser.getcomments(self.currentfilepath['path'],('DataTable','DataBaseDir')) name=infor['DataTable'][0].rstrip('\n') path=infor['DataBaseDir'][0].rstrip('\n') self.Signal_QuerrySQL.emit('ex*{}*{}'.format(self.currentfilepath['path'],os.path.join(self.AnotherSavingDir, filename)), path,' select PRESSURE , DISTANCE from {} '.format(name)) self.log.info('export data :{},{}'.format(path,name)) pass