本文整理汇总了Python中database.DataBase.get_category方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.get_category方法的具体用法?Python DataBase.get_category怎么用?Python DataBase.get_category使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database.DataBase
的用法示例。
在下文中一共展示了DataBase.get_category方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CategoryParam
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import get_category [as 别名]
class CategoryParam(QDialog):
def __init__(self, parent=None):
QDialog.__init__(self)
self.categoryParam = Ui_CatParam()
self.categoryParam.setupUi(self)
self.showParam()
self.connect(self.categoryParam.btnSet,SIGNAL('clicked()'),self.setParam)
self.connect(self.categoryParam.btnDefault,SIGNAL('clicked()'),self.setDefault)
def setDefault(self):
conn = sqlite3.connect('dakar.sqlite')
cursor = conn.cursor()
query = "UPDATE category set minRange ='0' ,maxRange ='50' where id = 1"
cursor.execute(query)
query = "UPDATE category set minRange ='51' ,maxRange ='99' where id = 2"
cursor.execute(query)
query = "UPDATE category set minRange ='100' ,maxRange ='200' where id = 3"
cursor.execute(query)
conn.commit()
self.showParam()
def setParam(self):
conn = sqlite3.connect('dakar.sqlite')
cursor = conn.cursor()
minMoto = self.categoryParam.lnMinMoto.text()
maxMoto = self.categoryParam.lnMaxMoto.text()
minQuad = self.categoryParam.lnMinQuad.text()
maxQuad = self.categoryParam.lnMaxQuad.text()
minCar = self.categoryParam.lnMinCar.text()
maxCar = self.categoryParam.lnMaxCar.text()
query = "UPDATE category set minRange ='%i' ,maxRange ='%i' where id = 1"%(int(minMoto),int(maxMoto))
cursor.execute(query)
query = "UPDATE category set minRange ='%i' ,maxRange ='%i' where id = 2"%(int(minQuad),int(maxQuad))
cursor.execute(query)
query = "UPDATE category set minRange ='%i' ,maxRange ='%i' where id = 3"%(int(minCar),int(maxCar))
cursor.execute(query)
conn.commit()
self.showParam()
def showParam(self):
self.db = DataBase()
self.db.open('dakar.sqlite')
rows = self.db.get_category()
self.categoryParam.lnMinMoto.setText(str(rows[0][2]))
self.categoryParam.lnMaxMoto.setText(str(rows[0][3]))
self.categoryParam.lnMinQuad.setText(str(rows[1][2]))
self.categoryParam.lnMaxQuad.setText(str(rows[1][3]))
self.categoryParam.lnMinCar.setText(str(rows[2][2]))
self.categoryParam.lnMaxCar.setText(str(rows[2][3]))
示例2: Principal
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import get_category [as 别名]
#.........这里部分代码省略.........
dzDismiss = allData[15].split(";")
for i,dzValue in enumerate(dzDismiss):
if i !=0:
self.db.insertDz(int(numCompetitor),dzValue)
codNum = int(allData[5].split(";")[1])
version = "2.0"
gpsNumber = allData[3].split(";")[1]
obs = " "
self.db.insertData(int(numCompetitor),nameCompetitor,category,wpt,dz,disc,codNum,version,gpsNumber,obs)
for line in allData:
try:
if findWord:
tmpnum = line.split(";")[3]
num = tmpnum.split(":")[1]
zonePassed.append(int(num))
if line.startswith('InfosChronos') :
findWord = True
except:
pass
zoneDismiss = list(set(self.countZone) - set(zonePassed))
for a in zoneDismiss:
self.db.insertZoneDismiss(numCompetitor,a)
#except:
#pass
self.countVehicles()
self.mainTable()
def countVehicles(self):
"""Count how many different vehicle exist and count each of them, then show it on
a text area
"""
rows = self.db.get_category()
self.minMoto = rows[0][2]
self.maxMoto = rows[0][3]
self.minQuad = rows[1][2]
self.maxQuad = rows[1][3]
self.minCar = rows[2][2]
self.maxCar = rows[2][3]
countMoto = 0
countQuad = 0
countCar = 0
rows = self.db.get_tables()
for row in rows:
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()