working table
This commit is contained in:
parent
ee0cb9b7de
commit
ee2d66c8c8
|
@ -266,11 +266,62 @@ class Details(QDialog):
|
||||||
|
|
||||||
self.ui = Ui_Details()
|
self.ui = Ui_Details()
|
||||||
self.ui.setupUi(self)
|
self.ui.setupUi(self)
|
||||||
|
self.ui.btnRefresh.clicked.connect(self.Refresh_clicked)
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
event.ignore()
|
event.ignore()
|
||||||
self.hide()
|
self.hide()
|
||||||
|
|
||||||
|
def Refresh_clicked(self):
|
||||||
|
mail_count = 0
|
||||||
|
AllFroms=[]
|
||||||
|
AllSubjs=[]
|
||||||
|
AllDates=[]
|
||||||
|
if (GlobalSettingsExist() and AccountExist()):
|
||||||
|
m = Mail()
|
||||||
|
groups = settings.childGroups()
|
||||||
|
for i in range (len(groups)):
|
||||||
|
settings.beginGroup(groups[i])
|
||||||
|
group = groups[i]
|
||||||
|
user = settings.value("Login")
|
||||||
|
password = settings.value("Password")
|
||||||
|
mailserver = settings.value("MailServer")
|
||||||
|
port = settings.value("Port")
|
||||||
|
ssl = settings.value("SSL")
|
||||||
|
settings.endGroup()
|
||||||
|
if m.login(mailserver,port,user,password,ssl):
|
||||||
|
if (mail_count == "ERROR" or m.checkMail() == "ERROR"):
|
||||||
|
mail_count = "ERROR"
|
||||||
|
else:
|
||||||
|
mail_count += m.checkMail()
|
||||||
|
AllFroms.extend(m.parseMail("From"))
|
||||||
|
AllSubjs.extend(m.parseMail("Subject"))
|
||||||
|
AllDates.extend(m.parseMail("Date"))
|
||||||
|
else:
|
||||||
|
mail_count = "CONNECTION_ERROR"
|
||||||
|
else:
|
||||||
|
mail_count = "CONFIGURATION_ERROR"
|
||||||
|
|
||||||
|
data = {"From":AllFroms,
|
||||||
|
"Subject":AllSubjs,
|
||||||
|
"Date":AllDates,}
|
||||||
|
self.ui.tableWidget.setRowCount(len(AllFroms))
|
||||||
|
self.ui.tableWidget.setColumnCount(3)
|
||||||
|
#Enter data onto Table
|
||||||
|
horHeaders = []
|
||||||
|
for n, key in enumerate(sorted(data.keys())):
|
||||||
|
#print(data.keys())
|
||||||
|
horHeaders.append(key)
|
||||||
|
for m, item in enumerate(data[key]):
|
||||||
|
newitem = QtWidgets.QTableWidgetItem(item)
|
||||||
|
self.ui.tableWidget.setItem(m, n, newitem)
|
||||||
|
|
||||||
|
#Add Header
|
||||||
|
self.ui.tableWidget.setHorizontalHeaderLabels(horHeaders)
|
||||||
|
|
||||||
|
#Adjust size of Table
|
||||||
|
self.ui.tableWidget.resizeColumnsToContents()
|
||||||
|
self.ui.tableWidget.resizeRowsToContents()
|
||||||
|
|
||||||
# Common functions
|
# Common functions
|
||||||
|
|
||||||
|
@ -338,9 +389,6 @@ def mail_check():
|
||||||
mail_count = "ERROR"
|
mail_count = "ERROR"
|
||||||
else:
|
else:
|
||||||
mail_count += m.checkMail()
|
mail_count += m.checkMail()
|
||||||
print("FROM:",m.parseMail("From"))
|
|
||||||
print("SUBJECT:",m.parseMail("Subject"))
|
|
||||||
print("DATE:",m.parseMail("Date"))
|
|
||||||
else:
|
else:
|
||||||
mail_count = "CONNECTION_ERROR"
|
mail_count = "CONNECTION_ERROR"
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>730</width>
|
<width>1048</width>
|
||||||
<height>467</height>
|
<height>619</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="btnRefresh">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
|
|
@ -11,23 +11,23 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
class Ui_Details(object):
|
class Ui_Details(object):
|
||||||
def setupUi(self, Details):
|
def setupUi(self, Details):
|
||||||
Details.setObjectName("Details")
|
Details.setObjectName("Details")
|
||||||
Details.resize(730, 467)
|
Details.resize(1048, 619)
|
||||||
icon = QtGui.QIcon()
|
icon = QtGui.QIcon()
|
||||||
icon.addPixmap(QtGui.QPixmap(":/icons/mailbox_empty.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon.addPixmap(QtGui.QPixmap(":/icons/mailbox_empty.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
Details.setWindowIcon(icon)
|
Details.setWindowIcon(icon)
|
||||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Details)
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Details)
|
||||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
self.pushButton = QtWidgets.QPushButton(Details)
|
self.btnRefresh = QtWidgets.QPushButton(Details)
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.btnRefresh.sizePolicy().hasHeightForWidth())
|
||||||
self.pushButton.setSizePolicy(sizePolicy)
|
self.btnRefresh.setSizePolicy(sizePolicy)
|
||||||
icon1 = QtGui.QIcon()
|
icon1 = QtGui.QIcon()
|
||||||
icon1.addPixmap(QtGui.QPixmap(":/icons/check_now.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon1.addPixmap(QtGui.QPixmap(":/icons/check_now.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
self.pushButton.setIcon(icon1)
|
self.btnRefresh.setIcon(icon1)
|
||||||
self.pushButton.setObjectName("pushButton")
|
self.btnRefresh.setObjectName("btnRefresh")
|
||||||
self.verticalLayout_2.addWidget(self.pushButton)
|
self.verticalLayout_2.addWidget(self.btnRefresh)
|
||||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
self.tableWidget = QtWidgets.QTableWidget(Details)
|
self.tableWidget = QtWidgets.QTableWidget(Details)
|
||||||
|
@ -43,6 +43,6 @@ class Ui_Details(object):
|
||||||
def retranslateUi(self, Details):
|
def retranslateUi(self, Details):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
Details.setWindowTitle(_translate("Details", "Mail Notifier"))
|
Details.setWindowTitle(_translate("Details", "Mail Notifier"))
|
||||||
self.pushButton.setText(_translate("Details", "Refresh"))
|
self.btnRefresh.setText(_translate("Details", "Refresh"))
|
||||||
|
|
||||||
import resources_rc
|
import resources_rc
|
||||||
|
|
Loading…
Reference in New Issue