implement cancel button to cancel login profedure and continue with the
next entry
This commit is contained in:
30
lib/gui.py
30
lib/gui.py
@@ -9,6 +9,11 @@ import sys
|
||||
import db as db
|
||||
from qsqlmod import SqlQueryModel_editable
|
||||
|
||||
DEBUG = True
|
||||
def log(*s):
|
||||
if DEBUG:
|
||||
print(s)
|
||||
|
||||
DBFILE = "../db/sqlite3.db"
|
||||
|
||||
Cantons = ["AG","ZH","BE","SG","SO"]
|
||||
@@ -22,12 +27,9 @@ class ColorDelegate(QStyledItemDelegate):
|
||||
print("initialice overload init of ColorDelegate")
|
||||
self.main = main
|
||||
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()
|
||||
column = index.column()
|
||||
#flag_viewed = self.main.model.index(index.row(),8).data()
|
||||
#flag_starred = self.main.model.index(index.row(),0).data()
|
||||
flag_viewed = self.main.sel_model.model().index(index.row(),8).data()
|
||||
try:
|
||||
flag_starred = int(self.main.sel_model.model().index(index.row(),0).data())
|
||||
@@ -35,11 +37,10 @@ class ColorDelegate(QStyledItemDelegate):
|
||||
print("probably empty string asign zero")
|
||||
flag_starred = 0
|
||||
|
||||
print("index:",index)
|
||||
print("column ",column)
|
||||
print("data:", flag_starred)
|
||||
#print("index:",index)
|
||||
#print("column ",column)
|
||||
#print("data:", flag_starred)
|
||||
if flag_starred == 1:
|
||||
print("Starred!!!!!")
|
||||
option.backgroundBrush = QtGui.QColor("red")
|
||||
elif flag_viewed != 1:
|
||||
option.backgroundBrush = QtGui.QColor("green")
|
||||
@@ -89,6 +90,7 @@ class Worker(QObject):
|
||||
pw = Signal(str)
|
||||
finished = Signal()
|
||||
dialog_closed = True
|
||||
dialog_rejected = False
|
||||
password = ['empty']
|
||||
|
||||
def run(self):
|
||||
@@ -123,13 +125,6 @@ class MainWindow(QMainWindow):
|
||||
|
||||
editables = {0 : ("UPDATE jobs SET star = '{}' WHERE hash = '{}'",7)}
|
||||
self.model = SqlQueryModel_editable(editables)
|
||||
#self.model.setTable("jobs")
|
||||
#self.model.setEditStrategy(QSqlTableModel.OnFieldChange)
|
||||
#self.model.select()
|
||||
|
||||
#self.proxymodel2 = QSortFilterProxyModel(self)
|
||||
#self.proxymodel2.setSourceModel(self.model)
|
||||
#self.proxymodel2.setTable("jobs")
|
||||
|
||||
self.view = QTableView()
|
||||
self.view.setModel(self.model)
|
||||
@@ -211,12 +206,13 @@ class MainWindow(QMainWindow):
|
||||
w = PWPrompt()
|
||||
w.set_MSG(self.worker.messageContent)
|
||||
ret = w.exec()
|
||||
if ret == QDialog.Rejected:
|
||||
self.worker.dialog_rejected = True
|
||||
log("[gui] qdialog.rejected set to TRUE")
|
||||
self.pw = w.pw
|
||||
self.worker.password = w.pw
|
||||
print("showDialog,self.pw:",self.pw)
|
||||
log("showDialog,self.pw:",self.pw)
|
||||
self.worker.dialog_closed=True
|
||||
if ret == QDialog.Rejected:
|
||||
return 1
|
||||
|
||||
def showQueryWindow(self,checked):
|
||||
if self.w is None:
|
||||
|
||||
Reference in New Issue
Block a user