unfinished

This commit is contained in:
2024-08-06 13:42:58 +02:00
parent 7b6dea99d4
commit 71b27c1452
3 changed files with 60 additions and 21 deletions

View File

@@ -17,27 +17,42 @@ class ColorDelegate(QStyledItemDelegate):
currentRow = 0
starred = 0
def initStyleOption(self,option,index):
#we have to rewrite this because it depends on viewport but it should depend on the model
super().initStyleOption(option,index)
data = index.data()
try:
value = float(data)
except:
pass
#print("error not an integer")
else:
#print("data:",data)
self.currentRow = index.row()
#print("row: ",self.currentRow)
if value == 1:
self.starred = 1
#option.backgroundBrush = QtGui.QColor("green")
else:
self.starred = 0
#option.backgroundBrush = QtGui.QColor("grey")
if self.starred == 1:
option.backgroundBrush = QtGui.QColor("red")
else:
option.backgroundBrush = QtGui.QColor("white")
column = index.column()
print("index:",index)
print("column ",column)
print("data:", self.view.index.data())
#if column == 0:
# try:
# value = float(data)
# except:
# pass
# #print("error not an integer")
# else:
# #self.view.currentRow = index.row()
# #print("row: ",self.currentRow)
# if value == 1:
# self.starred = 1
# else:
# self.starred = 0
# if column == 8:
# try:
# value = float(data)
# except:
# pass
# else:
# if value == 1:
# self.starred = 2
# else:
# self.starred = 0
# if self.starred == 1:
# option.backgroundBrush = QtGui.QColor("red")
# elif self.starred == 2:
# option.backgroundBrush = QtGui.QColor("white")
# else:
# option.backgroundBrush = QtGui.QColor("green")
class ValidationWorker(QObject):
finished = Signal()
@@ -96,14 +111,14 @@ class MainWindow(QMainWindow):
self.view = QTableView()
self.view.setModel(self.model)
delegate = ColorDelegate(self.view)
delegate = ColorDelegate(self)
self.view.setItemDelegate(delegate)
self.setProxyViewSettings()
self.view.activated.connect(self.cell_clicked)
self.sel_model = self.view.selectionModel()
self.sel_model.selectionChanged.connect(self.cell_selection_changed)
self.sel_model.selectionChanged.connect(self.cell_clicked)
self.PValidate = QPushButton("links valid")
self.PValidate.clicked.connect(self.runValidation)
@@ -221,6 +236,11 @@ class MainWindow(QMainWindow):
data = self.view.model().index(x,5).data()
print("cell clicked:",x," / ",y, "-->",data)
self.browser.setUrl(QUrl(data))
hash1 = self.view.model().index(x,7).data()
print("hash of selected: ",hash1)
#db.viewedEntry(hash1)
self.view.selectionModel().currentIndex()
self.model.setData({0,8},hash1,role=1001)
def customSQL(self,cmd):
print("Run SQL Query",cmd)