Skip to content

Conversation

@gmmcosta15
Copy link
Collaborator

Description

Select the type:

  • Feature
  • Bug fix
  • Code refactor
  • Documentation

BlocksScreen/lib/files.py:

  • Refactored directory/file handling architecture:
    1. On WebSocket connection: requests the full file list once via initial_load()
    2. On notify_filelist_changed: updates internal state incrementally
    3. Emits signals for UI components to react to changes
  • Added comments throughout the code

BlocksScreen/lib/panels/mainWindow.py:

  • Handle metadata missing errors and limit retries (timeout after 3 attempts per file)
  • Added comments to clarify logic

BlocksScreen/lib/panels/widgets/filesPage.py:

  • Reacts to changes from files.py and adapts the EntryListModel accordingly
  • Added “USB” icon to folders that start with USB-<name>
  • Added comments throughout the code

BlocksScreen/lib/utils/list_model.py:

  • Added method remove_item_by_text
  • Added method insert_item to insert an item at a specific index

Motivation

This refactor improves the file list handling flow by separating full initial loading from incremental updates, which leads to better

  • Modular Design and avoids unnecessary UI refreshes. It also introduces controlled retry logic for missing metadata, enhancing
  • Reliability, and makes the UI clearer by displaying a USB icon for USB‑related folders, improving
  • User Experience. Alongside these functional improvements, the changes enhance
  • Readability and Extensibility of the codebase by organizing logic more cleanly and adding comments throughout the affected modules.

Tests

Tested on RF50,
Missing Unit and Integration Tests,

Future work

Creating unit and integration tests, and handle of the root_update method called when the gcodes folder is changed

@gmmcosta15 gmmcosta15 requested a review from HugoCLSC January 27, 2026 17:41
@gmmcosta15 gmmcosta15 self-assigned this Jan 27, 2026
@gmmcosta15 gmmcosta15 added Refactor Enhancing code's readability, maintainability, and extensibility while addressing technical debt. enhancement New feature or request. labels Jan 27, 2026
@gmmcosta15 gmmcosta15 changed the title refactor files list behaviour, added USB icons and handling when the … Refactor: File managem system Jan 27, 2026
@gmmcosta15 gmmcosta15 changed the title Refactor: File managem system Refactor: File Management System Jan 27, 2026
@gmmcosta15 gmmcosta15 marked this pull request as draft January 28, 2026 16:40
Guilherme Costa and others added 2 commits January 29, 2026 11:11
…duced, in case of not loading the thumbnail of a file always shows the blocksthumbnail file
@gmmcosta15 gmmcosta15 marked this pull request as ready for review January 29, 2026 11:14
@gmmcosta15 gmmcosta15 changed the title Refactor: File Management System Refactor the File Management System Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request. Refactor Enhancing code's readability, maintainability, and extensibility while addressing technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants