Skip to content
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

Relocate libopenshot.log recovery code to exceptions.py #3839

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Nov 16, 2020

The MainWindow method create_lock_file(), of all things, has been repeatedly flagged as a high-complexity function. (One of four in windows.main_window, the remaining three being MainWindow's findAllMarkerPositions, keyPressEvent, and most disturbing of all, __init__.)

In the case of create_lock_file(), the complexity came about because, right in the middle of doing its job (creating a lock file), it went off on this long, completely-unrelated tangent where it would parse the end of the last session in libopenshot.log looking for stack traces.

Since that has nothing to do with creating a lock file, I pulled that entire tangential block of code, plus the tail_file() function it (exclusively) made use of, out of windows.main_window entirely. Instead I converted them both to functions in classes.exceptions. (Not a perfect spot, but a much better one.)

Theoretically now, exceptions.libopenshot_crash_recovery() could even be called by app.py instead. Like it probably should be.

(There's still too much stuff in MainWindow that's really application-startup stuff, IMHO. I'd remind any skeptics that, again, MainWindow.__init__() is flagged for excessive complexity...)

@jonoomph
Copy link
Member

LGTM!

@jonoomph jonoomph merged commit 1d2d469 into OpenShot:develop Jan 27, 2021
@ferdnyc ferdnyc deleted the move-crash-recovery branch January 7, 2022 02:28
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