@@ -22,80 +22,80 @@ def __init__(self, *args, **kwargs):
2222 super ().__init__ (* args , ** kwargs )
2323
2424 # >>> 串口配置
25- serial_label_frame = tk .LabelFrame (master = self , text = '串口配置 ' , labelanchor = tk .N )
25+ serial_label_frame = tk .LabelFrame (master = self , text = 'Serial Settings ' , labelanchor = tk .N )
2626 serial_label_frame .pack (anchor = tk .NW , expand = False , fill = tk .X , pady = (5 , 5 ))
2727 for index in range (14 ):
2828 serial_label_frame .columnconfigure (index , weight = 1 )
2929
30- serial_label = tk .Label (serial_label_frame , text = '串口 :' )
30+ serial_label = tk .Label (serial_label_frame , text = 'Serial :' )
3131 serial_label .grid (row = 0 , column = 0 , sticky = tk .N , padx = (5 , 0 ), pady = (5 , 5 ))
3232 self .port_combobox = ttk .Combobox (master = serial_label_frame , postcommand = self .list_valid_ports )
3333 self .port_combobox .grid (row = 0 , column = 1 , ipadx = 40 , sticky = tk .W , padx = (0 , 5 ), pady = (5 , 5 ))
3434 self .list_valid_ports ()
3535
36- baudrate_label = tk .Label (serial_label_frame , text = '波特率 :' )
36+ baudrate_label = tk .Label (serial_label_frame , text = 'Baudrate :' )
3737 baudrate_label .grid (row = 0 , column = 2 , sticky = tk .N , padx = (5 , 0 ), pady = (5 , 5 ))
3838 self .baudrate_combobox = ttk .Combobox (master = serial_label_frame , values = Serial .BAUDRATES , width = 7 )
3939 self .baudrate_combobox .set ('115200' )
4040 self .baudrate_combobox .grid (row = 0 , column = 3 , sticky = tk .W , padx = (0 , 5 ), pady = (5 , 5 ))
4141
42- stopbits_label = tk .Label (serial_label_frame , text = '停止位 :' )
42+ stopbits_label = tk .Label (serial_label_frame , text = 'Stopbits :' )
4343 stopbits_label .grid (row = 0 , column = 4 , sticky = tk .N , padx = (5 , 0 ), pady = (5 , 5 ))
4444 self .stopbits_combobox = ttk .Combobox (master = serial_label_frame , values = Serial .STOPBITS , width = 5 )
4545 self .stopbits_combobox .set ('1' )
4646 self .stopbits_combobox .grid (row = 0 , column = 5 , sticky = tk .W , padx = (0 , 5 ), pady = (5 , 5 ))
4747
48- parity_label = tk .Label (serial_label_frame , text = '校验 :' )
48+ parity_label = tk .Label (serial_label_frame , text = 'Parity :' )
4949 parity_label .grid (row = 0 , column = 6 , sticky = tk .N , padx = (5 , 0 ), pady = (5 , 5 ))
5050 self .parity_combobox = ttk .Combobox (master = serial_label_frame , values = Serial .PARITIES , width = 5 )
5151 self .parity_combobox .set ('N' )
5252 self .parity_combobox .grid (row = 0 , column = 7 , sticky = tk .W , padx = (0 , 5 ), pady = (5 , 5 ))
5353
54- bytesize_label = tk .Label (serial_label_frame , text = '数据位 :' )
54+ bytesize_label = tk .Label (serial_label_frame , text = 'Bytesize :' )
5555 bytesize_label .grid (row = 0 , column = 8 , sticky = tk .N , padx = (5 , 0 ), pady = (5 , 5 ))
5656 self .bytesize_combobox = ttk .Combobox (master = serial_label_frame , values = Serial .BYTESIZES , width = 5 )
5757 self .bytesize_combobox .set ('8' )
5858 self .bytesize_combobox .grid (row = 0 , column = 9 , sticky = tk .W , padx = (0 , 5 ), pady = (5 , 5 ))
5959
60- flow_control_label = tk .Label (serial_label_frame , text = '流控 :' )
60+ flow_control_label = tk .Label (serial_label_frame , text = 'Flow :' )
6161 flow_control_label .grid (row = 0 , column = 10 , sticky = tk .N , padx = (5 , 0 ), pady = (5 , 5 ))
6262 self .flow_control_combobox = ttk .Combobox (master = serial_label_frame , values = ['No' , 'HW' , 'SW' ], width = 5 )
6363 self .flow_control_combobox .set ('No' )
6464 self .flow_control_combobox .grid (row = 0 , column = 11 , sticky = tk .W , padx = (0 , 5 ), pady = (5 , 5 ))
6565
6666 self .open_serial_button = tk .Button (
67- serial_label_frame , text = '打开串口 ' ,
67+ serial_label_frame , text = 'Open ' ,
6868 command = self .switch_serial_handler
6969 )
7070 self .open_serial_button .grid (row = 0 , column = 12 , sticky = tk .EW , padx = (5 , 5 ), pady = (5 , 5 ))
7171 # <<<
7272
7373 # >>> 固件下载
74- fw_label_frame = tk .LabelFrame (master = self , text = '固件下载 ' , labelanchor = tk .N )
74+ fw_label_frame = tk .LabelFrame (master = self , text = 'Firmware Download ' , labelanchor = tk .N )
7575 fw_label_frame .pack (anchor = tk .NW , expand = False , fill = tk .X , pady = (5 , 5 ))
7676 for index in range (14 ):
7777 fw_label_frame .columnconfigure (index , weight = 1 )
7878
79- fw_file_path_label = tk .Label (fw_label_frame , text = '固件文件 :' )
79+ fw_file_path_label = tk .Label (fw_label_frame , text = 'firmware path :' )
8080 fw_file_path_label .grid (row = 1 , column = 0 , sticky = tk .EW , padx = (5 , 0 ), pady = (5 , 5 ))
8181 self .firmware_file_path_stringvar = tk .StringVar ()
8282 self .firmware_file_path_stringvar .trace_variable ('w' , self .on_fw_file_path_write )
8383 fw_file_path_entry = tk .Entry (fw_label_frame , textvariable = self .firmware_file_path_stringvar , state = 'readonly' )
8484 fw_file_path_entry .grid (row = 1 , column = 1 , columnspan = 11 , sticky = tk .EW , padx = (0 , 5 ), pady = (5 , 5 ))
8585
8686 self .fw_file_choose_button = tk .Button (
87- fw_label_frame , text = '选择路径 ' ,
87+ fw_label_frame , text = 'select ' ,
8888 command = self .ask_for_firmware_file_path
8989 )
9090 self .fw_file_choose_button .grid (row = 1 , column = 12 , sticky = tk .EW , padx = (5 , 5 ), pady = (5 , 5 ))
9191
9292 self .fw_download_button = tk .Button (
93- fw_label_frame , text = '下载固件 ' ,
93+ fw_label_frame , text = 'download ' ,
9494 command = self .download_firmware_handler
9595 )
9696 self .fw_download_button .grid (row = 1 , column = 13 , sticky = tk .EW , padx = (5 , 5 ), pady = (5 , 5 ))
9797
98- progress_label = tk .Label (fw_label_frame , text = '下载进度 :' )
98+ progress_label = tk .Label (fw_label_frame , text = 'progress :' )
9999 progress_label .grid (row = 2 , column = 0 , sticky = tk .EW , padx = (5 , 0 ), pady = (5 , 5 ))
100100 self .bar = ttk .Progressbar (master = fw_label_frame , maximum = 100 )
101101 self .bar .grid (row = 2 , column = 1 , columnspan = 11 , sticky = tk .EW , padx = (0 , 5 ), pady = (5 , 5 ))
@@ -105,7 +105,7 @@ def __init__(self, *args, **kwargs):
105105 progress_entry = tk .Label (fw_label_frame , textvariable = self .progress_stringvar )
106106 progress_entry .grid (row = 2 , column = 12 , sticky = tk .W , padx = (5 , 5 ), pady = (5 , 5 ))
107107
108- log_label = tk .Label (fw_label_frame , text = '进度日志 :' )
108+ log_label = tk .Label (fw_label_frame , text = 'logging :' )
109109 log_label .grid (row = 3 , column = 0 , sticky = tk .EW , padx = (5 , 0 ), pady = (5 , 5 ))
110110 self .log_stringvar = tk .StringVar ()
111111 self .log_stringvar .set ('ready' )
@@ -139,13 +139,13 @@ def switch_serial_handler(self):
139139 master = self
140140 )
141141 return
142- self .open_serial_button ['text' ] = '关闭串口 '
142+ self .open_serial_button ['text' ] = 'Close '
143143 self .set_com_widgets_state (tk .DISABLED )
144144 else :
145145 if self .serial .isOpen ():
146146 self .serial .close ()
147147 self .serial = None
148- self .open_serial_button ['text' ] = '打开串口 '
148+ self .open_serial_button ['text' ] = 'Open '
149149 self .set_com_widgets_state (tk .ACTIVE )
150150
151151 def set_com_widgets_state (self , state ):
@@ -207,7 +207,7 @@ def get_validated_com_port(self, firmware_file_path):
207207 return rv
208208
209209 def ask_for_firmware_file_path (self ):
210- firmware_file_path = filedialog .askopenfilename (title = '请选择文件 ' )
210+ firmware_file_path = filedialog .askopenfilename (title = 'choose firmware file ' )
211211 if firmware_file_path :
212212 self .firmware_file_path_stringvar .set (firmware_file_path )
213213
@@ -273,13 +273,13 @@ def update_progress(self, payload):
273273 )
274274 else :
275275 self .log_stringvar .set ('download process exited.' )
276- self .fw_file_choose_button .config (state = tk .ACTIVE )
277- self .fw_download_button .config (state = tk .ACTIVE )
278276 messagebox .showinfo (
279277 title = 'Information' ,
280278 message = 'Download Firmware Progress Finished!' ,
281279 master = self
282280 )
281+ self .fw_file_choose_button .config (state = tk .ACTIVE )
282+ self .fw_download_button .config (state = tk .ACTIVE )
283283 else :
284284 # nothing
285285 pass
0 commit comments