Browse Source

added status bar in Details window

master
Rinaldus 7 years ago
parent
commit
147b7f47dc
Signed by: Rinaldus
GPG Key ID: C34E249005178E87
  1. 9
      mail-notifier.py
  2. 2
      ui/about.ui
  3. 31
      ui/details.ui
  4. 4
      ui_about.py
  5. 13
      ui_details.py

9
mail-notifier.py

@ -18,10 +18,11 @@ from PyQt5 import QtCore, QtGui, QtWidgets @@ -18,10 +18,11 @@ from PyQt5 import QtCore, QtGui, QtWidgets
import os
import socket
import time
from datetime import datetime, date, time
#variables
programTitle = "Mail Notifier"
programVersion = "3.0"
programVersion = "3.0-dev"
settings = QSettings(os.path.expanduser("~")+"/.config/mail-notifier/settings.conf", QSettings.NativeFormat)
def GlobalSettingsExist():
if ((settings.contains("CheckInterval") and settings.value("CheckInterval") != "") and
@ -324,6 +325,7 @@ class Mail(): @@ -324,6 +325,7 @@ class Mail():
return "ERROR"
def mail_check():
details.ui.statusBar.setText(datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")+" - Starting mail check")
mail_count = 0
AllFroms=[]
AllSubjs=[]
@ -370,16 +372,20 @@ def mail_check(): @@ -370,16 +372,20 @@ def mail_check():
painter.end()
# End drawing text on icon
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":
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
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":
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.")
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":
window.trayIcon.setIcon(QIcon(":icons/mailbox_error.png"))
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:
# When mailbox has unread letters
window.trayIcon.setToolTip ("You have "+ str(mail_count)+" unread letters")
@ -417,6 +423,7 @@ def mail_check(): @@ -417,6 +423,7 @@ def mail_check():
#Adjust size of Table
details.ui.tableWidget.resizeColumnsToContents()
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
window.lastCheckCount = mail_count
def notify(message):

2
ui/about.ui

@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
<rect>
<x>200</x>
<y>40</y>
<width>203</width>
<width>261</width>
<height>31</height>
</rect>
</property>

31
ui/details.ui

@ -42,6 +42,37 @@ @@ -42,6 +42,37 @@
</item>
</layout>
</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>
</widget>
<resources>

4
ui_about.py

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
# 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!
@ -31,7 +31,7 @@ class Ui_about(object): @@ -31,7 +31,7 @@ class Ui_about(object):
self.lblLogo.setScaledContents(True)
self.lblLogo.setObjectName("lblLogo")
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))
font = QtGui.QFont()
font.setPointSize(20)

13
ui_details.py

@ -36,6 +36,19 @@ class Ui_Details(object): @@ -36,6 +36,19 @@ class Ui_Details(object):
self.tableWidget.setRowCount(0)
self.horizontalLayout.addWidget(self.tableWidget)
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)
QtCore.QMetaObject.connectSlotsByName(Details)

Loading…
Cancel
Save