Skip to content

Conversation

@amalladi017
Copy link
Collaborator

@amalladi017 amalladi017 commented Sep 27, 2025

Fixes #344

What was changed?
The main application UI logic was refactored out of main.py into dedicated modules under the ui/ folder. Files created include root_window.py, menu_bar.py, welcome_screen.py, and commands.py, each handling a distinct part of the interface.

Why was it changed?
The previous main.py was too large and mixed UI layout with application logic. This change improves modularity, readability, and maintainability, and prepares the codebase for future extensions or testing.

How was it changed?

  • Created ui/root_window.py to isolate the CTk root window logic
  • Moved menu setup to ui/menu_bar.py
  • Moved welcome screen buttons and layout to ui/welcome_screen.py
  • Centralized button and menu callbacks into ui/commands.py
  • Updated main.py to simply coordinate initialization and startup

I followed PEP8 style conventions, enforced with Pylint 3.0, and resolved all violations related to import order, naming, trailing whitespace, and missing docstrings. Where needed, I suppressed warnings only with justification.

@amalladi017 amalladi017 linked an issue Sep 27, 2025 that may be closed by this pull request
4 tasks
Copy link
Collaborator

@Mathieu25900 Mathieu25900 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job improving the UI code by modifying the current and temporary file path of main.py. This simplifies the logic, makes it simpler to maintain and fix. When the global state is updated, it makes the logic easier to debug.

Copy link
Collaborator

@Jahnavidarisetti Jahnavidarisetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’ve greatly enhanced the clarity and separation of concerns in the project. The main entry point is now much cleaner and easier to follow, with all event handlers and UI construction logic moved out to purpose specific files.

Testing across UI platforms is required.

@@ -0,0 +1,26 @@
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job extracting this logic into a dedicated module. This improves separation of concerns and makes the main entry point cleaner. Consider adding or expanding unit tests for these newly isolated functions if feasible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly, once we have the RFID scanners I'll be able to test them fully.

Copy link
Contributor

@kungfuchicken kungfuchicken Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amalladi017 Just to clarify, what @Jahnavidarisetti is referring to is automated unit testing, not manual testing with hardware. We can run automated unit tests quickly and frequently without hardware attached. This may require creating additional software components to enable this, such as a mock, a virtual version of the hardware that provides fake inputs useful for automated testing.

Check out these resource for extra details:

)


def build_menu(root, experiments_frame, rfid_serial_port_controller):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring provides clear context on the purpose and usage of the function. Please ensure that parameter and return value types are also specified where relevant, especially as the codebase grows.

@@ -0,0 +1,115 @@
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work centralizing all UI command callbacks in this module! Organizing the event handlers here makes the codebase much more maintainable and easier to follow. The clear docstrings and consistent structure add to the readability this is a solid improvement to the project.

@Mathieu25900
Copy link
Collaborator

When I ran main, there was no issue. The program worked for me

@kungfuchicken
Copy link
Contributor

@Jahnavidarisetti I noticed there are some new commits, but it's still unmerged. Were all your requirements met?

@Jahnavidarisetti Jahnavidarisetti merged commit c6bb15a into main Oct 14, 2025
5 checks passed
amalladi017 pushed a commit that referenced this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor UI Logic

5 participants