1 Star 0 Fork 50

彭添/openQPA

forked from l7dpi/openQPA 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
QPA.py 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
@author zhuzhu
@contact QQ327909056
'''
import sys,os
from os import getcwd
from PyQt4.QtGui import QSystemTrayIcon,QApplication,QAction,QIcon,QMenu
from PyQt4.QtCore import QTextCodec,Qt
import AppProperty
from Window import Window
from PyQt4.QtNetwork import QNetworkCookieJar
reload(sys)
sys.setdefaultencoding('utf-8')
def main():
# 每一个PyQt4程序都必须创建一个QApplication对象[QtGui.QApplication(sys.argv)]
app = QApplication(sys.argv)
QTextCodec.setCodecForCStrings(QTextCodec.codecForName("GBK"))
initProperty()
AppProperty.MainWin = Window("main.html",1300,600)
AppProperty.MainWin.show()
createTray()
sys.exit(app.exec_())
def createTray():
#托盘
AppProperty.TrayIcon=QSystemTrayIcon(AppProperty.AppIcon,AppProperty.MainWin)
AppProperty.TrayIcon.activated.connect(trayClick)
AppProperty.TrayIcon.setToolTip("QPA")
AppProperty.TrayIcon.setContextMenu(createTrayMenu(AppProperty.TrayIcon))
AppProperty.TrayIcon.show()
def trayClick(reason):
if(reason==3):
if AppProperty.MainWin.isHidden():
AppProperty.MainWin.show()
AppProperty.MainWin.activateWindow()
def createTrayMenu(trayIcon):
trayIconMenu = QMenu()
action = QAction(u"退出",trayIcon)
action.triggered.connect(QPAquit)
trayIconMenu.addAction(action)
return trayIconMenu
def initProperty():
AppProperty.AppTitle = "QPA"
AppProperty.AppIcon = QIcon("imgs/icon.png")
AppProperty.HomeDir = getcwd()
AppProperty.CookieJar = QNetworkCookieJar()
def QPAquit():
QApplication.instance().quit()
os.popen("taskkill /F /IM CAP.exe")
return 'ok'
if __name__ == "__main__":
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/pengtianabc/openQPA.git
git@gitee.com:pengtianabc/openQPA.git
pengtianabc
openQPA
openQPA
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385