Administrator
2022-10-28 fa6a3ab958ce9493833eef68ac62bd155be5d53e
gui.py
@@ -10,6 +10,7 @@
import data_export_util
import multiprocessing
import log
import mysql_data
import redis_manager
import server
@@ -22,6 +23,9 @@
# 读取server进程的消息
from trade_data_manager import CodeActualPriceProcessor
def __read_server_pipe(pipe):
    while True:
        value = pipe.recv()
@@ -64,7 +68,6 @@
class GUI:
    def __init__(self):
        p1, p2 = multiprocessing.Pipe()
        gs_gui_pipe, gs_server_pipe = multiprocessing.Pipe()
@@ -74,6 +77,8 @@
        self.p1 = p1
        self.p2 = p2
        self.gs_gui_pipe = gs_gui_pipe
        self.thsBuy1VolumnManager = THSBuy1VolumnManager()
        self.codeActualPriceProcessor = CodeActualPriceProcessor()
        # L2显示
        self.l2_codes = {}
        # 获取l2的客户端列表
@@ -291,7 +296,20 @@
            except Exception as e:
                pass
            try:
                codes = self.thsBuy1VolumnManager.get_current_codes()
                count = 0
                if codes:
                    count = len(codes)
                cl_buy_1.configure(text="{}".format(count), foreground="#008000")
            except:
                pass
            try:
                cl_price_count.configure(text="{}".format(self.codeActualPriceProcessor.get_current_price_codes_count()), foreground="#008000")
            except:
                pass
            # 状态有问题,需要报警
            if not normal:
@@ -335,6 +353,16 @@
        cl_codes = Label(frame, text="未知", bg="#DDDDDD")
        cl_codes.place(x=450, y=y_)
        cl = Label(frame, text="买1代码数量:", bg="#DDDDDD")
        cl.place(x=500, y=y_)
        cl_buy_1 = Label(frame, text="未知", bg="#DDDDDD")
        cl_buy_1.place(x=580, y=y_)
        cl = Label(frame, text="现价代码数量:", bg="#DDDDDD")
        cl.place(x=620, y=y_)
        cl_price_count = Label(frame, text="未知", bg="#DDDDDD")
        cl_price_count.place(x=700, y=y_)
        refresh_data()
        # 添加更新线程
        t1 = threading.Thread(target=lambda: update_data())