make tableview responsive to key input

This commit is contained in:
ccppi 2024-08-06 11:45:31 +02:00
parent 100cb75c09
commit 7b6dea99d4
2 changed files with 9 additions and 4 deletions

View File

@ -12,7 +12,7 @@ def initdb(file):
with sqlite3.connect(file) as connection:
print("db connection", connection.total_changes)
cursor = connection.cursor()
cursor.execute("CREATE TABLE jobs (star TEXT,tag INT ,title TEXT, location TEXT, company TEXT,link TEXT,pubdate TEXT,hash INT)")
cursor.execute("CREATE TABLE jobs (star TEXT,tag INT ,title TEXT, location TEXT, company TEXT,link TEXT,pubdate TEXT,hash INT,viewed INT)")
sys.exit()
def rmdb(file,table):
with sqlite3.connect(file) as connection:
@ -93,7 +93,7 @@ def writedb(jobs):
log("Hash already exist")
else:
print("NEW_ENTRY")
cursor.execute("INSERT INTO jobs (star,tag,title,company,location,link,pubdate,hash) VALUES (?,?,?,?,?,?,?,?)",(job.starred,job.tag,job.title,job.company,job.location,job.link,job.date,hash1))
cursor.execute("INSERT INTO jobs (star,tag,title,company,location,link,pubdate,hash) VALUES (?,?,?,?,?,?,?,?,?)",(job.starred,job.tag,job.title,job.company,job.location,job.link,job.date,hash1,0))
def isStillValid(file,skiprows):
rows = [0,0,0]

View File

@ -1,6 +1,6 @@
from PySide6.QtWidgets import QApplication, QWidget, QMainWindow, QTableWidget, QVBoxLayout, QTableWidgetItem, QPushButton, QHBoxLayout, QTableView, QLineEdit, QDialog, QLabel, QTextEdit, QCheckBox, QComboBox, QStyledItemDelegate
from PySide6.QtWebEngineWidgets import QWebEngineView
from PySide6.QtCore import QUrl,Qt,QSortFilterProxyModel, qDebug, QSize,QObject,QThread,Signal,QAbstractTableModel
from PySide6.QtCore import QUrl,Qt,QSortFilterProxyModel, qDebug, QSize,QObject,QThread,Signal,QAbstractTableModel, Slot
from PySide6.QtSql import QSqlDatabase, QSqlTableModel, QSqlQueryModel, QSqlQuery
from PySide6 import QtGui
from db import addFineFilter
@ -100,7 +100,10 @@ class MainWindow(QMainWindow):
self.view.setItemDelegate(delegate)
self.setProxyViewSettings()
self.view.clicked.connect(self.cell_clicked)
self.view.activated.connect(self.cell_clicked)
self.sel_model = self.view.selectionModel()
self.sel_model.selectionChanged.connect(self.cell_selection_changed)
self.PValidate = QPushButton("links valid")
self.PValidate.clicked.connect(self.runValidation)
@ -126,6 +129,8 @@ class MainWindow(QMainWindow):
self.view.setColumnWidth(5,10)
self.view.hideColumn(7)
self.view.setSortingEnabled(True)
self.sel_model = self.view.selectionModel()
self.sel_model.selectionChanged.connect(self.cell_clicked)
def runWorker(self):
self.thread = QThread()