anki/qt/aqt/BUILD.bazel
Matthias Metelka 0c340c4f74
Add comments to Sass variables and tweak main window (#2137)
* Prevent multiple inclusion of variables in CSS files

* Use dict instead of tuple for variables

* Add comments to variables

* Improve appearance of main window

* Tweak main window styles

* Use json.dumps over pprint.format

* Make study button primary

* Improve header margin

* Make bottom toolbar slimmer

* Make congrats page more balanced

* Fix type issue

* Replace day/night with light/dark

* Exclude top-level-drag-row from hover effect

* Create dataclass for variables

* Run formatter

* Apply CSS variables from Python side

Why go full-circle with the Sass variables? This way we only need one interface for add-on authors to interact with. It also makes it easier for us to apply additional themes in the future.

* Fix typing

* Fix rgba values in Qt

* Darken button background

* Fix palette not being applied in light theme

For some odd reason this problem arose much later than #2016.

* Tweak default button look

* Reformat

* Apply CSS vars to ts pages

* Include elevation in button_mixins_lib

* Cast opacity to int

* Add some margin to studiedToday info

* Tweak light theme button gradient

* Tweak highlight-bg for light theme

* Add back default button color

as it made the browser sidebar tool icons dark in light theme.

* Reformat

* Tweak light theme buttons once more

Sorry for the back-and-forth. Sass only compiles when there are changes in user files, not when I only change the vars.

* Fix bottom toolbar button indicators

* Make buttons more clicky

* Fix button padding

* Handle macOS separately again

* Decrease elevation effect for main window buttons to 1

* Imitate box-shadow for Qt elements

* Adjust shadow vars

* Adjust primary border color

because the save button in the deck options had a lighter color than its background gradient.

* Boost box-shadow color of primary buttons

* Format

* Adjust Qt box-shadow imitation and shadow colors

* Use more subtle default shadow color

* Add some more padding to top toolbar

* Revert "Apply CSS vars to ts pages"

This reverts commit 5d8e7f6b7ffc8894b6517ecbb8cfba35407fc69a.

* Revert "Apply CSS variables from Python side"

This reverts commit 87db774412fd2bfd75e2630d2c5e782daef96b5f.

* Better match the standard macOS buttons

In the dark theme the standard color is a lighter grey, but at least
the size/shape is similar again.

This doesn't work for the editor buttons.

* Reduce the top margin of the congrats screen

* Fix illegible buttons when changing theme on macOS; match dark button style
2022-10-29 10:48:53 +10:00

152 lines
3.2 KiB
Python

load("@rules_python//python:defs.bzl", "py_library")
load("@py_deps//:requirements.bzl", "requirement")
load("@rules_python//python:packaging.bzl", "py_package", "py_wheel")
load("//:defs.bzl", "anki_version")
load("//ts:copy.bzl", "copy_files_into_group")
genrule(
name = "hooks_gen",
outs = ["hooks_gen.py"],
cmd = "$(location //qt:genhooks_gui) $@",
tools = ["//qt:genhooks_gui"],
)
genrule(
name = "extract_sass_vars",
srcs = [
"//sass:_root-vars.css",
],
outs = [
"colors.py",
"props.py",
],
cmd = "$(location //qt:extract_sass_vars) $(SRCS) $(OUTS)",
tools = [
"//qt:extract_sass_vars",
],
)
py_library(
name = "colors",
srcs = [":colors.py"],
visibility = ["//qt:__subpackages__"],
)
_py_srcs = glob(
[
"**/*.py",
],
exclude = ["hooks_gen.py"],
)
_py_srcs_and_forms = _py_srcs + [
"//qt/aqt/forms:forms",
]
aqt_core_data = [
"colors.py",
"props.py",
"py.typed",
":hooks_gen",
]
aqt_deps = [
requirement("protobuf"),
requirement("decorator"),
requirement("requests"),
requirement("beautifulsoup4"),
requirement("flask"),
requirement("flask-cors"),
requirement("waitress"),
requirement("send2trash"),
requirement("jsonschema"),
] + select({
"@bazel_tools//src/conditions:host_windows": [
requirement("psutil"),
requirement("pywin32"),
requirement("winrt"),
],
"//conditions:default": [],
})
# library without web/i18n data; faster for testing
py_library(
name = "aqt_without_data",
srcs = _py_srcs_and_forms,
data = aqt_core_data,
visibility = ["//visibility:public"],
deps = aqt_deps + [
"@pyqt6",
],
)
py_library(
name = "aqt_with_data",
srcs = _py_srcs_and_forms,
data = aqt_core_data + ["//qt/aqt/data"],
visibility = ["//visibility:public"],
deps = aqt_deps,
)
py_package(
name = "aqt_pkg",
packages = [
"qt.aqt",
],
deps = [
":aqt_with_data",
],
)
py_wheel(
name = "wheel",
description_file = "wheel_description.txt",
distribution = "aqt",
entry_points = {
"console_scripts": ["anki = aqt:run"],
},
extra_requires = {
"qt5": [
"pyqt5>=5.14",
"pyqtwebengine",
],
"qt6": [
"pyqt6>=6.2",
"pyqt6-webengine>=6.2",
],
},
homepage = "https://apps.ankiweb.net",
license = "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
python_tag = "py3",
requires = [
"beautifulsoup4",
"requests",
"send2trash",
"jsonschema",
"flask",
"flask_cors",
"waitress",
'psutil; sys.platform == "win32"',
'pywin32; sys.platform == "win32"',
'winrt; sys.platform == "win32"',
"anki==" + anki_version,
],
strip_path_prefixes = [
"qt/",
],
tags = ["manual"],
version = anki_version,
visibility = ["//visibility:public"],
deps = [
":aqt_pkg",
],
)
filegroup(
name = "py_source_files",
srcs = _py_srcs,
visibility = [
"//qt:__subpackages__",
],
)