Recompute every style constant from _cfg and push into all app modules.
(*, rescale_items: bool = False)
| 204 | |
| 205 | |
| 206 | def _apply(*, rescale_items: bool = False) -> None: |
| 207 | """Recompute every style constant from _cfg and push into all app modules.""" |
| 208 | import sys |
| 209 | |
| 210 | # Recompute every style constant and update this module's globals. |
| 211 | g = sys.modules[__name__].__dict__ |
| 212 | |
| 213 | g["LATEX_RENDERING_ENABLED"] = _b("rendering", "latex_rendering", True) |
| 214 | |
| 215 | # Push updated LATEX_AVAILABLE into latex_label (depends on both system |
| 216 | # check and user preference, so it needs special handling here). |
| 217 | ll = sys.modules.get("SLiCAP.schematic.latex_label") |
| 218 | if ll is not None: |
| 219 | ll.__dict__["LATEX_AVAILABLE"] = ( |
| 220 | ll.__dict__.get("_LATEX_INSTALLED", False) |
| 221 | and g["LATEX_RENDERING_ENABLED"] |
| 222 | ) |
| 223 | |
| 224 | g["SYMBOL_STROKE_COLOR"] = _c("symbol", "stroke_color", "#000000") |
| 225 | g["SYMBOL_TEXT_COLOR"] = _c("symbol", "text_color", "#000000") |
| 226 | |
| 227 | g["WIRE_COLOR"] = _c("wire", "color", "#000000") |
| 228 | g["WIRE_WIDTH"] = _f("wire", "width", 1.2) |
| 229 | |
| 230 | g["NET_LABEL_COLOR"] = _c("net_label", "color", "#0055BB") |
| 231 | g["NET_LABEL_FONT_SIZE"] = _i("net_label", "font_size", 7) |
| 232 | g["NET_LABEL_FONT"] = QFont("sans-serif", g["NET_LABEL_FONT_SIZE"]) |
| 233 | |
| 234 | g["COMP_REFDES_FONT_FAMILY"] = _s("component_label", "font_family", "sans-serif") |
| 235 | g["COMP_LABEL_COLOR"] = _c("component_label", "color", "#000000") |
| 236 | g["COMP_LABEL_FONT_SIZE"] = _i("component_label", "font_size", 7) |
| 237 | g["COMP_LABEL_LATEX_SCALE"] = _i("component_label", "latex_scale", 100) |
| 238 | g["COMP_LABEL_SVG_HEIGHT"] = g["COMP_LABEL_LATEX_SCALE"] / 100.0 * 20.0 |
| 239 | g["COMP_LABEL_FONT"] = QFont(g["COMP_REFDES_FONT_FAMILY"], g["COMP_LABEL_FONT_SIZE"]) |
| 240 | |
| 241 | g["COMP_PARAM_FONT_FAMILY"] = _s("component_param", "font_family", "sans-serif") |
| 242 | g["COMP_PARAM_FONT_SIZE"] = _i("component_param", "font_size", 7) |
| 243 | g["COMP_PARAM_COLOR"] = _c("component_param", "color", "#0055BB") |
| 244 | g["COMP_PARAM_FONT"] = QFont(g["COMP_PARAM_FONT_FAMILY"], g["COMP_PARAM_FONT_SIZE"]) |
| 245 | g["COMP_PARAM_LATEX_SCALE"] = _i("component_param", "latex_scale", 60) |
| 246 | g["COMP_PARAM_SVG_HEIGHT"] = g["COMP_PARAM_LATEX_SCALE"] / 100.0 * 20.0 |
| 247 | |
| 248 | g["GRID_MINOR_COLOR"] = _c("grid", "minor_color", "#DCDCDC") |
| 249 | g["GRID_MAJOR_COLOR"] = _c("grid", "major_color", "#B4B4B4") |
| 250 | |
| 251 | g["HANDLE_COLOR"] = _c("handles", "color", "#0078D7") |
| 252 | g["HANDLE_SIZE"] = _f("handles", "size", 4.0) |
| 253 | g["CONNECTION_COLOR"] = _c("handles", "connection_color", "#888888") |
| 254 | |
| 255 | g["JUNCTION_COLOR"] = _c("junctions", "color", "#000000") |
| 256 | g["JUNCTION_RADIUS"] = _f("junctions", "radius", 3.0) |
| 257 | |
| 258 | g["FREE_TEXT_COLOR"] = _c("free_text", "color", "#333333") |
| 259 | g["FREE_TEXT_FONT_SIZE"] = _i("free_text", "font_size", 8) |
| 260 | g["FREE_TEXT_FONT"] = QFont("sans-serif", g["FREE_TEXT_FONT_SIZE"]) |
| 261 | |
| 262 | g["COMMAND_COLOR"] = _c("command", "color", "#004080") |
| 263 | g["COMMAND_FONT_SIZE"] = _i("command", "font_size", 7) |