aboutsummaryrefslogtreecommitdiff
path: root/modules/shared.py
diff options
context:
space:
mode:
authorAngelBottomless <35677394+aria1th@users.noreply.github.com>2022-11-04 15:51:09 +0900
committerGitHub <noreply@github.com>2022-11-04 15:51:09 +0900
commit179702adc40cc8d9c97ae883ee9d0f7c79076047 (patch)
tree34b166971e0d8b5b2b8a7ec631d7395072f3f218 /modules/shared.py
parent0d07cbfa15d34294a4fa22d74359cdd6fe2f799c (diff)
parentf2b69709eaff88fc3a2bd49585556ec0883bf5ea (diff)
Merge branch 'AUTOMATIC1111:master' into force-push-patch-13
Diffstat (limited to 'modules/shared.py')
-rw-r--r--modules/shared.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/shared.py b/modules/shared.py
index 7ecb40d8..4d6e1c8b 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -397,6 +397,15 @@ class Options:
def __setattr__(self, key, value):
if self.data is not None:
if key in self.data or key in self.data_labels:
+ assert not cmd_opts.freeze_settings, "changing settings is disabled"
+
+ comp_args = opts.data_labels[key].component_args
+ if isinstance(comp_args, dict) and comp_args.get('visible', True) is False:
+ raise RuntimeError(f"not possible to set {key} because it is restricted")
+
+ if cmd_opts.hide_ui_dir_config and key in restricted_opts:
+ raise RuntimeError(f"not possible to set {key} because it is restricted")
+
self.data[key] = value
return
@@ -413,6 +422,8 @@ class Options:
return super(Options, self).__getattribute__(item)
def save(self, filename):
+ assert not cmd_opts.freeze_settings, "saving settings is disabled"
+
with open(filename, "w", encoding="utf8") as file:
json.dump(self.data, file, indent=4)