Skip to content

* Added log text box to see what has happened #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 27, 2025
Merged

Conversation

dcornewell
Copy link
Collaborator

@dcornewell dcornewell commented May 9, 2025

** This will show what is logged to the wcexport.log file.

  • Made the URL text wider
  • Added options to specify URL and username on commandline so re-running is easier ** ./wcexport.py [URL] [username]
  • If the user's login session expires, the next request will attempt to log in and resume
  • Improved UI responsiveness. Exiting will stop after the current chart
image

** This will show what is logged to the wcexport.log file.
* Made the URL text wider
* Added options to specify URL and username on commandline so re-running is easier
** ./wcexport.py [URL] [username]
* If the user's login session expires, the next request will attempt to log in and resume
@dcornewell dcornewell requested a review from Copilot May 9, 2025 19:06
@dcornewell dcornewell marked this pull request as ready for review May 9, 2025 19:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds new UI elements including a log text area along with support for widening the URL text box, and introduces command-line arguments for easier re-running.

  • Added command-line argument parsing for URL and username in wcexport.py.
  • Enhanced the UI in common.py with a scrolling log area, queue-based task processing, and improved export threading and progress updates.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
wcexport.py Adds argument parsing and initializes the UI with provided command-line arguments.
common.py Introduces a logging text area, refines widget layouts with sticky options, and improves multi-threading for export operations.

Using a mutable default argument (data={}) can lead to unexpected behavior.

Co-authored-by: Copilot <[email protected]>
@dcornewell dcornewell requested a review from Copilot May 9, 2025 19:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the WebChart Export Utility by adding a log text box, improving UI responsiveness, and allowing URL/username specification directly from the command line.

  • Added command-line argument parsing in wcexport.py
  • Improved the main window layout and logging mechanism via a new log text box in common.py
  • Added threading and a task queue to safely update the GUI from background threads during export

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
wcexport.py Integrates argparse for command-line URL and username input
common.py Updates GUI layout with sticky alignment, adds a log area, and improves threading with a queue for task handling during export

common.py Outdated
Comment on lines 602 to 618
self.queue.put(lambda: update_progress(idx, current, maxprogress))
try:
if self.fullExport:
getChart(current['pat_id'], current['filename'])
self.queue.put(lambda: self.log(str(current['urls'])))
getExternalUrls(current['filename'], current['urls'])
else:
downloadDocument(current['doc_id'], current['filename'])
except Warning as w:
self.queue.put(lambda: self.log(w))
if not tkm.askyesno(title='Warning',
message='{0}\n\nDo you want to continue the export?'.format(w)):
msg = 'Export Aborted Due To User Request'
break
except Exception as e:
self.queue.put(lambda: self.log(e))
self.queue.put(lambda: tkm.showerror(title='Fatal Error', message=e))
Copy link
Preview

Copilot AI May 9, 2025

Choose a reason for hiding this comment

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

Enqueueing lambda expressions inside a loop without binding the current loop variables may lead to late binding issues when the queued tasks are executed. Consider using default argument values in your lambda (e.g., lambda idx=idx, current=current, maxprogress=maxprogress: update_progress(idx, current, maxprogress)) to capture the intended values.

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updating code

@dcornewell dcornewell requested a review from george-jones May 9, 2025 19:12
@dcornewell dcornewell requested a review from Copilot May 11, 2025 02:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the WebChart Export Utility by adding a log text box for runtime diagnostics, widening the URL text box, and introducing command-line parameters for easier re-running and improved session handling.

  • Added argparse support in wcexport.py for URL and username arguments.
  • Enhanced the UI in common.py with a new logging area, sticky grid alignment, and a threaded export process with a UI queue.
  • Introduced re-login and export cancellation logic to improve responsiveness.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
wcexport.py Added command-line argument parsing and applied URL/username presetting in the UI.
common.py Updated several UI layouts (wider text fields, sticky grid layout), added a log text box and queue processing, and improved threading and export cancellation logic.

…o, set self.schedule so the error about that not being defined would stop.
@dcornewell dcornewell merged commit 6459687 into master May 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.

2 participants