add history to db for finefilters

This commit is contained in:
ccppi 2024-06-18 10:25:24 +02:00
parent 5644c43a61
commit 6b00dac638

View File

@ -3,7 +3,7 @@ from PySide6.QtWebEngineWidgets import QWebEngineView
from PySide6.QtCore import QUrl,Qt,QSortFilterProxyModel, qDebug, QSize,QObject,QThread,Signal from PySide6.QtCore import QUrl,Qt,QSortFilterProxyModel, qDebug, QSize,QObject,QThread,Signal
from PySide6.QtSql import QSqlDatabase, QSqlTableModel, QSqlQueryModel, QSqlQuery from PySide6.QtSql import QSqlDatabase, QSqlTableModel, QSqlQueryModel, QSqlQuery
from db import addFineFilter
import sysparse import sysparse
import sys import sys
@ -131,6 +131,7 @@ class MainWindow(QMainWindow):
self.cmd = self.EditQuery.text() self.cmd = self.EditQuery.text()
print(self.initcmd + self.cmdCanton +self.customcmd + self.cmd) print(self.initcmd + self.cmdCanton +self.customcmd + self.cmd)
self.customSQL(self.initcmd+ self.cmdCanton + self.customcmd + self.cmd) self.customSQL(self.initcmd+ self.cmdCanton + self.customcmd + self.cmd)
addFineFilter("../db/sqlite3.db","filters",self.customcmd + self.cmd)
def cell_clicked(self): def cell_clicked(self):
x = self.view.selectionModel().currentIndex().row() x = self.view.selectionModel().currentIndex().row()
@ -218,23 +219,28 @@ class QueryWindow(QWidget):
self.CShowViews.addItem(item) self.CShowViews.addItem(item)
self.CShowViews.currentTextChanged.connect(self.setView) self.CShowViews.currentTextChanged.connect(self.setView)
self.CShowFineFilters = QComboBox()
FineFilterItems = self.getFineFilters()
for item in FineFilterItems:
self.CShowFineFilters.addItem(item)
self.CShowFineFilters.currentTextChanged.connect(window.EditQuery.setText)
self.PApplyView = QCheckBox() self.PApplyView = QCheckBox()
self.PApplyView.setText("Apply View") self.PApplyView.setText("Apply View")
self.PApplyView.clicked.connect(self.setView) self.PApplyView.clicked.connect(self.setView)
self.vrLayout = QVBoxLayout() self.vrLayout = QVBoxLayout()
self.vrLayout.addWidget(self.LFilter) self.vrLayout.addWidget(self.LFilter)
self.vrLayout.addWidget(self.CFilter) self.vrLayout.addWidget(self.CFilter)
self.vrLayout.addWidget(self.LShowViews) self.vrLayout.addWidget(self.LShowViews)
self.vrLayout.addWidget(self.CShowViews) self.vrLayout.addWidget(self.CShowViews)
self.vrLayout.addWidget(self.PApplyView) self.vrLayout.addWidget(self.PApplyView)
self.vrLayout.addWidget(self.CShowFineFilters)
self.WvrLayout = QWidget() self.WvrLayout = QWidget()
self.WvrLayout.setLayout(self.vrLayout) self.WvrLayout.setLayout(self.vrLayout)
self.WvrLayout.setMaximumSize(QSize(200,200)) self.WvrLayout.setMaximumSize(QSize(200,200))
self.hLayout = QHBoxLayout() self.hLayout = QHBoxLayout()
self.hLayout.addLayout(self.vLayout) self.hLayout.addLayout(self.vLayout)
self.hLayout.addWidget(self.WvrLayout) self.hLayout.addWidget(self.WvrLayout)
@ -244,6 +250,14 @@ class QueryWindow(QWidget):
self.EditQuery.setText(window.customcmd) self.EditQuery.setText(window.customcmd)
print("Comboshowview:",self.CShowViews.currentText()) print("Comboshowview:",self.CShowViews.currentText())
def getFineFilters(self):
item = []
statement = f"""Select cmd FROM filters;"""
query = QSqlQuery(statement)
while query.next():
item.append(query.value(0))
return item
def getViews(self): def getViews(self):
item = [] item = []