From 6a16837f31d241aab459a3bf1d294b24a835fdcf Mon Sep 17 00:00:00 2001 From: Romain Cassan Date: Fri, 7 May 2021 19:37:20 +0200 Subject: [PATCH] Add pyinstaller hook --- qt_material/__init__.py | 6 ++++++ qt_material/hook-qt_material.py | 19 +++++++++++++++++++ setup.py | 6 ++++++ 3 files changed, 31 insertions(+) create mode 100644 qt_material/hook-qt_material.py diff --git a/qt_material/__init__.py b/qt_material/__init__.py index 6fd9e5e..423e513 100644 --- a/qt_material/__init__.py +++ b/qt_material/__init__.py @@ -3,6 +3,7 @@ import sys import logging import base64 from xml.etree import ElementTree +from pathlib import Path from qt_material.resources import ResourseGenerator, RESOURCES_PATH GUI = True @@ -351,3 +352,8 @@ class QtStyleTools: button = getattr(self.dock_theme, f'pushButton_{color}') button.clicked.connect(self.set_color(parent, color)) + +# ---------------------------------------------------------------------- +def get_hook_dirs(): + package_folder = Path(__file__).parent + return [str(package_folder.absolute())] \ No newline at end of file diff --git a/qt_material/hook-qt_material.py b/qt_material/hook-qt_material.py new file mode 100644 index 0000000..dce666e --- /dev/null +++ b/qt_material/hook-qt_material.py @@ -0,0 +1,19 @@ +import qt_material +from pathlib import Path + +qt_material_path = Path(qt_material.__file__).parent + +fonts_path = qt_material_path / "fonts" +datas = [(str(fonts_path), "qt_material/fonts")] + +themes_path = qt_material_path / "themes" +datas += [(str(themes_path), "qt_material/themes")] + +dock_path = qt_material_path / "dock_theme.ui" +datas += [(str(dock_path), "qt_material")] + +template_path = qt_material_path / "material.css.template" +datas += [(str(template_path), "qt_material")] + +resources_path = qt_material_path / "resources" +datas += [(str(resources_path), "qt_material/resources")] diff --git a/setup.py b/setup.py index 5779eee..c195078 100644 --- a/setup.py +++ b/setup.py @@ -40,4 +40,10 @@ setup( 'Programming Language :: Python :: 3.7', ], + entry_points={ + "pyinstaller40": [ + "hook-dirs = qt_material:get_hook_dirs" + ] + }, + )