diff options
| author | Lex Neva <github.com@lexneva.name> | 2022-07-29 18:17:50 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2023-02-18 22:34:47 -0500 |
| commit | 98bc2e2ff9c843a64c3db355290ed541e6708312 (patch) | |
| tree | 593edf118780f9902437a306323595c6846acb24 /lib/extensions/base.py | |
| parent | a0834e2e7c2f2b6734877a8ee922c01e8c9330ba (diff) | |
add preferences UI including cache settings
Diffstat (limited to 'lib/extensions/base.py')
| -rw-r--r-- | lib/extensions/base.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/extensions/base.py b/lib/extensions/base.py index c2f76b27..7b3c6f1c 100644 --- a/lib/extensions/base.py +++ b/lib/extensions/base.py @@ -23,6 +23,7 @@ from ..svg import generate_unique_id from ..svg.tags import (CONNECTOR_TYPE, EMBROIDERABLE_TAGS, INKSCAPE_GROUPMODE, NOT_EMBROIDERABLE_TAGS, SVG_CLIPPATH_TAG, SVG_DEFS_TAG, SVG_GROUP_TAG, SVG_MASK_TAG) +from ..utils.settings import DEFAULT_METADATA, global_settings SVG_METADATA_TAG = inkex.addNS("metadata", "svg") @@ -52,9 +53,14 @@ class InkStitchMetadata(MutableMapping): """ def __init__(self, document): + super().__init__() self.document = document self.metadata = document.metadata + for setting in DEFAULT_METADATA: + if self[setting] is None: + self[setting] = global_settings[f'default_{setting}'] + # Because this class inherints from MutableMapping, all we have to do is # implement these five methods and we get a full dict-like interface. @@ -96,6 +102,9 @@ class InkStitchMetadata(MutableMapping): return i + 1 + def __json__(self): + return dict(self) + class InkstitchExtension(inkex.Effect): """Base class for Inkstitch extensions. Not intended for direct use.""" |
