added status bar in Details window
This commit is contained in:
parent
aab6cf8490
commit
147b7f47dc
|
@ -18,10 +18,11 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
from datetime import datetime, date, time
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
programTitle = "Mail Notifier"
|
programTitle = "Mail Notifier"
|
||||||
programVersion = "3.0"
|
programVersion = "3.0-dev"
|
||||||
settings = QSettings(os.path.expanduser("~")+"/.config/mail-notifier/settings.conf", QSettings.NativeFormat)
|
settings = QSettings(os.path.expanduser("~")+"/.config/mail-notifier/settings.conf", QSettings.NativeFormat)
|
||||||
def GlobalSettingsExist():
|
def GlobalSettingsExist():
|
||||||
if ((settings.contains("CheckInterval") and settings.value("CheckInterval") != "") and
|
if ((settings.contains("CheckInterval") and settings.value("CheckInterval") != "") and
|
||||||
|
@ -324,6 +325,7 @@ class Mail():
|
||||||
return "ERROR"
|
return "ERROR"
|
||||||
|
|
||||||
def mail_check():
|
def mail_check():
|
||||||
|
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Starting mail check")
|
||||||
mail_count = 0
|
mail_count = 0
|
||||||
AllFroms=[]
|
AllFroms=[]
|
||||||
AllSubjs=[]
|
AllSubjs=[]
|
||||||
|
@ -370,16 +372,20 @@ def mail_check():
|
||||||
painter.end()
|
painter.end()
|
||||||
# End drawing text on icon
|
# End drawing text on icon
|
||||||
window.trayIcon.setIcon(QtGui.QIcon(pixmap))
|
window.trayIcon.setIcon(QtGui.QIcon(pixmap))
|
||||||
|
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Mail check completed. You have no unread letters")
|
||||||
elif mail_count == "ERROR":
|
elif mail_count == "ERROR":
|
||||||
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
|
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
|
||||||
window.trayIcon.setToolTip ("Error checking mail.")
|
window.trayIcon.setToolTip ("Error checking mail.")
|
||||||
|
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Error checking mail")
|
||||||
elif mail_count == "CONNECTION_ERROR":
|
elif mail_count == "CONNECTION_ERROR":
|
||||||
window.trayIcon.setToolTip("Unable to establish connection to mailbox. Check your mail settings and make sure that you have not network problems.")
|
window.trayIcon.setToolTip("Unable to establish connection to mailbox. Check your mail settings and make sure that you have not network problems.")
|
||||||
notify("Unable to establish connection to mailbox. Check your mail settings and make sure that you have not network problems.")
|
notify("Unable to establish connection to mailbox. Check your mail settings and make sure that you have not network problems.")
|
||||||
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
|
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
|
||||||
|
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Unable to establish connection to mailbox. Check your mail settings and make sure that you have not network problems")
|
||||||
elif mail_count == "CONFIGURATION_ERROR":
|
elif mail_count == "CONFIGURATION_ERROR":
|
||||||
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
|
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
|
||||||
window.trayIcon.setToolTip("Cannot find configuration file. You should give access to your mailbox")
|
window.trayIcon.setToolTip("Cannot find configuration file. You should give access to your mailbox")
|
||||||
|
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Cannot find configuration file. You should give access to your mailbox")
|
||||||
else:
|
else:
|
||||||
# When mailbox has unread letters
|
# When mailbox has unread letters
|
||||||
window.trayIcon.setToolTip ("You have "+ str(mail_count)+" unread letters")
|
window.trayIcon.setToolTip ("You have "+ str(mail_count)+" unread letters")
|
||||||
|
@ -417,6 +423,7 @@ def mail_check():
|
||||||
#Adjust size of Table
|
#Adjust size of Table
|
||||||
details.ui.tableWidget.resizeColumnsToContents()
|
details.ui.tableWidget.resizeColumnsToContents()
|
||||||
details.ui.tableWidget.resizeRowsToContents()
|
details.ui.tableWidget.resizeRowsToContents()
|
||||||
|
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Mail check completed. You have "+ str(mail_count) +" unread letters")
|
||||||
# check was successfull, lastCheckCount is updating
|
# check was successfull, lastCheckCount is updating
|
||||||
window.lastCheckCount = mail_count
|
window.lastCheckCount = mail_count
|
||||||
def notify(message):
|
def notify(message):
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>200</x>
|
<x>200</x>
|
||||||
<y>40</y>
|
<y>40</y>
|
||||||
<width>203</width>
|
<width>261</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -42,6 +42,37 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="statusBar">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'ui/about.ui'
|
# Form implementation generated from reading ui file 'ui/about.ui'
|
||||||
#
|
#
|
||||||
# Created by: PyQt5 UI code generator 5.5.1
|
# Created by: PyQt5 UI code generator 5.6.1.dev1604271126
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class Ui_about(object):
|
||||||
self.lblLogo.setScaledContents(True)
|
self.lblLogo.setScaledContents(True)
|
||||||
self.lblLogo.setObjectName("lblLogo")
|
self.lblLogo.setObjectName("lblLogo")
|
||||||
self.lblNameVersion = QtWidgets.QLabel(about)
|
self.lblNameVersion = QtWidgets.QLabel(about)
|
||||||
self.lblNameVersion.setGeometry(QtCore.QRect(200, 40, 203, 31))
|
self.lblNameVersion.setGeometry(QtCore.QRect(200, 40, 261, 31))
|
||||||
self.lblNameVersion.setMinimumSize(QtCore.QSize(203, 0))
|
self.lblNameVersion.setMinimumSize(QtCore.QSize(203, 0))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setPointSize(20)
|
font.setPointSize(20)
|
||||||
|
|
|
@ -36,6 +36,19 @@ class Ui_Details(object):
|
||||||
self.tableWidget.setRowCount(0)
|
self.tableWidget.setRowCount(0)
|
||||||
self.horizontalLayout.addWidget(self.tableWidget)
|
self.horizontalLayout.addWidget(self.tableWidget)
|
||||||
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
||||||
|
self.statusBar = QtWidgets.QLabel(Details)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.statusBar.sizePolicy().hasHeightForWidth())
|
||||||
|
self.statusBar.setSizePolicy(sizePolicy)
|
||||||
|
self.statusBar.setMinimumSize(QtCore.QSize(0, 0))
|
||||||
|
self.statusBar.setBaseSize(QtCore.QSize(0, 0))
|
||||||
|
self.statusBar.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.statusBar.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.statusBar.setText("")
|
||||||
|
self.statusBar.setObjectName("statusBar")
|
||||||
|
self.verticalLayout_2.addWidget(self.statusBar)
|
||||||
|
|
||||||
self.retranslateUi(Details)
|
self.retranslateUi(Details)
|
||||||
QtCore.QMetaObject.connectSlotsByName(Details)
|
QtCore.QMetaObject.connectSlotsByName(Details)
|
||||||
|
|
Loading…
Reference in New Issue