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

Disconnect path detection from classes.info #2419

Merged
merged 5 commits into from
Dec 13, 2018

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Dec 1, 2018

I detail in #2418 an issue caused by OpenShot importing classes.info differently in launch.py than it does in other modules. When running from an installed openshot_qt Python package, this causes two instances of the info module to exist in memory (one imported as openshot_qt.classes.info, the other imported as classes.info after the openshot_qt dir is added to sys.path), and prevents the passing of data from launch.py to the rest of OpenShot by storing it in classes.info variables.

This change adds a src/__init__.py file which has only one purpose: To perform the path-detection duties that allow launch.py to add the openshot_qt directory to sys.path, after which point it can then use from classes import info to import the same classes.info instance that all the rest of the code will be using. Data can thus be passed from class to class using variables stored in classes.info. Specifically, this makes the --lang command-line option function in an installed openshot-qt the same way it does when running in the AppImage or from the source tree.

I've tested this in the installed and running-from-the-source tree scenarios, and encountered no problems, nor do I expect there will be any. The __init__.py file should have no effect anywhere other than the system-installed case, since all it does (even if it ends up being executed) is create a single variable and store the detected path to the OpenShot Python code there. (It's launch.py that handles updating sys.path, still.)

Fixes #2418

@DylanC
Copy link
Collaborator

DylanC commented Dec 13, 2018

@ferdnyc - LGTM! 👍

@DylanC DylanC merged commit 2a6ec68 into OpenShot:develop Dec 13, 2018
@ferdnyc ferdnyc deleted the info-manages-path branch December 13, 2018 10:32
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