bec-qthemes 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. bec_qthemes-0.0.2/.gitignore +177 -0
  2. bec_qthemes-0.0.2/.gitlab-ci.yml +118 -0
  3. bec_qthemes-0.0.2/CHANGELOG.md +35 -0
  4. bec_qthemes-0.0.2/LICENSE.txt +24 -0
  5. bec_qthemes-0.0.2/PKG-INFO +21 -0
  6. bec_qthemes-0.0.2/README.md +3 -0
  7. bec_qthemes-0.0.2/bec_qthemes/__init__.py +47 -0
  8. bec_qthemes-0.0.2/bec_qthemes/_color.py +236 -0
  9. bec_qthemes-0.0.2/bec_qthemes/_icon/__init__.py +0 -0
  10. bec_qthemes-0.0.2/bec_qthemes/_icon/icon_engine.py +49 -0
  11. bec_qthemes-0.0.2/bec_qthemes/_icon/svg.py +75 -0
  12. bec_qthemes-0.0.2/bec_qthemes/_main.py +178 -0
  13. bec_qthemes-0.0.2/bec_qthemes/_os_appearance/__init__.py +1 -0
  14. bec_qthemes-0.0.2/bec_qthemes/_os_appearance/_accent/__init__.py +29 -0
  15. bec_qthemes-0.0.2/bec_qthemes/_os_appearance/_accent/_mac_detect.py +62 -0
  16. bec_qthemes-0.0.2/bec_qthemes/_os_appearance/listener.py +59 -0
  17. bec_qthemes-0.0.2/bec_qthemes/_proxy_style.py +35 -0
  18. bec_qthemes-0.0.2/bec_qthemes/_resources/__init__.py +12 -0
  19. bec_qthemes-0.0.2/bec_qthemes/_resources/colors.py +166 -0
  20. bec_qthemes-0.0.2/bec_qthemes/_resources/palette.py +123 -0
  21. bec_qthemes-0.0.2/bec_qthemes/_resources/standard_icons.py +82 -0
  22. bec_qthemes-0.0.2/bec_qthemes/_resources/stylesheets.py +4 -0
  23. bec_qthemes-0.0.2/bec_qthemes/_resources/svg.py +5 -0
  24. bec_qthemes-0.0.2/bec_qthemes/_style_loader.py +305 -0
  25. bec_qthemes-0.0.2/bec_qthemes/_template/__init__.py +0 -0
  26. bec_qthemes-0.0.2/bec_qthemes/_template/engine.py +85 -0
  27. bec_qthemes-0.0.2/bec_qthemes/_template/filter.py +87 -0
  28. bec_qthemes-0.0.2/bec_qthemes/_util.py +83 -0
  29. bec_qthemes-0.0.2/images/standard_icons.png +0 -0
  30. bec_qthemes-0.0.2/images/sync_with_os_accent.gif +0 -0
  31. bec_qthemes-0.0.2/images/sync_with_os_theme.gif +0 -0
  32. bec_qthemes-0.0.2/images/widget_gallery_dark.png +0 -0
  33. bec_qthemes-0.0.2/images/widget_gallery_dark_customizing.png +0 -0
  34. bec_qthemes-0.0.2/images/widget_gallery_dark_qpalette.png +0 -0
  35. bec_qthemes-0.0.2/images/widget_gallery_dark_sharp.png +0 -0
  36. bec_qthemes-0.0.2/images/widget_gallery_light.png +0 -0
  37. bec_qthemes-0.0.2/images/widget_gallery_light_sharp.png +0 -0
  38. bec_qthemes-0.0.2/pyproject.toml +92 -0
  39. bec_qthemes-0.0.2/style/README.md +130 -0
  40. bec_qthemes-0.0.2/style/base.qss +1334 -0
  41. bec_qthemes-0.0.2/style/colors/os_accent.json +22 -0
  42. bec_qthemes-0.0.2/style/colors/themes/dark.json +134 -0
  43. bec_qthemes-0.0.2/style/colors/themes/light.json +130 -0
  44. bec_qthemes-0.0.2/style/colors/themes/validate.json +451 -0
  45. bec_qthemes-0.0.2/style/palette.template.py +123 -0
  46. bec_qthemes-0.0.2/style/svg/material/arrow_drop_up.svg +1 -0
  47. bec_qthemes-0.0.2/style/svg/material/arrow_upward.svg +1 -0
  48. bec_qthemes-0.0.2/style/svg/material/calendar_today.svg +1 -0
  49. bec_qthemes-0.0.2/style/svg/material/cancel.svg +1 -0
  50. bec_qthemes-0.0.2/style/svg/material/check.svg +1 -0
  51. bec_qthemes-0.0.2/style/svg/material/check_box.svg +1 -0
  52. bec_qthemes-0.0.2/style/svg/material/check_box_outline_blank.svg +1 -0
  53. bec_qthemes-0.0.2/style/svg/material/check_circle.svg +1 -0
  54. bec_qthemes-0.0.2/style/svg/material/chevron_right.svg +1 -0
  55. bec_qthemes-0.0.2/style/svg/material/circle.svg +1 -0
  56. bec_qthemes-0.0.2/style/svg/material/cleaning_services.svg +1 -0
  57. bec_qthemes-0.0.2/style/svg/material/close.svg +1 -0
  58. bec_qthemes-0.0.2/style/svg/material/create_new_folder.svg +1 -0
  59. bec_qthemes-0.0.2/style/svg/material/delete.svg +1 -0
  60. bec_qthemes-0.0.2/style/svg/material/done_all.svg +1 -0
  61. bec_qthemes-0.0.2/style/svg/material/double_arrow.svg +1 -0
  62. bec_qthemes-0.0.2/style/svg/material/drag_handle.svg +1 -0
  63. bec_qthemes-0.0.2/style/svg/material/drag_indicator.svg +1 -0
  64. bec_qthemes-0.0.2/style/svg/material/drive_file_move.svg +1 -0
  65. bec_qthemes-0.0.2/style/svg/material/drive_file_move_rtl.svg +1 -0
  66. bec_qthemes-0.0.2/style/svg/material/east.svg +1 -0
  67. bec_qthemes-0.0.2/style/svg/material/expand_less.svg +1 -0
  68. bec_qthemes-0.0.2/style/svg/material/fast_forward.svg +1 -0
  69. bec_qthemes-0.0.2/style/svg/material/fast_rewind.svg +1 -0
  70. bec_qthemes-0.0.2/style/svg/material/flip_to_front.svg +1 -0
  71. bec_qthemes-0.0.2/style/svg/material/fullscreen.svg +1 -0
  72. bec_qthemes-0.0.2/style/svg/material/grid_view.svg +1 -0
  73. bec_qthemes-0.0.2/style/svg/material/help.svg +1 -0
  74. bec_qthemes-0.0.2/style/svg/material/home.svg +1 -0
  75. bec_qthemes-0.0.2/style/svg/material/horizontal_rule.svg +1 -0
  76. bec_qthemes-0.0.2/style/svg/material/indeterminate_check_box.svg +1 -0
  77. bec_qthemes-0.0.2/style/svg/material/info.svg +1 -0
  78. bec_qthemes-0.0.2/style/svg/material/launch.svg +1 -0
  79. bec_qthemes-0.0.2/style/svg/material/list.svg +1 -0
  80. bec_qthemes-0.0.2/style/svg/material/minimize.svg +1 -0
  81. bec_qthemes-0.0.2/style/svg/material/not_interested.svg +1 -0
  82. bec_qthemes-0.0.2/style/svg/material/pause.svg +1 -0
  83. bec_qthemes-0.0.2/style/svg/material/play_arrow.svg +1 -0
  84. bec_qthemes-0.0.2/style/svg/material/question_mark.svg +1 -0
  85. bec_qthemes-0.0.2/style/svg/material/radio_button_checked.svg +1 -0
  86. bec_qthemes-0.0.2/style/svg/material/radio_button_unchecked.svg +1 -0
  87. bec_qthemes-0.0.2/style/svg/material/refresh.svg +1 -0
  88. bec_qthemes-0.0.2/style/svg/material/restart_alt.svg +1 -0
  89. bec_qthemes-0.0.2/style/svg/material/save.svg +1 -0
  90. bec_qthemes-0.0.2/style/svg/material/search.svg +1 -0
  91. bec_qthemes-0.0.2/style/svg/material/security.svg +1 -0
  92. bec_qthemes-0.0.2/style/svg/material/skip_next.svg +1 -0
  93. bec_qthemes-0.0.2/style/svg/material/skip_previous.svg +1 -0
  94. bec_qthemes-0.0.2/style/svg/material/stop.svg +1 -0
  95. bec_qthemes-0.0.2/style/svg/material/visibility_off.svg +1 -0
  96. bec_qthemes-0.0.2/style/svg/material/volume_mute.svg +1 -0
  97. bec_qthemes-0.0.2/style/svg/material/volume_up.svg +1 -0
  98. bec_qthemes-0.0.2/style/svg/material_design_icons.json +54 -0
  99. bec_qthemes-0.0.2/style/svg/new_standard_icons.json +294 -0
  100. bec_qthemes-0.0.2/style/svg/original/vertical_line.svg +1 -0
  101. bec_qthemes-0.0.2/tests/test_color.py +122 -0
  102. bec_qthemes-0.0.2/tests/test_loading.py +4 -0
  103. bec_qthemes-0.0.2/tests/test_qdarktheme.py +115 -0
  104. bec_qthemes-0.0.2/tests/test_qdarktheme_with_qt.py +91 -0
  105. bec_qthemes-0.0.2/tests/test_svg.py +56 -0
  106. bec_qthemes-0.0.2/tests/test_template_engine.py +57 -0
  107. bec_qthemes-0.0.2/tests/test_util.py +51 -0
  108. bec_qthemes-0.0.2/tools/__init__.py +1 -0
  109. bec_qthemes-0.0.2/tools/_util.py +22 -0
  110. bec_qthemes-0.0.2/tools/build_styles/README.md +17 -0
  111. bec_qthemes-0.0.2/tools/build_styles/__main__.py +6 -0
  112. bec_qthemes-0.0.2/tools/build_styles/_main.py +241 -0
  113. bec_qthemes-0.0.2/tools/build_theme_color_doc/__init__.py +1 -0
  114. bec_qthemes-0.0.2/tools/build_theme_color_doc/__main__.py +6 -0
  115. bec_qthemes-0.0.2/tools/build_theme_color_doc/main.py +161 -0
  116. bec_qthemes-0.0.2/tools/build_theme_color_doc/theme_color.template.rst +41 -0
  117. bec_qthemes-0.0.2/tools/capture.py +47 -0
  118. bec_qthemes-0.0.2/tools/check_build_package.py +42 -0
  119. bec_qthemes-0.0.2/tools/material_icons.py +63 -0
