-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable use with
python -m
or pythonw -m
- Loading branch information
1 parent
51fd15b
commit eb76681
Showing
2 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" Enables support for calling entrypoints using `python -m` or `pythonw -m`. | ||
On windows using `pythonw -m pyqt6_tools designer` in a shortcut allows opening | ||
QtDesigner without showing a command prompt window that stays open the entire | ||
time that QtDesigner is open. | ||
""" | ||
|
||
|
||
import importlib | ||
import pathlib | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
# Relative imports don't work when called by `python -m ...`, get the name | ||
# of the parent folder so we can import entrypoints from it. This is needed | ||
# because the package name is not hard coded between PyQt versions. | ||
module_name = pathlib.Path(__file__).parent.stem | ||
entrypoints = importlib.import_module(f"{module_name}.entrypoints") | ||
|
||
sys.exit(entrypoints.main()) |