提交 407f5b4abe02c8fd3116d3b03cec6d2d2f668326

作者 gaojp
1 个父辈 d4e175f6

update

正在显示 1 个修改的文件 包含 84 行增加82 行删除
1   -import sys
2   -import socket
3   -from common.utils import *
4   -from PyQt5.QtWidgets import QApplication
5   -from forms import mainform
6   -from forms import loginform
7   -from forms import floderfrom
8   -from common.config import *
9   -from common.log import BotLogger
10   -
11   -logger = BotLogger(os.path.basename(__file__), logname=1).getLogger()
12   -BOT_STATUS = False
13   -HOST = '127.0.0.1'
14   -PORT = 55555
15   -
16   -
17   -if __name__ == '__main__':
18   - filename = sys.argv[0]
19   - if not load_config():
20   - logger.error("加载配置文件失败!")
21   - sys.exit()
22   -
23   - db_path = os.path.join(os.getcwd(), get_cfg().db_path)
24   - if not os.path.exists(db_path):
25   - if not DBClass().init_db():
26   - logger.error("初始化数据库文件失败!")
27   - sys.exit(1)
28   -
29   - tenant_id = get_cfg().tenant_id
30   - tenant_type = get_cfg().tenant_type
31   -
32   - if tenant_id == "" or tenant_id is None:
33   - logger.error("获取配置文件tenant_id数据异常")
34   - sys.exit(2)
35   - if tenant_type not in ['0', '1']:
36   - logger.error("获取配置文件tenant_type数据异常")
37   - sys.exit(3)
38   -
39   - crease_shoutcut() # 创建快捷方式到自启动文件夹中
40   -
41   - app = QApplication(sys.argv)
42   -
43   - login_form = loginform.Ui_LoginWindow()
44   - login_form.setupUi()
45   -
46   - main_form = mainform.Ui_MainWindow()
47   - main_form.setupUi()
48   -
49   - floder_form = floderfrom.Ui_FloderWindow(main_form)
50   - floder_form.setupUi()
51   -
52   - is_err = False, ''
53   - result = login_check(tenant_id, tenant_type)
54   - if result == 0:
55   - login_form.LoginWindow.show()
56   - login_form.pushButton_2.clicked.connect(lambda: login_form.login(floder_form, tenant_id, tenant_type))
57   - elif result == 1:
58   - floder_form.FloderWindow.show()
59   - elif result == 2:
60   - main_form.mainform_show()
61   - elif result == -1:
62   - is_err = True, '连接数据库失败!'
63   - elif result == -2:
64   - is_err = True, '网络连接异常,请稍后重试!'
65   -
66   - if not is_err[0]:
67   - do_task_thread = mainform.UpdateDoTask()
68   - do_task_thread.update_date.connect(main_form.update_dotask) # 更新待办理账户管理线程
69   - do_task_thread.start()
70   -
71   - doed_task_thread = mainform.UpdateDoedTask()
72   - doed_task_thread.update_date.connect(main_form.update_doedtask) # 更新已办理账户管理线程
73   - doed_task_thread.start()
74   -
75   - main_form.commandLinkButton_2.clicked.connect(lambda: main_form.login_off(filename))
76   - main_form.commandLinkButton_3.clicked.connect(lambda: main_form.get_do_task())
77   - main_form.commandLinkButton_4.clicked.connect(lambda: main_form.get_doed_task())
78   - main_form.commandLinkButton_5.clicked.connect(lambda: main_form.start_task(tenant_id, tenant_type))
79   - else:
80   - logger.info("socket对象关闭")
81   - open_msg(is_err[1])
82   -
  1 +import sys, os
  2 +if hasattr(sys, 'frozen'):
  3 + os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH']
  4 +import socket
  5 +from common.utils import *
  6 +from PyQt5.QtWidgets import QApplication
  7 +from forms import mainform
  8 +from forms import loginform
  9 +from forms import floderfrom
  10 +from common.config import *
  11 +from common.log import BotLogger
  12 +
  13 +logger = BotLogger(os.path.basename(__file__), logname=1).getLogger()
  14 +BOT_STATUS = False
  15 +HOST = '127.0.0.1'
  16 +PORT = 55555
  17 +
  18 +
  19 +if __name__ == '__main__':
  20 + filename = sys.argv[0]
  21 + if not load_config():
  22 + logger.error("加载配置文件失败!")
  23 + sys.exit()
  24 +
  25 + db_path = os.path.join(os.getcwd(), get_cfg().db_path)
  26 + if not os.path.exists(db_path):
  27 + if not DBClass().init_db():
  28 + logger.error("初始化数据库文件失败!")
  29 + sys.exit(1)
  30 +
  31 + tenant_id = get_cfg().tenant_id
  32 + tenant_type = get_cfg().tenant_type
  33 +
  34 + if tenant_id == "" or tenant_id is None:
  35 + logger.error("获取配置文件tenant_id数据异常")
  36 + sys.exit(2)
  37 + if tenant_type not in ['0', '1']:
  38 + logger.error("获取配置文件tenant_type数据异常")
  39 + sys.exit(3)
  40 +
  41 + crease_shoutcut() # 创建快捷方式到自启动文件夹中
  42 +
  43 + app = QApplication(sys.argv)
  44 +
  45 + login_form = loginform.Ui_LoginWindow()
  46 + login_form.setupUi()
  47 +
  48 + main_form = mainform.Ui_MainWindow()
  49 + main_form.setupUi()
  50 +
  51 + floder_form = floderfrom.Ui_FloderWindow(main_form)
  52 + floder_form.setupUi()
  53 +
  54 + is_err = False, ''
  55 + result = login_check(tenant_id, tenant_type)
  56 + if result == 0:
  57 + login_form.LoginWindow.show()
  58 + login_form.pushButton_2.clicked.connect(lambda: login_form.login(floder_form, tenant_id, tenant_type))
  59 + elif result == 1:
  60 + floder_form.FloderWindow.show()
  61 + elif result == 2:
  62 + main_form.mainform_show()
  63 + elif result == -1:
  64 + is_err = True, '连接数据库失败!'
  65 + elif result == -2:
  66 + is_err = True, '网络连接异常,请稍后重试!'
  67 +
  68 + if not is_err[0]:
  69 + do_task_thread = mainform.UpdateDoTask()
  70 + do_task_thread.update_date.connect(main_form.update_dotask) # 更新待办理账户管理线程
  71 + do_task_thread.start()
  72 +
  73 + doed_task_thread = mainform.UpdateDoedTask()
  74 + doed_task_thread.update_date.connect(main_form.update_doedtask) # 更新已办理账户管理线程
  75 + doed_task_thread.start()
  76 +
  77 + main_form.commandLinkButton_2.clicked.connect(lambda: main_form.login_off(filename))
  78 + main_form.commandLinkButton_3.clicked.connect(lambda: main_form.get_do_task())
  79 + main_form.commandLinkButton_4.clicked.connect(lambda: main_form.get_doed_task())
  80 + main_form.commandLinkButton_5.clicked.connect(lambda: main_form.start_task(tenant_id, tenant_type))
  81 + else:
  82 + logger.info("socket对象关闭")
  83 + open_msg(is_err[1])
  84 +
83 85 sys.exit(app.exec_())
\ No newline at end of file
... ...
注册登录 后发表评论