Disconnect path detection from classes.info #2419
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I detail in #2418 an issue caused by OpenShot importing
classes.info
differently inlaunch.py
than it does in other modules. When running from an installedopenshot_qt
Python package, this causes two instances of theinfo
module to exist in memory (one imported asopenshot_qt.classes.info
, the other imported asclasses.info
after theopenshot_qt
dir is added tosys.path
), and prevents the passing of data fromlaunch.py
to the rest of OpenShot by storing it inclasses.info
variables.This change adds a
src/__init__.py
file which has only one purpose: To perform the path-detection duties that allowlaunch.py
to add theopenshot_qt
directory tosys.path
, after which point it can then usefrom classes import info
to import the sameclasses.info
instance that all the rest of the code will be using. Data can thus be passed from class to class using variables stored inclasses.info
. Specifically, this makes the--lang
command-line option function in an installedopenshot-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'slaunch.py
that handles updatingsys.path
, still.)Fixes #2418