Skip to content

Commit 30714c7

Browse files
committed
ui refactoring small fixes
1 parent 4237244 commit 30714c7

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

ui/firmware_studio.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from esptool_plugin.esptool_command_runner import CommandRunner
1616
from serial_plugin.serial_command_runner import SerialCommandRunner
1717
from config.device_configuration import BAUDRATE_OPTIONS, DEFAULT_URL, CONFIGURED_DEVICES
18-
from config.application_configuration import (FONT_CATEGORY, FONT_DESCRIPTION, CONSOLE_INFO, CONSOLE_COMMAND,
19-
CONSOLE_ERROR)
18+
from config.application_configuration import (FONT_PATH, FONT_CATEGORY, FONT_DESCRIPTION, CONSOLE_INFO,
19+
CONSOLE_COMMAND, CONSOLE_ERROR)
2020

2121

2222
logger = getLogger(__name__)
@@ -50,7 +50,8 @@ def __init__(self):
5050

5151
# Search Device
5252
self.search_device = FrameSearchDevice(self)
53-
self.search_device.refresh.configure(command=self._search_devices)
53+
self.search_device.label.configure(font=FONT_PATH)
54+
self.search_device.reload_btn.configure(command=self._search_devices)
5455
self.search_device.device_option.configure(command=self._set_device)
5556

5657
# Device Information
@@ -274,10 +275,10 @@ def _set_device(self, selected_device: Optional[str]) -> None:
274275
if selected_device and selected_device not in ("Select Device", "No devices found"):
275276
info(f'Selected device: {selected_device}')
276277
self.__device_path = selected_device
277-
self.search_device.device_path_label.configure(text=f'Device Path: {self.__device_path}')
278+
self.search_device.label.configure(text=f'Device Path: {self.__device_path}')
278279
else:
279280
self.__device_path = None
280-
self.search_device.device_path_label.configure(text='Device Path:')
281+
self.search_device.label.configure(text='Device Path:')
281282

282283
def _set_chip(self, selection: str) -> None:
283284
"""

ui/frame_search_device.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
from customtkinter import CTkFrame, CTkLabel, CTkImage, CTkButton, CTkOptionMenu
22
from PIL import Image
3-
from config.application_configuration import FONT_PATH
43
from config.application_configuration import RELOAD_ICON
54

65

76
class FrameSearchDevice(CTkFrame):
7+
"""
8+
A specialized class designed to facilitate search device operations.
9+
"""
810

911
def __init__(self, master, *args, **kwargs):
1012
"""
1113
A custom frame designed with widgets for select a device. This frame
12-
is a child of the specified parent widget (master) and includes an Label,
14+
is a child of the specified parent widget (master) and includes a Label,
1315
Image, Button and an OptionMenu with customizable UI features.
1416
"""
1517
super().__init__(master, *args, **kwargs)
1618

1719
self.grid(row=0, column=0, columnspan=2, pady=10, padx=10, sticky="ew")
1820

19-
self.device_path_label = CTkLabel(self, text='Device Path:')
20-
self.device_path_label.pack(side="left", padx=10, pady=10)
21-
self.device_path_label.configure(font=FONT_PATH)
21+
self.label = CTkLabel(self, text='Device Path:')
22+
self.label.pack(side="left", padx=10, pady=10)
2223

2324
reload_img = CTkImage(light_image=Image.open(RELOAD_ICON))
2425

25-
self.refresh = CTkButton(self, image=reload_img, text='', width=30)
26-
self.refresh.pack(side="right", padx=10, pady=10)
26+
self.reload_btn = CTkButton(self, image=reload_img, text='', width=30)
27+
self.reload_btn.pack(side="right", padx=10, pady=10)
2728

2829
self.device_option = CTkOptionMenu(self, width=150)
2930
self.device_option.pack(side="right", padx=10, pady=10)

0 commit comments

Comments
 (0)