From 68464c679ae5e1ae35e7e67e3b339ba0f939cbd3 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期三, 15 三月 2023 14:46:03 +0800
Subject: [PATCH] 选股宝板块优化

---
 gui.py |   37 +++++++++++++++++++------------------
 1 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/gui.py b/gui.py
index 5a82dfb..841765e 100644
--- a/gui.py
+++ b/gui.py
@@ -7,6 +7,7 @@
 
 import win32gui
 
+import constant
 import data_export_util
 import multiprocessing
 
@@ -95,7 +96,7 @@
         clients = authority.get_l2_clients()
         for client_id in clients:
             self.l2_codes[client_id] = []
-            for i in range(0, 8):
+            for i in range(0, constant.L2_CODE_COUNT_PER_DEVICE):
                 code = gpcode_manager.get_listen_code_by_pos(client_id, i)
                 self.l2_codes[client_id].append(code)
 
@@ -293,7 +294,7 @@
                 index += 1
             table.redraw()
 
-        start_y = 160
+        start_y = 225
         btn = Button(frame, text="鍒锋柊鏀剁洏浠�", command=refresh_close_price_data)
         btn.place(x=5, y=start_y)
 
@@ -371,7 +372,6 @@
             except:
                 pass
 
-
             try:
                 codes = self.thsBuy1VolumnManager.get_current_codes()
                 count = 0
@@ -399,9 +399,6 @@
             except:
                 pass
 
-
-
-
             # 鑾峰彇鏈夋晥鐨凩2瀹㈡埛绔暟閲�
             l2_client_count = client_manager.getValidL2Clients()
             if len(l2_client_count) < 2:
@@ -421,7 +418,7 @@
                     pass
                 time.sleep(2)
 
-        start_y = 225
+        start_y = 285
 
         btn = Button(frame, text="鍒锋柊鐘舵��", command=refresh_data)
         btn.place(x=10, y=start_y)
@@ -495,7 +492,7 @@
                 else:
                     client_state[client_id].configure(text="(绂荤嚎锛氭湭鐭P)", foreground="#999999")
 
-                for i in range(0, 8):
+                for i in range(0, constant.L2_CODE_COUNT_PER_DEVICE):
                     code = gpcode_manager.get_listen_code_by_pos(client_id, i)
                     data_count = l2_data_util.get_l2_latest_data_number(code)
                     if data_count is None:
@@ -611,7 +608,7 @@
             check(self.selected_client)
 
         width = 800
-        height = 290
+        height = 360
         frame = Frame(root, {"height": height, "width": width, "bg": "#DDDDDD"})
         cl = Label(frame, text="L2閲囬泦鐘舵��", bg="#DDDDDD")
         cl.place(x=5, y=5)
@@ -658,19 +655,19 @@
             btn.place(x=5, y=35 + l2_client_count * 30)
 
             client_state_lb = Label(frame, text="(鏈煡)", padx=0, pady=0, background="#DDDDDD", font=('寰蒋闆呴粦', 8))
-            client_state_lb.place(x=80, y=40 + l2_client_count * 30)
+            client_state_lb.place(x=82, y=40 + l2_client_count * 30)
             client_state[key] = client_state_lb
             code_sv_map[key] = []
             code_labels[key] = []
-            for i in range(0, 8):
+            for i in range(0, constant.L2_CODE_COUNT_PER_DEVICE):
                 sv = StringVar(value=self.l2_codes[key][i])
                 code_sv_map[key].append(sv)
-                cframe = Frame(frame, {"height": 23, "width": 70, "bg": "#FFFFFF"})
+                cframe = Frame(frame, {"height": 23, "width": 80, "bg": "#FFFFFF"})
                 code_label = Label(cframe, textvariable=sv, background="#FFFFFF", foreground="#FF0000")
                 code_labels[key].append(code_label)
 
                 code_label.place(x=0, y=0)
-                cframe.place(x=200 + i * 75, y=40 + l2_client_count * 30)
+                cframe.place(x=200 + i * 85, y=40 + l2_client_count * 30)
             l2_client_count += 1
         # 娣诲姞鏇存柊绾跨▼
         t1 = threading.Thread(target=lambda: update_data())
@@ -934,9 +931,13 @@
             pass
 
         # 绂佹浠g爜
-        def forbidden_code(code_):
-            l2_trade_util.forbidden_trade(code_)
-            showinfo("鎻愮ず","绂佹鎴愬姛")
+        def cancel_order(code_):
+            try:
+                l2.l2_data_util.load_l2_data(code_, True)
+                l2_data_manager_new.L2TradeDataProcessor.cancel_buy(code_, "鎵嬪姩鎾ら攢")
+                showinfo("鎻愮ず", "鎾ゅ崟鎴愬姛")
+            except Exception as e:
+                showwarning("鎻愮ず", "鎾ゅ崟鎴愬姛寮傚父" + str(e))
 
         frame = Frame(root, {"height": 280, "width": 300, "bg": "#DDDDDD"})
         frame.grid(row=2, column=2, rowspan=2, pady=5)
@@ -982,7 +983,7 @@
         btn = Button(frame, text="娓呯┖l2鏁版嵁", command=lambda: clear_l2(code.get()))
         btn.place(x=150, y=130)
 
-        btn = Button(frame, text="绂佹浜ゆ槗", command=lambda: forbidden_code(code.get()))
+        btn = Button(frame, text="鎾ら攢鎸傚崟", command=lambda: cancel_order(code.get()))
         btn.place(x=230, y=130)
 
         # 浜ゆ槗鎸夐挳
@@ -1009,7 +1010,7 @@
         self.__draw_trade_data(root)
         self.__draw_test(root)
 
-        root.geometry("1120x600")
+        root.geometry("1120x660")
         root.mainloop()
 
 

--
Gitblit v1.8.0