1 Star 0 Fork 64

zhuzhenping/starquant

forked from physer/starquant 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gui.py 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import yaml
from PyQt5 import QtCore, QtWidgets, QtGui
from source.gui.ui_main_window import MainWindow
import atexit
from signal import signal, SIGINT, SIG_DFL
from os import kill
from multiprocessing import Process
import itchat
# https://stackoverflow.com/questions/4938723/what-is-the-correct-way-to-make-my-pyqt-application-quit-when-killed-from-the-co
signal(SIGINT, SIG_DFL)
def main():
config_server = None
try:
path = os.path.abspath(os.path.dirname(__file__))
config_file = os.path.join(path, 'etc/config_server.yaml')
with open(os.path.expanduser(config_file), encoding='utf8') as fd:
config_server = yaml.load(fd)
except IOError:
print("config_server.yaml is missing")
config_client = None
try:
path = os.path.abspath(os.path.dirname(__file__))
config_file = os.path.join(path, 'etc/config_client.yaml')
with open(os.path.expanduser(config_file), encoding='utf8') as fd:
config_client = yaml.load(fd)
except IOError:
print("config_client.yaml is missing")
lang_dict = None
font = None
try:
path = os.path.abspath(os.path.dirname(__file__))
config_file = os.path.join(path, 'source/gui/language/en/live_text.yaml')
font = QtGui.QFont('Microsoft Sans Serif', 12)
if config_client['language'] == 'cn':
config_file = os.path.join(path, 'source/gui/language/cn/live_text.yaml')
font = QtGui.QFont(u'微软雅黑', 10)
with open(os.path.expanduser(config_file), encoding='utf8') as fd:
lang_dict = yaml.load(fd)
lang_dict['font'] = font
except IOError:
print("live_text.yaml is missing")
app = QtWidgets.QApplication(sys.argv)
mainWindow = MainWindow(config_server, config_client, lang_dict)
if config_client['theme'] == 'dark':
import qdarkstyle
app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
mainWindow.showMaximized()
sys.exit(app.exec_())
server_process = None
if __name__ == "__main__":
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/zhuzhenping/starquant.git
git@gitee.com:zhuzhenping/starquant.git
zhuzhenping
starquant
starquant
master

搜索帮助