Compare commits

..

10 Commits

Author SHA1 Message Date
7822c3690b The program didn't work when account didn't exist.
Also fixed crash when the program tried to load incorrect mail headers
2017-11-19 18:35:54 +03:00
b04cb9a6ff Fixed program crash if OS doesn't support baloon notification 2017-11-16 16:25:23 +03:00
66020b44a5 Revert "Moved from external 'notify-send' command to using notify2 library"
This reverts commit 6ccb04632b.
2017-11-16 16:23:25 +03:00
8fbcb94182 Revert "Fixed program crash if OS doesn't support baloon notification"
This reverts commit c025371c1b.
2017-11-16 16:22:58 +03:00
c025371c1b Fixed program crash if OS doesn't support baloon notification 2017-11-16 15:40:12 +03:00
6ccb04632b Moved from external 'notify-send' command to using notify2 library
This probably fixes https://github.com/rinaldus/mail-notifier/issues/6
2017-11-16 13:59:23 +03:00
a49944eab6 Version 3.01 2017-10-10 16:03:29 +03:00
d7378800d0 Some cosmetic improvements in menu and in About window 2017-10-10 14:20:30 +03:00
6b73eb58bc Details window now remembers its size 2017-10-10 14:04:25 +03:00
f4b5be7933 Revert "Disabled open Details window on system tray click"
This bug seems to be fixed by KDE/Qt developers.
This reverts commit 5af9d228b3.
2017-10-09 11:44:05 +03:00
6 changed files with 1955 additions and 1922 deletions

View File

@@ -1,4 +1,4 @@
Copyright (c) 2015-2016, Peter Svirshchevskiy Copyright (c) 2015-2017, Peter Svirshchevskiy
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

View File

@@ -26,6 +26,11 @@ $ chmod +x mail-notifier.py
## Changelog ## Changelog
### Version 3.01 (release date: 10.10.17)
* Added status bar in Details window
* Details window now remembers its size
* Some cosmetic improvements in menu
### Version 3.0 (release date: 26.07.16) ### Version 3.0 (release date: 26.07.16)
* System tray icon displays count of unread mail directly on itself * System tray icon displays count of unread mail directly on itself
* Popup notification behaviour was changed: now popup notification appears only if the number of unread emails has * Popup notification behaviour was changed: now popup notification appears only if the number of unread emails has

View File

