11from glob import glob
22from serial .tools import list_ports
33from logging import getLogger , debug , info , error
4- from os .path import expanduser
4+ from os .path import expanduser , basename
55from customtkinter import CTkButton , CTkFrame
66from tkinter import filedialog , Event
77from webbrowser import open_new
@@ -68,6 +68,10 @@ def __init__(self):
6868 self .information .mac_info_btn .pack_forget ()
6969 self .information .flash_status_btn .pack_forget ()
7070
71+ # Erase Device
72+ self .erase_device = FrameEraseDevice (self )
73+ self .erase_device .erase_btn .configure (command = lambda : self ._esptool_command ("erase_flash" ))
74+
7175 # PlugIns
7276 self .plugins = FramePlugIns (self )
7377
@@ -78,10 +82,6 @@ def __init__(self):
7882 self .plugins .mp_version_btn .pack_forget ()
7983 self .plugins .mp_structure_btn .pack_forget ()
8084
81- # Erase Device
82- self .erase_device = FrameEraseDevice (self )
83- self .erase_device .erase_btn .configure (command = lambda : self ._esptool_command ("erase_flash" ))
84-
8585 # Flash Firmware
8686 self .flash_firmware = FrameFirmwareFlash (self )
8787
@@ -213,7 +213,7 @@ def _disable_buttons(self) -> None:
213213
214214 :return: None
215215 """
216- frames : Tuple [CTkFrame , ...] = (self .information , self .plugins , self .erase_device , self . flash_firmware )
216+ frames : Tuple [CTkFrame , ...] = (self .information , self .plugins , self .erase_device )
217217
218218 buttons = [
219219 widget
@@ -225,13 +225,15 @@ def _disable_buttons(self) -> None:
225225 for button in buttons :
226226 button .configure (state = 'disabled' )
227227
228+ self .flash_firmware .flash_btn .configure (state = 'disabled' )
229+
228230 def _enable_buttons (self ) -> None :
229231 """
230232 Enables specific UI buttons by changing their state to 'normal'.
231233
232234 :return: None
233235 """
234- frames : Tuple [CTkFrame , ...] = (self .information , self .plugins , self .erase_device , self . flash_firmware )
236+ frames : Tuple [CTkFrame , ...] = (self .information , self .plugins , self .erase_device )
235237
236238 buttons = [
237239 widget
@@ -243,6 +245,8 @@ def _enable_buttons(self) -> None:
243245 for button in buttons :
244246 button .configure (state = 'normal' )
245247
248+ self .flash_firmware .flash_btn .configure (state = 'normal' )
249+
246250 def _search_devices (self ) -> None :
247251 """
248252 Updates the device dropdown menu with a list of available devices. If there are no
@@ -363,6 +367,7 @@ def _handle_firmware_selection(self) -> None:
363367 if file_path :
364368 self .__selected_firmware = file_path
365369 self .flash_firmware .firmware_checkbox .select ()
370+ self .flash_firmware .firmware_btn .configure (text = str (basename (file_path )[:15 ]))
366371 else :
367372 self .__selected_firmware = None
368373 self .flash_firmware .firmware_checkbox .deselect ()
0 commit comments