Skip to content

Fix GUI progress bars with thread-safe updates and better responsiveness - #250

Open
shymega wants to merge 3 commits into
devfrom
shymega/fix-delay-prepare
Open

Fix GUI progress bars with thread-safe updates and better responsiveness#250
shymega wants to merge 3 commits into
devfrom
shymega/fix-delay-prepare

Conversation

@shymega

@shymega shymega commented Mar 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Fixes thread-safety issues in progress bar GUIs that could cause freezing or unresponsive UI
  • Reduces update interval from 1000ms to 100ms for smoother progress feedback
  • Adds human-readable file sizes (KB, MB, GB) to download progress display
  • Adds progress bar when copying WeMod data directory

@shymega
shymega requested a review from marvin1099 March 7, 2026 22:19
@shymega shymega self-assigned this Mar 7, 2026
@shymega
shymega changed the base branch from main to dev March 7, 2026 22:26
@shymega
shymega force-pushed the shymega/fix-delay-prepare branch from 7453f96 to b1b8251 Compare March 7, 2026 22:29
@marvin1099

Copy link
Copy Markdown
Collaborator

Seems good.
Can be merged after testing, or did you finish testing?

@shymega

shymega commented Mar 10, 2026

Copy link
Copy Markdown
Member Author

Seems good. Can be merged after testing, or did you finish testing?

Tested once, but want to do some more under different test cases. I'll do that this weekend.

@shymega
shymega force-pushed the shymega/fix-delay-prepare branch 2 times, most recently from 57d7c3b to 10c0e80 Compare March 20, 2026 20:37
@marvin1099

Copy link
Copy Markdown
Collaborator

Seams good adding "test me" just in case not tested jet (to a level you want).
Can of course be removed if the testing was satisfatory.
After that merging shuld be good.

@marvin1099 marvin1099 added the test me Added to PRs that look merge‑ready, but still clone and test the code to confirm expected behavior. label Mar 31, 2026
@shymega

shymega commented Mar 31, 2026

Copy link
Copy Markdown
Member Author

Yeah, I haven't tested it yet on a handheld - see #249 (comment) - but on my main workstation it seems intermittently working. The GUI bars don't always appear. It's strange.

Comment thread src/mainutils.py
@shymega

shymega commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the progress tracking and GUI responsiveness for file operations, including downloads, copying, zipping, and unpacking. It introduces a thread-safe status-sharing mechanism between worker threads and the GUI loop, a utility for human-readable file sizes, and a new copytree_with_progress function. The review feedback identifies a critical race condition in the update_status helper that could lead to runtime errors, suggests optimizing the GUI thread by removing redundant text updates, and recommends improving the user experience by providing feedback during the directory scanning phase.

Comment thread src/mainutils.py Outdated
Comment thread src/mainutils.py
Comment thread src/mainutils.py
@shymega
shymega force-pushed the shymega/fix-delay-prepare branch from 10c0e80 to 2ea7755 Compare May 2, 2026 22:42
@shymega
shymega force-pushed the shymega/fix-delay-prepare branch from 2ea7755 to b008987 Compare May 11, 2026 23:56
shymega and others added 3 commits May 15, 2026 00:26
- Add format_size() helper to convert bytes to KB/MB/GB/TB
- Display progress as "45% (12.5 MB / 27.8 MB)" instead of raw bytes
- Increase text element width to accommodate formatted sizes
- Reduce update interval from 1000ms to 100ms for smoother progress
- Rename update_log to update_status for clarity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use thread-safe status list for progress updates instead of
  calling GUI methods directly from background threads
- Move GUI updates to main event loop for reliable display
- Fix swapped window titles in copy_folder_with_progress
  (was showing "Copying Prefix" for zip and vice versa)
- Reduce update interval from 1000ms to 100ms for smoother progress
- Add proper text element sizing for progress display

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add new copytree_with_progress() function in mainutils.py with
  thread-safe GUI progress updates
- Replace shutil.copytree calls in syncwemod() with the new function
- Shows "Copying WeMod Data" window with progress bar during sync
- Handles destination directory creation automatically

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shymega
shymega force-pushed the shymega/fix-delay-prepare branch from b008987 to aa114eb Compare May 14, 2026 23:27
@shymega

shymega commented May 14, 2026

Copy link
Copy Markdown
Member Author

@marvin1099 This is ready for review/merge now.

@marvin1099 marvin1099 added pickup for v2 pickup or re-examine task or change in v2 and removed test me Added to PRs that look merge‑ready, but still clone and test the code to confirm expected behavior. labels Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pickup for v2 pickup or re-examine task or change in v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants