added GUI window for upcoming email details

This commit is contained in:
Rinaldus 2016-07-25 16:15:01 +03:00
parent d5d41dcfef
commit ee0cb9b7de
Signed by: Rinaldus
GPG Key ID: C34E249005178E87
6 changed files with 2786 additions and 1884 deletions

BIN
icons/details.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -13,6 +13,7 @@ import subprocess
import resources_rc
from ui_settings import Ui_Settings
from ui_about import Ui_about
from ui_details import Ui_Details
from PyQt5 import QtCore, QtGui, QtWidgets
import os
import socket
@ -93,6 +94,7 @@ class Window(QDialog):
# Menu actions
def createActions(self):
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.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)
@ -101,12 +103,14 @@ class Window(QDialog):
# UI functions
def createTrayIcon(self):
self.trayIconMenu = QMenu(self)
self.trayIconMenu.addAction(self.detailsShow)
self.trayIconMenu.addAction(self.aboutShow)
self.trayIconMenu.addAction(self.checkNow)
self.trayIconMenu.addAction(self.restoreAction)
self.trayIconMenu.addAction(self.quitAction)
self.trayIcon = QSystemTrayIcon(self)
self.trayIcon.setContextMenu(self.trayIconMenu)
self.trayIcon.activated.connect(self.trayIconActivated)
def SettingsRestore(self):
if (GlobalSettingsExist() and AccountExist()):
@ -214,6 +218,15 @@ class Window(QDialog):
about.hide()
about.show()
about.activateWindow()
def detailsShow(self):
details.show()
details.activateWindow()
def trayIconActivated(self, reason):
if reason in (QSystemTrayIcon.Trigger, QSystemTrayIcon.DoubleClick):
details.show()
details.activateWindow()
def start(self):
if (GlobalSettingsExist() and AccountExist()):
@ -247,6 +260,17 @@ class About(QDialog):
event.ignore()
self.hide()
class Details(QDialog):
def __init__(self):
super(Details, self).__init__()
self.ui = Ui_Details()
self.ui.setupUi(self)
def closeEvent(self, event):
event.ignore()
self.hide()
# Common functions
@ -385,6 +409,7 @@ if __name__ == '__main__':
QApplication.setQuitOnLastWindowClosed(False)
window = Window()
about = About()
details = Details()
if (GlobalSettingsExist() and AccountExist()):
window.hide()
else:

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>icons/details.png</file>
<file>LICENSE.txt</file>
<file>icons/save_account.png</file>
<file>icons/mailbox_empty.png</file>

File diff suppressed because it is too large Load Diff

51
ui/details.ui Normal file
View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Details</class>
<widget class="QDialog" name="Details">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>730</width>
<height>467</height>
</rect>
</property>
<property name="windowTitle">
<string>Mail Notifier</string>
</property>
<property name="windowIcon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/mailbox_empty.png</normaloff>:/icons/mailbox_empty.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="pushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Refresh</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/icons/check_now.png</normaloff>:/icons/check_now.png</iconset>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTableWidget" name="tableWidget"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../resources.qrc"/>
</resources>
<connections/>
</ui>

48
ui_details.py Normal file
View File

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/details.ui'
#
# Created by: PyQt5 UI code generator 5.6.1.dev1604271126
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Details(object):
def setupUi(self, Details):
Details.setObjectName("Details")
Details.resize(730, 467)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/mailbox_empty.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
Details.setWindowIcon(icon)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Details)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.pushButton = QtWidgets.QPushButton(Details)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
self.pushButton.setSizePolicy(sizePolicy)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(":/icons/check_now.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton.setIcon(icon1)
self.pushButton.setObjectName("pushButton")
self.verticalLayout_2.addWidget(self.pushButton)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.tableWidget = QtWidgets.QTableWidget(Details)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(0)
self.tableWidget.setRowCount(0)
self.horizontalLayout.addWidget(self.tableWidget)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.retranslateUi(Details)
QtCore.QMetaObject.connectSlotsByName(Details)
def retranslateUi(self, Details):
_translate = QtCore.QCoreApplication.translate
Details.setWindowTitle(_translate("Details", "Mail Notifier"))
self.pushButton.setText(_translate("Details", "Refresh"))
import resources_rc