当前位置: 首页>>代码示例>>Python>>正文


Python DataBase.updateData方法代码示例

本文整理汇总了Python中database.DataBase.updateData方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.updateData方法的具体用法?Python DataBase.updateData怎么用?Python DataBase.updateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在database.DataBase的用法示例。


在下文中一共展示了DataBase.updateData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Principal

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import updateData [as 别名]

#.........这里部分代码省略.........
			if row[1] >= self.minMoto and row[1] <= self.maxMoto:
				countMoto += 1
			elif row[1] >= self.minQuad and row[1] <= self.maxQuad:
				countQuad += 1
			elif row[1] >= self.minCar and row[1] <= self.maxCar:
				countCar += 1
		self.mainWindow.lnCountMoto.setText(str(countMoto))
		self.mainWindow.lnCountQuad.setText(str(countQuad))
		self.mainWindow.lnCountCar.setText(str(countCar))
	def checkNewFile(self):
		"""Check if exist a new and diferent on the folder, if exist a new one then call to inputFiles
		"""
		f = open('path.txt')
		path = f.readline()
		allFiles = glob.glob(path + "/*.csv")
		#if len(allFiles) > len(self.tmpCountFile):
			#self.mainWindow.lblUpdate.setText("Hay nuevos archivos")
			#self.inputFiles()
		# else:
		# 	self.mainWindow.lblUpdate.setText(" ")

	def otherTable(self):
		"""This section complete the DR, WPT and Data table from each competitor
		"""
		rowSelected = self.mainWindow.tblGralStatus.currentIndex()
		rowDisc = self.mainWindow.tblGralStatus.item(rowSelected.row(),6)
		numCompetitor = self.mainWindow.tblGralStatus.item(rowSelected.row(),0)
		check = self.db.getDataCompetitor(int(numCompetitor.text()))

		self.mainWindow.tblData.setItem(-1,1,QTableWidgetItem(str(check[1])))
		self.mainWindow.tblData.setItem(0,1,QTableWidgetItem(str(check[10])))
		self.mainWindow.tblData.setItem(1,1,QTableWidgetItem(str(check[2]).decode("utf-8")))

		check = self.db.getDzCompetitor(int(numCompetitor.text()))
		

		if len(check) == 0:
			self.mainWindow.lstDzStatus.clear()
			self.mainWindow.lstDz.clear()
			self.mainWindow.lstDzStatus.addItem(QListWidgetItem("OK"))
			self.mainWindow.lstDzStatus.item(0).setBackground(QColor(133, 222, 84))
			self.mainWindow.lstDzStatus.item(0).setTextAlignment(Qt.AlignHCenter)
		else:
			self.mainWindow.lstDzStatus.clear()
			self.mainWindow.lstDz.clear()
			self.mainWindow.lstDzStatus.addItem(QListWidgetItem("NOK"))
			self.mainWindow.lstDzStatus.item(0).setBackground(QColor(255, 64, 16))
			self.mainWindow.lstDzStatus.item(0).setTextAlignment(Qt.AlignHCenter)
			self.mainWindow.lblWpt.setAlignment(Qt.AlignHCenter)
			for m,data in enumerate(check):
				self.mainWindow.lstDz.addItem(QListWidgetItem("%s"%str(data[0])))

		check = self.db.getZoneDismiss(int(numCompetitor.text()))
			
		
		if len(check) == 0:
			self.mainWindow.lstWptStatus.clear()
			self.mainWindow.lstWpt.clear()
			self.mainWindow.lstWptStatus.addItem(QListWidgetItem("OK"))
			self.mainWindow.lstWptStatus.item(0).setBackground(QColor(133, 222, 84))
			self.mainWindow.lstWptStatus.item(0).setTextAlignment(Qt.AlignHCenter)
		else:
			self.mainWindow.lstWpt.clear()
			self.mainWindow.lstWptStatus.clear()
			self.mainWindow.lstWptStatus.addItem(QListWidgetItem("NOK"))
			self.mainWindow.lstWptStatus.item(0).setBackground(QColor(255, 64, 16))
			self.mainWindow.lstWptStatus.item(0).setTextAlignment(Qt.AlignHCenter)
			for m,data in enumerate(check):
				self.mainWindow.lstWpt.addItem(QListWidgetItem("%s"%str(data[0])))
				self.mainWindow.lstWpt.item(m).setTextAlignment(Qt.AlignHCenter)


		self.mainWindow.lstDiscStatus.clear()
		if rowDisc.text() == 'OK':
			color = QColor(133, 222, 84)
		else:
			color = QColor(255, 64, 16)

		self.mainWindow.lstDiscStatus.addItem(QListWidgetItem(rowDisc.text()))
		self.mainWindow.lstDiscStatus.item(0).setBackground(color)
		self.mainWindow.lstDiscStatus.item(0).setTextAlignment(Qt.AlignHCenter)

	def deleteData(self):
		"""Delete al data"""
		self.tmpCountFile = []
		self.db.deleteData()
		self.countVehicles()
		self.mainTable()
		
	def saveCell(self, row, column):
		"""This is for save when put the name or any observation on the main table
		then will be saved into the BD"""
		if column == 1:
			name = self.mainWindow.tblGralStatus.item(row,column).text()
			idCompetitor = self.mainWindow.tblGralStatus.item(row,0).text()
		 	self.db.updateData("nombre",idCompetitor, name)
		elif column == 10:
			obs = self.mainWindow.tblGralStatus.item(row,column).text()
			idCompetitor = self.mainWindow.tblGralStatus.item(row,0).text()
			self.db.updateData("obs",idCompetitor, obs)
开发者ID:rbistolfi,项目名称:gps-tracking,代码行数:104,代码来源:run.py


注:本文中的database.DataBase.updateData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。