本文整理汇总了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):
#.........这里部分代码省略.........