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.QtSql import QSqlDatabase, QSqlTableModel, QSqlQueryModel, QSqlQuery
from db import addFineFilter
import sysparse
import sys
@ -29,7 +29,7 @@ class MainWindow(QMainWindow):
self.w = None
self.cmdCanton = ''
self.initcmd = 'SELECT * FROM jobs as b'
self.initcmd = 'SELECT * FROM jobs as b '
self.customcmd = ''
self.cmd = ''
self.setWindowTitle("DB_Inspector")
@ -131,6 +131,7 @@ class MainWindow(QMainWindow):
self.cmd = self.EditQuery.text()
print(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):
x = self.view.selectionModel().currentIndex().row()
@ -218,23 +219,28 @@ class QueryWindow(QWidget):
self.CShowViews.addItem(item)
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.setText("Apply View")
self.PApplyView.clicked.connect(self.setView)
self.vrLayout = QVBoxLayout()
self.vrLayout.addWidget(self.LFilter)
self.vrLayout.addWidget(self.CFilter)
self.vrLayout.addWidget(self.LShowViews)
self.vrLayout.addWidget(self.CShowViews)
self.vrLayout.addWidget(self.PApplyView)
self.vrLayout.addWidget(self.CShowFineFilters)
self.WvrLayout = QWidget()
self.WvrLayout.setLayout(self.vrLayout)
self.WvrLayout.setMaximumSize(QSize(200,200))
self.hLayout = QHBoxLayout()
self.hLayout.addLayout(self.vLayout)
self.hLayout.addWidget(self.WvrLayout)
@ -244,6 +250,14 @@ class QueryWindow(QWidget):
self.EditQuery.setText(window.customcmd)
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):
item = []