mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 00:12:25 -04:00
Use json.dumps over pprint.format
This commit is contained in:
parent
0645aef8c6
commit
94e398fd2f
4 changed files with 5 additions and 7 deletions
|
@ -49,7 +49,7 @@ class CellRow:
|
||||||
) -> None:
|
) -> None:
|
||||||
self.refreshed_at: float = time.time()
|
self.refreshed_at: float = time.time()
|
||||||
self.cells: tuple[Cell, ...] = tuple(Cell(*cell) for cell in cells)
|
self.cells: tuple[Cell, ...] = tuple(Cell(*cell) for cell in cells)
|
||||||
self.color: tuple[str, str] | None = backend_color_to_aqt_color(color)
|
self.color: dict[str, str] | None = backend_color_to_aqt_color(color)
|
||||||
self.font_name: str = font_name or "arial"
|
self.font_name: str = font_name or "arial"
|
||||||
self.font_size: int = font_size if font_size > 0 else 12
|
self.font_size: int = font_size if font_size > 0 else 12
|
||||||
|
|
||||||
|
|
|
@ -47,5 +47,3 @@ with open(input_svg, "r") as f:
|
||||||
|
|
||||||
substitute(svg_data, light_svg, "light")
|
substitute(svg_data, light_svg, "light")
|
||||||
substitute(svg_data, dark_svg, "dark")
|
substitute(svg_data, dark_svg, "dark")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ from aqt import colors
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.theme import theme_manager
|
from aqt.theme import theme_manager
|
||||||
|
|
||||||
|
|
||||||
class Switch(QAbstractButton):
|
class Switch(QAbstractButton):
|
||||||
"""A horizontal slider to toggle between two states which can be denoted by strings and/or QIcons.
|
"""A horizontal slider to toggle between two states which can be denoted by strings and/or QIcons.
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import pprint
|
|
||||||
|
|
||||||
# bazel genrule "srcs"
|
# bazel genrule "srcs"
|
||||||
root_vars_css = sys.argv[1]
|
root_vars_css = sys.argv[1]
|
||||||
|
@ -75,7 +74,7 @@ with open(colors_py, "w") as buf:
|
||||||
if not "dark" in val:
|
if not "dark" in val:
|
||||||
val["dark"] = val.light
|
val["dark"] = val.light
|
||||||
|
|
||||||
buf.write(f'{color} = {pprint.pformat(val, width=50, sort_dicts=False)}\n')
|
buf.write(re.sub(r'\"\n', '",\n', f"{color} = {json.dumps(val, indent=4)}\n"))
|
||||||
|
|
||||||
|
|
||||||
with open(props_py, "w") as buf:
|
with open(props_py, "w") as buf:
|
||||||
|
@ -86,4 +85,4 @@ with open(props_py, "w") as buf:
|
||||||
if not "dark" in val:
|
if not "dark" in val:
|
||||||
val["dark"] = val.light
|
val["dark"] = val.light
|
||||||
|
|
||||||
buf.write(f'{prop} = {pprint.pformat(val, width=50, sort_dicts=False)}\n')
|
buf.write(re.sub(r'\"\n', '",\n', f"{prop} = {json.dumps(val, indent=4)}\n"))
|
||||||
|
|
Loading…
Reference in a new issue