@@ -0,0 +1,177 @@
1
+ **/*_venv
2
+ **/.idea
3
+ *.log
4
+ **/__pycache__
5
+ **/.DS_Store
6
+ **/out
7
+ **/.vscode
8
+ **/.pytest_cache
9
+ **/*.egg*
10
+
11
+ # file writer data
12
+ **.h5
13
+
14
+ # Byte-compiled / optimized / DLL files
15
+ __pycache__/
16
+ *.py[cod]
17
+ *$py.class
18
+
19
+ # C extensions
20
+ *.so
21
+
22
+ # Distribution / packaging
23
+ .Python
24
+ build/
25
+ develop-eggs/
26
+ dist/
27
+ downloads/
28
+ eggs/
29
+ .eggs/
30
+ lib/
31
+ lib64/
32
+ parts/
33
+ sdist/
34
+ var/
35
+ wheels/
36
+ share/python-wheels/
37
+ *.egg-info/
38
+ .installed.cfg
39
+ *.egg
40
+ MANIFEST
41
+
42
+ # PyInstaller
43
+ # Usually these files are written by a python script from a template
44
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
45
+ *.manifest
46
+ *.spec
47
+
48
+ # Installer logs
49
+ pip-log.txt
50
+ pip-delete-this-directory.txt
51
+
52
+ # Unit test / coverage reports
53
+ htmlcov/
54
+ .tox/
55
+ .nox/
56
+ .coverage
57
+ .coverage.*
58
+ .cache
59
+ nosetests.xml
60
+ coverage.xml
61
+ *.cover
62
+ *.py,cover
63
+ .hypothesis/
64
+ .pytest_cache/
65
+ cover/
66
+
67
+ # Translations
68
+ *.mo
69
+ *.pot
70
+
71
+ # Django stuff:
72
+ *.log
73
+ local_settings.py
74
+ db.sqlite3
75
+ db.sqlite3-journal
76
+
77
+ # Flask stuff:
78
+ instance/
79
+ .webassets-cache
80
+
81
+ # Scrapy stuff:
82
+ .scrapy
83
+
84
+ # Sphinx documentation
85
+ docs/**/_build/
86
+ docs/**/autodoc/
87
+ docs/**/_autosummary/
88
+
89
+ # PyBuilder
90
+ .pybuilder/
91
+ target/
92
+
93
+ # Jupyter Notebook
94
+ .ipynb_checkpoints
95
+
96
+ # IPython
97
+ profile_default/
98
+ ipython_config.py
99
+
100
+ **.prof
101
+
102
+ # pyenv
103
+ # For a library or package, you might want to ignore these files since the code is
104
+ # intended to run in multiple environments; otherwise, check them in:
105
+ .python-version
106
+
107
+ # pipenv
108
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
109
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
110
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
111
+ # install all needed dependencies.
112
+ #Pipfile.lock
113
+
114
+ # poetry
115
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
116
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
117
+ # commonly ignored for libraries.
118
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
119
+ #poetry.lock
120
+
121
+ # pdm
122
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
123
+ #pdm.lock
124
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
125
+ # in version control.
126
+ # https://pdm.fming.dev/#use-with-ide
127
+ .pdm.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule
134
+ celerybeat.pid
135
+
136
+ # SageMath parsed files
137
+ *.sage.py
138
+
139
+ # Environments
140
+ .env
141
+ .venv
142
+ env/
143
+ venv/
144
+ ENV/
145
+ env.bak/
146
+ venv.bak/
147
+
148
+ # Spyder project settings
149
+ .spyderproject
150
+ .spyproject
151
+
152
+ # Rope project settings
153
+ .ropeproject
154
+
155
+ # mkdocs documentation
156
+ /site
157
+
158
+ # mypy
159
+ .mypy_cache/
160
+ .dmypy.json
161
+ dmypy.json
162
+
163
+ # Pyre type checker
164
+ .pyre/
165
+
166
+ # pytype static type analyzer
167
+ .pytype/
168
+
169
+ # Cython debug symbols
170
+ cython_debug/
171
+
172
+ # PyCharm
173
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
174
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
175
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
176
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
177
+ #.idea/
@@ -0,0 +1,118 @@
1
+ # This file is a template, and might need editing before it works on your project.
2
+ # Official language image. Look for the different tagged releases at:
3
+ # https://hub.docker.com/r/library/python/tags/
4
+ image: $CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/python:3.11
5
+ #commands to run in the Docker container before starting each job.
6
+ variables:
7
+ DOCKER_TLS_CERTDIR: ""
8
+ BEC_CORE_BRANCH: "main"
9
+ OPHYD_DEVICES_BRANCH: "main"
10
+ CHILD_PIPELINE_BRANCH: $CI_DEFAULT_BRANCH
11
+
12
+ workflow:
13
+ rules:
14
+ - if: $CI_PIPELINE_SOURCE == "schedule"
15
+ - if: $CI_PIPELINE_SOURCE == "web"
16
+ - if: $CI_PIPELINE_SOURCE == "pipeline"
17
+ - if: $CI_PIPELINE_SOURCE == "parent_pipeline"
18
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
19
+ - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
20
+ when: never
21
+ - if: $CI_COMMIT_BRANCH
22
+
23
+ include:
24
+ - template: Security/Secret-Detection.gitlab-ci.yml
25
+ - project: "bec/awi_utils"
26
+ file: "/templates/check-packages-job.yml"
27
+ inputs:
28
+ stage: test
29
+ path: "."
30
+ pytest_args: "-v --random-order tests/"
31
+ exclude_packages: ""
32
+
33
+ # different stages in the pipeline
34
+ stages:
35
+ - Formatter
36
+ - test
37
+ - AdditionalTests
38
+ - End2End
39
+ - Deploy
40
+
41
+ .clone-repos: &clone-repos
42
+ - git clone --branch $BEC_CORE_BRANCH https://gitlab.psi.ch/bec/bec.git
43
+ - git clone --branch $OPHYD_DEVICES_BRANCH https://gitlab.psi.ch/bec/ophyd_devices.git
44
+ - export OHPYD_DEVICES_PATH=$PWD/ophyd_devices
45
+
46
+ .install-os-packages: &install-os-packages
47
+ - apt-get update
48
+ - apt-get install -y libgl1-mesa-glx libegl1-mesa x11-utils libxkbcommon-x11-0 libdbus-1-3
49
+
50
+ before_script:
51
+ - if [[ "$CI_PROJECT_PATH" != "bec/bec_qthemes" ]]; then
52
+ echo -e "\033[35;1m Using branch $CHILD_PIPELINE_BRANCH of BEC QThemes \033[0;m";
53
+ test -d bec_qthemes || git clone --branch $CHILD_PIPELINE_BRANCH https://gitlab.psi.ch/bec/bec_qthemes.git; cd bec_qthemes;
54
+ fi
55
+
56
+ formatter:
57
+ stage: Formatter
58
+ needs: []
59
+ script:
60
+ - pip install black isort
61
+ - isort --check --diff ./
62
+ - black --check --diff --color ./
63
+ rules:
64
+ - if: $CI_PROJECT_PATH == "bec/bec_qthemes"
65
+
66
+ tests:
67
+ parallel:
68
+ matrix:
69
+ - PYTHON_VERSION:
70
+ - "3.10"
71
+ - "3.11"
72
+ - "3.12"
73
+ QT_PCKG:
74
+ - "pyside6"
75
+ - "pyqt6"
76
+
77
+ stage: test
78
+ needs: []
79
+ variables:
80
+ QT_QPA_PLATFORM: "offscreen"
81
+ PYTHON_VERSION: ""
82
+ QT_PCKG: ""
83
+ image: $CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/python:$PYTHON_VERSION
84
+ script:
85
+ - *clone-repos
86
+ - *install-os-packages
87
+ - pip install $QT_PCKG
88
+ - pip install -e .[dev]
89
+ - pytest -v --junitxml=report.xml --random-order ./tests
90
+ allow_failure: false
91
+
92
+ semver:
93
+ stage: Deploy
94
+ needs: ["tests"]
95
+ script:
96
+ - git config --global user.name "ci_update_bot"
97
+ - git config --global user.email "ci_update_bot@bec.ch"
98
+ - git checkout "$CI_COMMIT_REF_NAME"
99
+ - git reset --hard origin/"$CI_COMMIT_REF_NAME"
100
+
101
+ # delete all local tags
102
+ - git tag -l | xargs git tag -d
103
+ - git fetch --tags
104
+ - git tag
105
+
106
+ # build and publish package
107
+ - pip install python-semantic-release==9.* wheel build twine
108
+ - export GL_TOKEN=$CI_UPDATES
109
+ - semantic-release -vv version
110
+
111
+ # check if any artifacts were created
112
+ - if [ ! -d dist ]; then echo No release will be made; exit 0; fi
113
+ - twine upload dist/* -u __token__ -p $CI_PYPI_TOKEN --skip-existing
114
+ - semantic-release publish
115
+
116
+ allow_failure: false
117
+ rules:
118
+ - if: '$CI_COMMIT_REF_NAME == "main" && $CI_PROJECT_PATH == "bec/bec_qthemes"'
@@ -0,0 +1,35 @@
1
+ # CHANGELOG
2
+
3
+ ## v0.0.2 (2024-07-22)
4
+
5
+ ### Fix
6
+
7
+ * fix: removed webengine deps ([`2b887ff`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/2b887ffabc6932ffc3b8518ba065223f828c2f88))
8
+
9
+ ## v0.0.1 (2024-07-22)
10
+
11
+ ### Ci
12
+
13
+ * ci: fixed install of qt deps ([`ae1eae3`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/ae1eae360cf23e95d81e91fb54b73ca659291d33))
14
+
15
+ * ci: fixed test job name ([`c1f83d2`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/c1f83d242e585e6be1aef7fdaf660fd3bb2fc38e))
16
+
17
+ * ci: fixed test stage and removed outdated jobs ([`a33e36d`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/a33e36d660501a4ac785762839872f19d44bd756))
18
+
19
+ ### Fix
20
+
21
+ * fix: fixed darkdetect dependency ([`93d3561`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/93d35616b6fc4198edc9c5de57e8c7272ecac454))
22
+
23
+ ### Unknown
24
+
25
+ * wip ([`e26f9a7`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/e26f9a7018d081eda25e0ca874afd2747a420ae7))
26
+
27
+ * Delete .python-version ([`f8b160a`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/f8b160a5a19ec28360d16980eb2c17d6c219a95a))
28
+
29
+ * wip ([`ca3f5ab`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/ca3f5abe631739357f91b0040a970a5781347956))
30
+
31
+ * wip ([`3683415`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/3683415238f9d928eacc11713c2658f642cf5ba9))
32
+
33
+ * init ([`c654127`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/c6541276953684d529bc97f91362f0b4c3a20481))
34
+
35
+ * Initial commit ([`9184bdd`](https://gitlab.psi.ch/bec/bec_qthemes/-/commit/9184bdde0f76e0a8af7806e266ea4643414f22f2))
@@ -0,0 +1,24 @@
1
+ The project is based on the PyQtDarktheme project with its original license:
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2021-2022 Yunosuke Ohsugi
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.3
2
+ Name: bec_qthemes
3
+ Version: 0.0.2
4
+ Summary: BEC Qt themes
5
+ Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_qthemes/issues
6
+ Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_qthemes
7
+ Project-URL: changelog, https://gitlab.psi.ch/bec/bec_qthemes/blob/main/CHANGELOG.md
8
+ License-File: LICENSE.txt
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Requires-Python: >=3.10
13
+ Requires-Dist: darkdetect~=0.8
14
+ Requires-Dist: qtpy~=2.4
15
+ Provides-Extra: dev
16
+ Requires-Dist: black~=24.0; extra == 'dev'
17
+ Requires-Dist: coverage~=7.0; extra == 'dev'
18
+ Requires-Dist: isort>=5.13.2,~=5.13; extra == 'dev'
19
+ Requires-Dist: pylint~=3.0; extra == 'dev'
20
+ Requires-Dist: pytest-qt~=4.4; extra == 'dev'
21
+ Requires-Dist: pytest-random-order~=1.1; extra == 'dev'
@@ -0,0 +1,3 @@
1
+ # BEC QThemes
2
+
3
+ This project is based on the [PyQtDarktheme](https://github.com/5yutan5/PyQtDarkTheme) project.
@@ -0,0 +1,47 @@
1
+ """PyQtDarkTheme - A flat dark theme for PySide and PyQt.
2
+
3
+ - Repository: https://github.com/5yutan5/PyQtDarkTheme
4
+ - Documentation: https://pyqtdarktheme.readthedocs.io
5
+
6
+
7
+ License Information
8
+ ===================
9
+
10
+ Material design icons
11
+ ---------------------
12
+
13
+ All svg files in PyQtDarkTheme is from Material design icons(which uses an Apache 2.0 license).
14
+
15
+ - Author: Google
16
+ - Site: https://fonts.google.com/icons
17
+ - Source: https://github.com/google/material-design-icons
18
+ - License: Apache License Version 2.0 | https://www.apache.org/licenses/LICENSE-2.0.txt
19
+
20
+ Modifications made to each files to change the icon color and angle and remove svg namespace.
21
+
22
+ The current Material design icons license summary can be viewed at:
23
+ https://github.com/google/material-design-icons/blob/master/LICENSE
24
+
25
+
26
+ QDarkStyleSheet(Source code)
27
+ ----------------------------
28
+
29
+ Qt stylesheets are originally fork of QDarkStyleSheet(MIT License).
30
+
31
+ - Author: Colin Duquesnoy
32
+ - Site: https://github.com/ColinDuquesnoy/QDarkStyleSheet
33
+ - Source: https://github.com/ColinDuquesnoy/QDarkStyleSheet
34
+ - License: MIT License | https://opensource.org/licenses/MIT
35
+
36
+ Modifications made to a file to change the style.
37
+
38
+ The current QDarkStyleSheet license summary can be viewed at:
39
+ https://github.com/ColinDuquesnoy/QDarkStyleSheet/blob/master/LICENSE.rst
40
+
41
+ """
42
+
43
+ # Version of PyQtDarkTheme
44
+ __version__ = "2.1.0"
45
+
46
+ from bec_qthemes._main import enable_hi_dpi, setup_theme, stop_sync
47
+ from bec_qthemes._style_loader import clear_cache, get_themes, load_palette, load_stylesheet
@@ -0,0 +1,236 @@
1
+ """Module for color code."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import colorsys
6
+ import math
7
+
8
+
9
+ def _round_float(number: float, decimal_points: int = 3) -> float:
10
+ decimal = 10**decimal_points
11
+ return round(number * decimal) / decimal
12
+
13
+
14
+ class _RGBA:
15
+ """Class handling RGBA color code."""
16
+
17
+ def __init__(self, r: int, g: int, b: int, a: float = 1) -> None:
18
+ """Initialize rgba value.
19
+
20
+ Args:
21
+ r: Red(0~255).
22
+ g: Green(0~255).
23
+ b: Blue(0~255).
24
+ a: Alpha(0~1). Defaults to 1.
25
+ """
26
+ self._r = min(255, max(0, r)) | 0
27
+ self._g = min(255, max(0, g)) | 0
28
+ self._b = min(255, max(0, b)) | 0
29
+ self._a = _round_float(max(min(1, a), 0))
30
+
31
+ def __str__(self) -> str:
32
+ """Format RGBA class.
33
+
34
+ e.g. rgba(100, 100, 100, 0.5).
35
+ """
36
+ return f"rgba({self.r}, {self.g}, {self.b}, {self.a:.3f})"
37
+
38
+ def __getitem__(self, item: int) -> int | float:
39
+ """Unpack to (r, g, b, a)."""
40
+ return [self.r, self.g, self.b, self.a][item]
41
+
42
+ def __eq__(self, other: _RGBA) -> bool:
43
+ """Returns true if `r`, `g`, `b` and `a` are all the same."""
44
+ return [self.r, self.g, self.b, self.a] == [other.r, other.g, other.b, other.a]
45
+
46
+ @property
47
+ def r(self) -> int:
48
+ return self._r
49
+
50
+ @property
51
+ def g(self) -> int:
52
+ return self._g
53
+
54
+ @property
55
+ def b(self) -> int:
56
+ return self._b
57
+
58
+ @property
59
+ def a(self) -> float:
60
+ return self._a
61
+
62
+
63
+ class _HSLA:
64
+ def __init__(self, h: int, s: float, l: float, a: float = 1) -> None: # noqa: E741
65
+ self._h = max(min(360, h), 0) | 0
66
+ self._s = _round_float(max(min(1, s), 0))
67
+ self._l = _round_float(max(min(1, l), 0))
68
+ self._a = _round_float(max(min(1, a), 0))
69
+
70
+ def __eq__(self, other: _HSLA) -> bool:
71
+ """Returns true if `h`, `s`, `l` and `a` are all the same."""
72
+ return [self.h, self.s, self.l, self.a] == [other.h, other.s, other.l, other.a]
73
+
74
+ @property
75
+ def h(self) -> int:
76
+ return self._h
77
+
78
+ @property
79
+ def s(self) -> float:
80
+ return self._s
81
+
82
+ @property
83
+ def l(self) -> float: # noqa: E741, E743
84
+ return self._l
85
+
86
+ @property
87
+ def a(self) -> float:
88
+ return self._a
89
+
90
+ @staticmethod
91
+ def from_rgba(rgba: _RGBA) -> _HSLA:
92
+ hls = colorsys.rgb_to_hls(rgba.r / 255, rgba.g / 255, rgba.b / 255)
93
+ return _HSLA(int(hls[0] * 360), hls[2], hls[1], rgba.a)
94
+
95
+ def to_rgba(self) -> _RGBA:
96
+ rgb = colorsys.hls_to_rgb(self.h / 360, self.l, self.s)
97
+ return _RGBA(round(rgb[0] * 255), round(rgb[1] * 255), round(rgb[2] * 255), self.a)
98
+
99
+
100
+ class Color:
101
+ """Class handling color code(RGBA and HSLA)."""
102
+
103
+ def __init__(self, color_code: _RGBA | _HSLA) -> None:
104
+ """Initialize color code."""
105
+ self._hsla, self._hsva = None, None
106
+ if isinstance(color_code, _RGBA):
107
+ self._rgba = color_code
108
+ elif isinstance(color_code, _HSLA):
109
+ self._hsla = color_code
110
+ self._rgba = self._hsla.to_rgba()
111
+
112
+ @property
113
+ def rgba(self) -> _RGBA:
114
+ """Return rgba."""
115
+ return self._rgba
116
+
117
+ @property
118
+ def hsla(self) -> _HSLA:
119
+ """Return hsla."""
120
+ return self._hsla if self._hsla else _HSLA.from_rgba(self.rgba)
121
+
122
+ def __str__(self) -> str:
123
+ """Format Color class.
124
+
125
+ e.g. rgba(100, 100, 100, 0.5).
126
+ """
127
+ return str(self.rgba)
128
+
129
+ @staticmethod
130
+ def _check_hex_format(hex_format: str) -> None:
131
+ """Check if string is hex format."""
132
+ try:
133
+ hex = hex_format.lstrip("#")
134
+ if not len(hex) in (3, 4, 6, 8):
135
+ raise ValueError
136
+ int(hex, 16)
137
+ except ValueError:
138
+ raise ValueError(
139
+ f'invalid hex color format: "{hex_format}". '
140
+ "Only support following hexadecimal notations: #RGB, #RGBA, #RRGGBB and #RRGGBBAA. "
141
+ "R (red), G (green), B (blue), and A (alpha) are hexadecimal characters "
142
+ "(0-9, a-f or A-F)."
143
+ ) from None
144
+
145
+ @staticmethod
146
+ def from_rgba(r: int, g: int, b: int, a: int) -> Color:
147
+ """Convert rgba to Color object."""
148
+ rgba = _RGBA(r, g, b, a / 255)
149
+ return Color(rgba)
150
+
151
+ @staticmethod
152
+ def from_hex(hex: str) -> Color:
153
+ """Convert hex string to Color object.
154
+
155
+ Args:
156
+ color_hex: Color hex string.
157
+
158
+ Returns:
159
+ Color: Color object converted from hex.
160
+ """
161
+ Color._check_hex_format(hex)
162
+ hex = hex.lstrip("#")
163
+ r, g, b, a = 255, 0, 0, 1
164
+ if len(hex) == 3: # #RGB format
165
+ r, g, b = (int(char, 16) for char in hex)
166
+ r, g, b = 16 * r + r, 16 * g + g, 16 * b + b
167
+ if len(hex) == 4: # #RGBA format
168
+ r, g, b, a = (int(char, 16) for char in hex)
169
+ r, g, b = 16 * r + r, 16 * g + g, 16 * b + b
170
+ a = (16 * a + a) / 255
171
+ if len(hex) == 6: # #RRGGBB format
172
+ r, g, b = bytes.fromhex(hex)
173
+ a = 1
174
+ elif len(hex) == 8: # #RRGGBBAA format
175
+ r, g, b, a = bytes.fromhex(hex)
176
+ a = a / 255
177
+ return Color(_RGBA(r, g, b, a))
178
+
179
+ def _to_hex(self) -> str:
180
+ """Convert Color object to hex(#RRGGBBAA).
181
+
182
+ Args:
183
+ color: Color object.
184
+
185
+ Returns:
186
+ str: Hex converted from Color object.
187
+ """
188
+ r, g, b, a = self.rgba.r, self.rgba.g, self.rgba.b, self.rgba.a
189
+ hex_color = f"{math.floor(r):02x}{math.floor(g):02x}{math.floor(b):02x}"
190
+ if a != 1:
191
+ hex_color += f"{math.floor(a*255):02x}"
192
+ return hex_color
193
+
194
+ def to_hex_argb(self) -> str:
195
+ """Convert Color object to hex(#AARRGGBB).
196
+
197
+ Args:
198
+ color: Color object.
199
+
200
+ Returns:
201
+ str: Hex converted from Color object.
202
+ """
203
+ r, g, b, a = self.rgba.r, self.rgba.g, self.rgba.b, self.rgba.a
204
+ hex_color = "" if a == 1 else f"{math.floor(a*255):02x}"
205
+ hex_color += f"{math.floor(r):02x}{math.floor(g):02x}{math.floor(b):02x}"
206
+ return hex_color
207
+
208
+ def to_svg_tiny_color_format(self) -> str:
209
+ """Convert Color object to string for svg.
210
+
211
+ QtSvg does not support #RRGGBBAA format.
212
+ Therefore, we need to set the alpha value to `fill-opacity` instead.
213
+
214
+ Returns:
215
+ str: RGBA format.
216
+ """
217
+ r, g, b, a = self.rgba
218
+ if a == 1:
219
+ return f'fill="#{self._to_hex()}"'
220
+ return f'fill="rgb({r},{g},{b})" fill-opacity="{a}"'
221
+
222
+ def lighten(self, factor: float) -> Color:
223
+ """Lighten color."""
224
+ return Color(
225
+ _HSLA(self.hsla.h, self.hsla.s, self.hsla.l + self.hsla.l * factor, self.hsla.a)
226
+ )
227
+
228
+ def darken(self, factor: float) -> Color:
229
+ """Darken color."""
230
+ return Color(
231
+ _HSLA(self.hsla.h, self.hsla.s, self.hsla.l - self.hsla.l * factor, self.hsla.a)
232
+ )
233
+
234
+ def transparent(self, factor: float) -> Color:
235
+ """Make color transparent."""
236
+ return Color(_RGBA(self.rgba.r, self.rgba.g, self.rgba.b, self.rgba.a * factor))
File without changes