-
Notifications
You must be signed in to change notification settings - Fork 0
/
hnreader.py
37 lines (25 loc) · 868 Bytes
/
hnreader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
import sys,os
from PySide.QtGui import QApplication,QSystemTrayIcon, QIcon
from PySide.QtCore import QUrl, QSize
from mainwindow import MainWindow
#refactor
def _quit():
app.quit()
qDebug('bye!')
def show_window(thereason):
if thereason == QSystemTrayIcon.ActivationReason.Trigger:
if main_window.isVisible() == True:
main_window.hide()
main_window.show()
#create the QApplication instance before any other widget
app = QApplication(sys.argv)
app.setQuitOnLastWindowClosed(False)
ico = QIcon(os.path.join(os.getcwd(),'yhn.png'))
systrayico = QSystemTrayIcon(ico)
systrayico.activated.connect(show_window)
systrayico.show()
x_pos = systrayico.geometry().left()
y_pos = app.desktop().availableGeometry(app.desktop().primaryScreen()).topLeft().y()
main_window = MainWindow(x_pos, y_pos, 420, 500)
sys.exit(app.exec_())