|
|
@ -21,64 +21,62 @@ class SendApp:
|
|
|
|
|
|
|
|
|
|
|
|
self.send_label = tk.Label(self.send_data_frame, text="发送数据")
|
|
|
|
self.send_label = tk.Label(self.send_data_frame, text="发送数据")
|
|
|
|
self.send_label.pack(side=tk.LEFT)
|
|
|
|
self.send_label.pack(side=tk.LEFT)
|
|
|
|
self.send_entry = tk.Entry(self.send_data_frame, width=90)
|
|
|
|
self.send_entry = tk.Entry(self.send_data_frame, width=50)
|
|
|
|
self.send_entry.pack(side=tk.LEFT)
|
|
|
|
self.send_entry.pack(side=tk.LEFT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 创建元数据子框架
|
|
|
|
|
|
|
|
self.metadata_frame = tk.LabelFrame(self.send_frame, text='元数据', padx=10, pady=10)
|
|
|
|
|
|
|
|
self.metadata_frame.pack(side=tk.TOP, fill=tk.X, expand=True)
|
|
|
|
|
|
|
|
|
|
|
|
# 输入帧头
|
|
|
|
# 输入帧头
|
|
|
|
self.first_message_label = tk.Label(self.send_frame, text="帧头:")
|
|
|
|
self.first_message_label = tk.Label(self.metadata_frame, text="帧头:")
|
|
|
|
self.first_message_label.pack(side=tk.LEFT)
|
|
|
|
self.first_message_label.grid(row=0, column=0)
|
|
|
|
self.first_message_entry = tk.Entry(self.send_frame)
|
|
|
|
self.first_message_entry = tk.Entry(self.metadata_frame)
|
|
|
|
self.first_message_entry.pack(side=tk.LEFT)
|
|
|
|
self.first_message_entry.grid(row=0, column=1)
|
|
|
|
|
|
|
|
|
|
|
|
# 流水号
|
|
|
|
# 流水号
|
|
|
|
self.flow_msg_label = tk.Label(self.send_frame, text="流水号:")
|
|
|
|
self.flow_msg_label = tk.Label(self.metadata_frame, text="流水号:")
|
|
|
|
self.flow_msg_label.pack(side=tk.LEFT)
|
|
|
|
self.flow_msg_label.grid(row=0, column=2)
|
|
|
|
self.flow_msg_entry = tk.Entry(self.send_frame)
|
|
|
|
self.flow_msg_entry = tk.Entry(self.metadata_frame)
|
|
|
|
self.flow_msg_entry.pack(side=tk.LEFT)
|
|
|
|
self.flow_msg_entry.grid(row=0, column=3)
|
|
|
|
|
|
|
|
|
|
|
|
# 时标
|
|
|
|
# 时标
|
|
|
|
self.time_msg_label = tk.Label(self.send_frame, text="时标:")
|
|
|
|
self.time_msg_label = tk.Label(self.metadata_frame, text="时标:")
|
|
|
|
self.time_msg_label.pack(side=tk.LEFT)
|
|
|
|
self.time_msg_label.grid(row=0, column=4)
|
|
|
|
self.time_msg_entry = tk.Entry(self.send_frame)
|
|
|
|
self.time_msg_entry = tk.Entry(self.metadata_frame)
|
|
|
|
self.time_msg_entry.pack(side=tk.LEFT)
|
|
|
|
self.time_msg_entry.grid(row=0, column=5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 输入帧尾
|
|
|
|
|
|
|
|
self.last_message_label = tk.Label(self.metadata_frame, text="帧尾:")
|
|
|
|
|
|
|
|
self.last_message_label.grid(row=1, column=0)
|
|
|
|
|
|
|
|
self.last_message_entry = tk.Entry(self.metadata_frame)
|
|
|
|
|
|
|
|
self.last_message_entry.grid(row=1, column=1)
|
|
|
|
|
|
|
|
|
|
|
|
# 时标(秒内计数器)
|
|
|
|
# 报文类型 & 数据长度 & 数据段
|
|
|
|
self.sec_time_msg_label = tk.Label(self.send_frame, text="时标(秒内计数器):")
|
|
|
|
self.payload_frame = tk.LabelFrame(self.send_frame, text='有效负载', padx=10, pady=10)
|
|
|
|
self.sec_time_msg_label.pack(side=tk.LEFT)
|
|
|
|
self.payload_frame.pack(side=tk.TOP, fill=tk.X, expand=True)
|
|
|
|
self.sec_time_msg_entry = tk.Entry(self.send_frame)
|
|
|
|
|
|
|
|
self.sec_time_msg_entry.pack(side=tk.LEFT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 报文类型
|
|
|
|
# 报文类型
|
|
|
|
self.type_msg_label = tk.Label(self.send_frame, text="报文类型:")
|
|
|
|
self.type_msg_label = tk.Label(self.payload_frame, text="报文类型:")
|
|
|
|
self.type_msg_label.pack(side=tk.LEFT)
|
|
|
|
self.type_msg_label.grid(row=0, column=0)
|
|
|
|
self.type_msg_entry = tk.Entry(self.send_frame)
|
|
|
|
self.type_msg_entry = tk.Entry(self.payload_frame)
|
|
|
|
self.type_msg_entry.pack(side=tk.LEFT)
|
|
|
|
self.type_msg_entry.grid(row=0, column=1)
|
|
|
|
|
|
|
|
|
|
|
|
# 数据长度
|
|
|
|
# 数据长度
|
|
|
|
self.length_msg_label = tk.Label(self.send_frame, text="数据长度:")
|
|
|
|
self.length_msg_label = tk.Label(self.payload_frame, text="数据长度:")
|
|
|
|
self.length_msg_label.pack(side=tk.LEFT)
|
|
|
|
self.length_msg_label.grid(row=0, column=2)
|
|
|
|
self.length_msg_entry = tk.Entry(self.send_frame)
|
|
|
|
self.length_msg_entry = tk.Entry(self.payload_frame)
|
|
|
|
self.length_msg_entry.pack(side=tk.LEFT)
|
|
|
|
self.length_msg_entry.grid(row=0, column=3)
|
|
|
|
|
|
|
|
|
|
|
|
# 数据段
|
|
|
|
# 数据段
|
|
|
|
self.data_msg_label = tk.Label(self.send_frame, text="数据段:")
|
|
|
|
self.data_msg_label = tk.Label(self.payload_frame, text="数据段:")
|
|
|
|
self.data_msg_label.pack(side=tk.LEFT)
|
|
|
|
self.data_msg_label.grid(row=1, column=0)
|
|
|
|
self.data_msg_entry = tk.Entry(self.send_frame)
|
|
|
|
self.data_msg_entry = tk.Entry(self.payload_frame)
|
|
|
|
self.data_msg_entry.pack(side=tk.LEFT)
|
|
|
|
self.data_msg_entry.grid(row=1, column=1)
|
|
|
|
|
|
|
|
|
|
|
|
# 输入帧尾
|
|
|
|
|
|
|
|
self.last_message_label = tk.Label(self.send_frame, text="帧尾:")
|
|
|
|
|
|
|
|
self.last_message_label.pack(side=tk.LEFT)
|
|
|
|
|
|
|
|
self.last_message_entry = tk.Entry(self.send_frame)
|
|
|
|
|
|
|
|
self.last_message_entry.pack(side=tk.LEFT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 创建一个包含发送按钮的框架
|
|
|
|
|
|
|
|
self.send_button_frame = tk.Frame(self.send_frame)
|
|
|
|
|
|
|
|
self.send_button_frame.pack(fill=tk.X, padx=10, pady=10) # 框架会填充整个水平方向
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 将发送按钮放入这个新的框架,并让它在框架中居中
|
|
|
|
# 创建发送按钮
|
|
|
|
self.send_button = tk.Button(self.send_button_frame, text="发送", command=self.send_message)
|
|
|
|
self.send_button = tk.Button(self.send_frame, text="发送", command=self.send_message)
|
|
|
|
self.send_button.pack(side=tk.TOP, pady=10) # 这里不需要使用 anchor 参数,因为框架是填充整个水平方向的
|
|
|
|
self.send_button.pack(side=tk.LEFT, pady=10)
|
|
|
|
|
|
|
|
|
|
|
|
# 接收区域
|
|
|
|
# 接收区域
|
|
|
|
self.recv_frame = tk.Frame(window)
|
|
|
|
self.recv_frame = tk.Frame(window)
|
|
|
|