@@ -22,7 +22,7 @@ from datetime import datetime, date, time
#variables #variables
programTitle = "Mail Notifier" programTitle = "Mail Notifier"
programVersion = "3.0-dev" programVersion = "3.01-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
@@ -87,6 +87,12 @@ class Window(QDialog):
self.ui.btnSaveAccount.clicked.connect(self.btnSaveAccount_clicked) self.ui.btnSaveAccount.clicked.connect(self.btnSaveAccount_clicked)
self.ui.btnRemoveAccount.clicked.connect(self.btnRemoveAccount_clicked) self.ui.btnRemoveAccount.clicked.connect(self.btnRemoveAccount_clicked)
# Check if account doesn't exist, it creates default one
if (AccountExist() == False):
self.ui.comboAccounts.addItem("Default")
self.ui.comboAccounts.setCurrentText("Default")
# Main timer # Main timer
self.timer = QTimer(self) self.timer = QTimer(self)
self.timer.timeout.connect(mail_check) self.timer.timeout.connect(mail_check)
@@ -95,27 +101,32 @@ class Window(QDialog):
# Menu actions # Menu actions
def createActions(self): def createActions(self):
self.detailsShow = QAction(QIcon(':icons/details.png'),"&Details", self, triggered=self.detailsShow) self.detailsShow = QAction(QIcon(':icons/details.png'),"&Details...", self, triggered=self.detailsShow)
self.aboutShow = QAction(QIcon(':icons/mailbox_empty.png'),"&About", self, triggered=self.aboutShow) self.aboutShow = QAction(QIcon(':icons/mailbox_empty.png'),"&About " + programTitle + "...", self, triggered=self.aboutShow)
self.checkNow = QAction(QIcon(':icons/check_now.png'),"&Check now", self, triggered=mail_check) self.checkNow = QAction(QIcon(':icons/check_now.png'),"&Check now", self, triggered=mail_check)
self.restoreAction = QAction(QIcon(":icons/settings.png"),"&Settings", self, triggered=self.showNormal) self.restoreAction = QAction(QIcon(":icons/settings.png"),"&Settings...", self, triggered=self.showNormal)
self.quitAction = QAction(QIcon(':icons/menu_quit.png'),"&Quit", self, triggered=QApplication.instance().quit) self.quitAction = QAction(QIcon(':icons/menu_quit.png'),"&Quit", self, triggered=QApplication.instance().quit)
# UI functions # UI functions
def createTrayIcon(self): def createTrayIcon(self):
self.trayIconMenu = QMenu(self) self.trayIconMenu = QMenu(self)
self.trayIconMenu.addAction(self.aboutShow) f = self.trayIconMenu.font()
f.setBold(True)
self.detailsShow.setFont(f)
self.trayIconMenu.addAction(self.detailsShow) self.trayIconMenu.addAction(self.detailsShow)
self.trayIconMenu.addSeparator()
self.trayIconMenu.addAction(self.checkNow) self.trayIconMenu.addAction(self.checkNow)
self.trayIconMenu.addAction(self.restoreAction) self.trayIconMenu.addAction(self.restoreAction)
self.trayIconMenu.addAction(self.aboutShow)
self.trayIconMenu.addAction(self.quitAction) self.trayIconMenu.addAction(self.quitAction)
self.trayIcon = QSystemTrayIcon(self) self.trayIcon = QSystemTrayIcon(self)
self.trayIcon.setContextMenu(self.trayIconMenu) self.trayIcon.setContextMenu(self.trayIconMenu)
#self.trayIcon.activated.connect(self.trayIconActivated) self.trayIcon.activated.connect(self.trayIconActivated)
def SettingsRestore(self): def SettingsRestore(self):
if (GlobalSettingsExist() and AccountExist()): if (GlobalSettingsExist() and AccountExist()):
groups = settings.childGroups() groups = settings.childGroups()
self.ui.comboAccounts.clear() # Clear account items before fill them again
for i in range (len(groups)): for i in range (len(groups)):
self.ui.comboAccounts.addItem(groups[i]) self.ui.comboAccounts.addItem(groups[i])
self.ui.comboAccounts.setCurrentText(groups[i]) self.ui.comboAccounts.setCurrentText(groups[i])
@@ -203,6 +214,10 @@ class Window(QDialog):
GroupName = self.ui.comboAccounts.currentText() GroupName = self.ui.comboAccounts.currentText()
self.ui.comboAccounts.removeItem(Index) self.ui.comboAccounts.removeItem(Index)
self.SettingsRemove(GroupName) self.SettingsRemove(GroupName)
# Check if account doesn't exist, it creates default one
if (AccountExist() == False):
self.ui.comboAccounts.addItem("Default")
self.ui.comboAccounts.setCurrentText("Default")
def comboAccounts_changed(self): def comboAccounts_changed(self):
self.ui.lblTestOutput.setText("") self.ui.lblTestOutput.setText("")
@@ -247,7 +262,7 @@ class About(QDialog):
self.ui = Ui_about() self.ui = Ui_about()
self.ui.setupUi(self) self.ui.setupUi(self)
self.setWindowFlags(QtCore.Qt.Tool) self.setWindowFlags(QtCore.Qt.Tool)
self.setFixedSize(483,334) self.setFixedSize(511,334)
self.ui.lblNameVersion.setText(programTitle + " " + programVersion) self.ui.lblNameVersion.setText(programTitle + " " + programVersion)
@@ -269,9 +284,15 @@ class Details(QDialog):
self.ui.setupUi(self) self.ui.setupUi(self)
self.setWindowFlags(QtCore.Qt.Window) self.setWindowFlags(QtCore.Qt.Window)
self.ui.btnRefresh.clicked.connect(self.Refresh_clicked) self.ui.btnRefresh.clicked.connect(self.Refresh_clicked)
if (settings.contains("Details_width") and settings.contains("Details_height")):
width = int(settings.value("Details_width"))
height = int(settings.value("Details_height"))
self.resize(width,height)
def closeEvent(self, event): def closeEvent(self, event):
event.ignore() event.ignore()
settings.setValue("Details_width",self.width())
settings.setValue("Details_height",self.height())
self.hide() self.hide()
def Refresh_clicked(self): def Refresh_clicked(self):
@@ -409,13 +430,17 @@ def mail_check():
details.ui.tableWidget.setRowCount(len(AllFroms)) details.ui.tableWidget.setRowCount(len(AllFroms))
details.ui.tableWidget.setColumnCount(3) details.ui.tableWidget.setColumnCount(3)
#Enter data onto Table #Enter data onto Table
horHeaders = [] try:
for n, key in enumerate(sorted(data.keys())): horHeaders = []
#print(data.keys()) for n, key in enumerate(sorted(data.keys())):
horHeaders.append(key) #print(data.keys())
for m, item in enumerate(data[key]): horHeaders.append(key)
newitem = QtWidgets.QTableWidgetItem(item) for m, item in enumerate(data[key]):
details.ui.tableWidget.setItem(m, n, newitem) newitem = QtWidgets.QTableWidgetItem(item)
details.ui.tableWidget.setItem(m, n, newitem)
except:
print("Unable to load some data")
pass
#Add Header #Add Header
details.ui.tableWidget.setHorizontalHeaderLabels(horHeaders) details.ui.tableWidget.setHorizontalHeaderLabels(horHeaders)
@@ -427,9 +452,12 @@ def mail_check():
# 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):
if settings.value("Notify"): try:
subprocess.Popen(['notify-send', programTitle, message]) if settings.value("Notify"):
return subprocess.Popen(['notify-send', programTitle, message])
return
except:
print(message)

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>483</width> <width>511</width>
<height>334</height> <height>334</height>
</rect> </rect>
</property> </property>
@@ -60,7 +60,7 @@
<rect> <rect>
<x>200</x> <x>200</x>
<y>40</y> <y>40</y>
<width>261</width> <width>291</width>
<height>31</height> <height>31</height>
</rect> </rect>
</property> </property>

View File

@@ -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.6.1.dev1604271126 # Created by: PyQt5 UI code generator 5.8.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@@ -11,7 +11,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_about(object): class Ui_about(object):
def setupUi(self, about): def setupUi(self, about):
about.setObjectName("about") about.setObjectName("about")
about.resize(483, 334) about.resize(511, 334)
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)
@@ -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, 261, 31)) self.lblNameVersion.setGeometry(QtCore.QRect(200, 40, 291, 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)