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


Python DataBase.countZone方法代码示例

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


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

示例1: Principal

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import countZone [as 别名]
class Principal(QMainWindow):
	def __init__(self):
		QMainWindow.__init__(self)
		self.conn = None
		self.cursor = None
		self.minMoto = 0
		self.maxMoto = 0
		self.minQuad = 0
		self.maxQuad = 0
		self.minCar = 0
		self.maxCar = 0
		self.tmpCountFile = []
		self.countZone = []
		self.mainWindow = Ui_MainWindow()
		self.mainWindow.setupUi(self)
		self.db = DataBase()
		self.db.open('dakar.sqlite')
		
		self.countZones()
		self.countVehicles()
		self.path()
		self.mainTable()
		#self.inputFiles()

		
		self.mainWindow.tblData.resizeRowsToContents()
		self.mainWindow.tblData.setColumnWidth(1, 70)
		self.mainWindow.lblWpt.setAlignment(Qt.AlignHCenter)
		self.mainWindow.lblDz.setAlignment(Qt.AlignHCenter)

		self.ctimer = QTimer()
		self.ctimer.start(10000)
		self.mainWindow.actionCategory.triggered.connect(self.openCategoryWindow)
		self.mainWindow.actionDirectoryPath.triggered.connect(self.searchPath)
		self.mainWindow.actionEditZone.triggered.connect(self.openEditZone)
		self.mainWindow.actionDeleteData.triggered.connect(self.deleteData)

		self.connect(self.ctimer,SIGNAL("timeout()"), self.checkNewFile)
		self.mainWindow.tblGralStatus.cellClicked.connect(self.otherTable)
		self.mainWindow.tblGralStatus.cellChanged.connect(self.saveCell)
		self.connect(self.mainWindow.btnExit,SIGNAL('clicked()'),self.exit)

	def path(self):
		f = open('path.txt')
		path = f.readline()
		self.mainWindow.lblPath.setText("Current Path: " + path)

	def exit(self):
		exit()

	def countZones(self):
		check = self.db.countZone()
		for i in check:
			self.countZone.append(i[0])
	
	def mainTable(self):
		"""Show the main table. Search data from sqlite
		"""
		rows = self.db.get_tables()
		self.mainWindow.tblGralStatus.setRowCount(len(rows))

		for i,table in enumerate(rows):
			for m,data in enumerate(table):
				if m != 0:
					self.mainWindow.tblGralStatus.setItem(i,m - 1,QTableWidgetItem(str(data).decode("utf-8")))
					if str(data) == 'OK':
						color = QColor(133, 222, 84)
					elif str(data) == 'NOK':
						color = QColor(255, 64, 16)
					else:
						color = QColor("white")
					self.mainWindow.tblGralStatus.item(i, m - 1).setBackground(QColor(color))
					self.mainWindow.tblGralStatus.item(i, m - 1).setTextAlignment(Qt.AlignCenter)
		self.mainWindow.tblGralStatus.resizeColumnsToContents()
		self.mainWindow.tblGralStatus.resizeRowsToContents()
		self.mainWindow.tblGralStatus.setColumnWidth(1,100)
		self.mainWindow.tblGralStatus.setColumnWidth(10,308)	
		self.mainWindow.tblGralStatus.setSortingEnabled(True)
		
				

	def openCategoryWindow(self):
		"""Open the windows who´s conteins the parameter of category
		"""
		mainWindow = CategoryParam().exec_()

	def openEditZone(self):
		mainWindow = EditZone().exec_()

	def searchPath(self):
		"""Search the path where are the files .csv
		"""
		dir_ = QFileDialog.getExistingDirectory(None, 'Select a folder:', 'C:\\', QFileDialog.ShowDirsOnly)
		f = open('path.txt','w')
		f.write(dir_)
		f.close()
		self.mainWindow.lblPath.setText("Current Path: " + dir_)
		self.inputFiles()
	
	def inputFiles(self):
#.........这里部分代码省略.........
开发者ID:rbistolfi,项目名称:gps-tracking,代码行数:103,代码来源:run.py


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