From 9d5e1917bff2508f6530182864948d0651281d5c Mon Sep 17 00:00:00 2001 From: Pavel Sobolev Date: Tue, 26 Sep 2023 11:23:19 +0300 Subject: [PATCH] python3Packages.pyqtdarktheme: init at 2.1.0 --- ...ument-to-the-proxy-style-initializer.patch | 25 +++++++ .../python-modules/pyqtdarktheme/default.nix | 70 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 97 insertions(+) create mode 100644 pkgs/development/python-modules/pyqtdarktheme/add-missing-argument-to-the-proxy-style-initializer.patch create mode 100644 pkgs/development/python-modules/pyqtdarktheme/default.nix diff --git a/pkgs/development/python-modules/pyqtdarktheme/add-missing-argument-to-the-proxy-style-initializer.patch b/pkgs/development/python-modules/pyqtdarktheme/add-missing-argument-to-the-proxy-style-initializer.patch new file mode 100644 index 000000000000..9d77e2901bed --- /dev/null +++ b/pkgs/development/python-modules/pyqtdarktheme/add-missing-argument-to-the-proxy-style-initializer.patch @@ -0,0 +1,25 @@ +From 816afb6a3a6a340ae2a2a06dc054dd8e65ff9d8f Mon Sep 17 00:00:00 2001 +From: Pavel Sobolev +Date: Mon, 30 Oct 2023 20:42:31 +0300 +Subject: [PATCH] Add missing argument to the `proxy_style` initializer. + +--- + qdarktheme/_proxy_style.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/qdarktheme/_proxy_style.py b/qdarktheme/_proxy_style.py +index b1fb358..f04f01e 100644 +--- a/qdarktheme/_proxy_style.py ++++ b/qdarktheme/_proxy_style.py +@@ -14,7 +14,7 @@ class QDarkThemeStyle(QProxyStyle): + + def __init__(self): + """Initialize style proxy.""" +- super().__init__() ++ super().__init__(None) + + def standardIcon( # noqa: N802 + self, standard_icon: QStyle.StandardPixmap, option: QStyleOption | None, widget +-- +2.42.0 + diff --git a/pkgs/development/python-modules/pyqtdarktheme/default.nix b/pkgs/development/python-modules/pyqtdarktheme/default.nix new file mode 100644 index 000000000000..0d60c8039898 --- /dev/null +++ b/pkgs/development/python-modules/pyqtdarktheme/default.nix @@ -0,0 +1,70 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromGitHub + +, darkdetect +, poetry-core + +, pyqt5 +, pytest-mock +, pytest-qt +, pytestCheckHook +, qt5 +}: + +buildPythonPackage rec { + pname = "pyqtdarktheme"; + version = "2.1.0"; + pyproject = true; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "5yutan5"; + repo = "PyQtDarkTheme"; + rev = "v${version}"; + hash = "sha256-jK+wnIyPE8Bav0pzbvVisYYCzdRshYw1S2t0H3Pro5M="; + }; + + patches = [ + ./add-missing-argument-to-the-proxy-style-initializer.patch + ]; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + darkdetect + ]; + + nativeCheckInputs = [ + pyqt5 + pytest-mock + pytest-qt + pytestCheckHook + ]; + + pythonImportsCheck = [ + "qdarktheme" + ]; + + prePatch = '' + sed -i 's#darkdetect = ".*"#darkdetect = "*"#' pyproject.toml + ''; + + preCheck = '' + export HOME=$(mktemp -d) + export QT_PLUGIN_PATH="${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}" + export QT_QPA_PLATFORM_PLUGIN_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins"; + export QT_QPA_PLATFORM=offscreen + ''; + + meta = with lib; { + description = "A flat dark theme for PySide and PyQt"; + homepage = "https://pyqtdarktheme.readthedocs.io/en/stable"; + license = licenses.mit; + maintainers = with maintainers; [ paveloom ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 211844d068cd..b889e2778440 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11042,6 +11042,8 @@ self: super: with self; { setuptools sip; }; + pyqtdarktheme = callPackage ../development/python-modules/pyqtdarktheme { }; + pyqtdatavisualization = pkgs.libsForQt5.callPackage ../development/python-modules/pyqtdatavisualization { inherit (self) buildPythonPackage pyqt5 pyqt-builder python pythonOlder setuptools sip;