Skip to content

Commit 38bee28

Browse files
committed
fine-tuning of changes for ui
1 parent 991f500 commit 38bee28

File tree

8 files changed

+35
-5
lines changed

8 files changed

+35
-5
lines changed

serial_plugin/serial_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _connect(self) -> bool:
4141
sleep(self._timeout)
4242
return True
4343
except Exception as err:
44-
error(f"[ERROR] connection missed: {err}")
44+
error(f"Connection to device missed: {err}")
4545
return False
4646

4747
def _disconnect(self) -> None:
@@ -72,7 +72,7 @@ def send_repl_command(self, command: str, wait: float = 0.3) -> str:
7272
sleep(wait)
7373

7474
output = self._ser.read_all().decode(errors='ignore')
75-
debug(f"[DEBUG] command output: {output}")
75+
debug(f"REPL returned output: {output}")
7676

7777
return output.strip()
7878

ui/base_ui.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class BaseUI(CTk):
1313
"""
1414
BaseUI is responsible for the overall layout and initialization of the graphical
15-
user interface (GUI). It manages the creation and configuration OS detection,
15+
user interface (GUI). It manages the creation and configuration of OS detection,
1616
Default Window settings and grid layout.
1717
"""
1818

@@ -26,6 +26,7 @@ def __init__(self):
2626
"""
2727
super().__init__()
2828

29+
debug('Checking operating system compatibility')
2930
self._current_platform = system()
3031
if self._current_platform not in OPERATING_SYSTEM:
3132
error(f'Unsupported operating system: {self._current_platform}')
@@ -35,6 +36,7 @@ def __init__(self):
3536
self._device_search_path = OPERATING_SYSTEM[self._current_platform]['device_path']
3637
self._firmware_search_path = OPERATING_SYSTEM[self._current_platform]['search_path']
3738

39+
debug('Setting default window and Grid settings')
3840
self.title(TITLE)
3941
self.resizable(False, False)
4042

@@ -55,9 +57,11 @@ def _block_text_input(event: Event) -> str:
5557
is_copy = (event.state & 0x000C) and event.keysym.lower() == 'c'
5658
is_select_all = (event.state & 0x000C) and event.keysym.lower() == 'a'
5759

60+
debug('Allow text select and copy')
5861
if is_copy or is_select_all:
5962
return ""
6063

64+
debug('Block text input')
6165
return "break"
6266

6367
def destroy(self) -> None:

ui/firmware_studio.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class MicroPythonFirmwareStudio(BaseUI):
2828
2929
Provides an interface to connect, configure, and flash firmware for ESP devices.
3030
Includes options to toggle expert mode and interact with device-specific details.
31-
32-
The class integrates multiple frames, to guide users through ESP device communication.
3331
"""
3432

3533
def __init__(self):
@@ -53,6 +51,7 @@ def __init__(self):
5351
on_complete=self._handle_esptool_complete
5452
)
5553

54+
debug('Adding frames to UI and configuring elements')
5655
# Search Device
5756
self.search_device = FrameSearchDevice(self)
5857
self.search_device.label.configure(font=FONT_PATH)
@@ -119,9 +118,11 @@ def __init__(self):
119118
self.console.console_text.tag_config("error", foreground=CONSOLE_ERROR)
120119
self.console.console_text.bind("<Key>", BaseUI._block_text_input)
121120

121+
debug('Searching for USB devices')
122122
# search for devices on the start
123123
self._search_devices()
124124

125+
debug('Starting console queue poll')
125126
# poll the console queue for new lines
126127
self._poll_console_queue()
127128

ui/frame_console.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
from logging import getLogger, debug
12
from customtkinter import CTkFrame, CTkLabel, CTkTextbox
23

34

5+
logger = getLogger(__name__)
6+
7+
48
class FrameConsole(CTkFrame):
59
"""
610
A specialized class designed to facilitate console output operations.
@@ -13,6 +17,7 @@ def __init__(self, master, *args, **kwargs):
1317
Label and a Textbox with customizable UI features.
1418
"""
1519
super().__init__(master, *args, **kwargs)
20+
debug('Create Console Frame')
1621

1722
self.grid(row=3, column=0, columnspan=2, pady=10, padx=10, sticky="nsew")
1823
self.grid_columnconfigure(0, weight=1)

ui/frame_device_information.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
from logging import getLogger, debug
12
from customtkinter import CTkFrame, CTkLabel, CTkButton
23

34

5+
logger = getLogger(__name__)
6+
7+
48
class FrameDeviceInformation(CTkFrame):
59
"""
610
A specialized class designed to facilitate device information operations.
@@ -13,6 +17,7 @@ def __init__(self, master, *args, **kwargs):
1317
Label and Button with customizable UI features.
1418
"""
1519
super().__init__(master, *args, **kwargs)
20+
debug('Create DeviceInformation Frame')
1621

1722
self.grid(row=1, column=0, padx=10, pady=5, sticky="nsew")
1823
self.grid_columnconfigure(0, weight=1)

ui/frame_erase_device.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
from logging import getLogger, debug
12
from customtkinter import CTkFrame, CTkLabel, CTkButton
23

34

5+
logger = getLogger(__name__)
6+
7+
48
class FrameEraseDevice(CTkFrame):
59
"""
610
A specialized class designed to facilitate flash erasing operations.
@@ -13,6 +17,7 @@ def __init__(self, master, *args, **kwargs):
1317
Label and a Button with customizable UI features.
1418
"""
1519
super().__init__(master, *args, **kwargs)
20+
debug('Create EraseDevice Frame')
1621

1722
self.grid(row=2, column=0, padx=10, pady=5, sticky="nsew")
1823
self.grid_columnconfigure(0, weight=1)

ui/frame_firmware_flash.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
from logging import getLogger, debug
12
from customtkinter import CTkFrame, CTkLabel, CTkSwitch, CTkOptionMenu, CTkCheckBox, CTkButton, CTkEntry
23
from tkinter import Canvas
34
from config.application_configuration import LINK_OBJECT
45
from config.device_configuration import (CONFIGURED_DEVICES, BAUDRATE_OPTIONS, FLASH_MODE_OPTIONS,
56
FLASH_FREQUENCY_OPTIONS, FLASH_SIZE_OPTIONS)
67

78

9+
logger = getLogger(__name__)
10+
11+
812
class FrameFirmwareFlash(CTkFrame):
913
"""
1014
A specialized class designed to facilitate firmware flashing operations.
@@ -18,6 +22,7 @@ def __init__(self, master, *args, **kwargs):
1822
customizable UI features.
1923
"""
2024
super().__init__(master, *args, **kwargs)
25+
debug('Create FirmwareFlash Frame')
2126

2227
self.grid(row=1, column=1, rowspan=2, padx=10, pady=5, sticky="nsew")
2328
self.grid_columnconfigure((0, 1, 2, 3, 4), weight=0)

ui/frame_search_device.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
from logging import getLogger, debug
12
from customtkinter import CTkFrame, CTkLabel, CTkImage, CTkButton, CTkOptionMenu
23
from PIL import Image
34
from config.application_configuration import RELOAD_ICON
45

56

7+
logger = getLogger(__name__)
8+
9+
610
class FrameSearchDevice(CTkFrame):
711
"""
812
A specialized class designed to facilitate search device operations.
@@ -15,6 +19,7 @@ def __init__(self, master, *args, **kwargs):
1519
Image, Button and an OptionMenu with customizable UI features.
1620
"""
1721
super().__init__(master, *args, **kwargs)
22+
debug('Create SearchDevice Frame')
1823

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

0 commit comments

Comments
 (0)