Added download notes checkbox to download tab for better clarity.

- Disabled label element pointer events globally.
- Added missing documented object members to SettingsView.elements.
This commit is contained in:
Christian Bastian
2024-07-21 14:59:18 -04:00
parent 55ddaa19bd
commit 7828ab1a66
3 changed files with 20 additions and 10 deletions

View File

@@ -187,7 +187,7 @@ def ui_rules():
Rule("model-add-embedding-extension", False, bool), Rule("model-add-embedding-extension", False, bool),
Rule("model-add-drag-strict-on-field", False, bool), Rule("model-add-drag-strict-on-field", False, bool),
Rule("model-add-offset", 25, int), Rule("model-add-offset", 25, int),
Rule("download-save-description-as-text-file", False, bool), Rule("download-save-description-as-text-file", True, bool),
] ]

View File

@@ -601,11 +601,11 @@
margin: 16px 0; margin: 16px 0;
} }
.model-manager .model-manager-settings > label { .model-manager label {
pointer-events: none; pointer-events: none;
} }
.model-manager .model-manager-settings > label > * { .model-manager label > * {
pointer-events: auto; pointer-events: auto;
} }

View File

@@ -2797,6 +2797,7 @@ class DownloadView {
/** @type {HTMLInputElement} */ url: null, /** @type {HTMLInputElement} */ url: null,
/** @type {HTMLDivElement} */ infos: null, /** @type {HTMLDivElement} */ infos: null,
/** @type {HTMLInputElement} */ overwrite: null, /** @type {HTMLInputElement} */ overwrite: null,
/** @type {HTMLInputElement} */ downloadNotes: null,
}; };
/** @type {DOMParser} */ /** @type {DOMParser} */
@@ -2988,7 +2989,7 @@ class DownloadView {
}); });
if (success) { if (success) {
const description = info["description"]; const description = info["description"];
if (settings["download-save-description-as-text-file"].checked && description !== "") { if (this.elements.downloadNotes.checked && description !== "") {
const modelPath = pathDirectory + searchSeparator + modelName; const modelPath = pathDirectory + searchSeparator + modelName;
const saved = await saveNotes(modelPath, description); const saved = await saveNotes(modelPath, description);
if (!saved) { if (!saved) {
@@ -3046,11 +3047,18 @@ class DownloadView {
const header = $el("div", [ const header = $el("div", [
$el("h1", [name]), $el("h1", [name]),
$checkbox({ $el("div.model-manager-settings", [
$: (el) => { this.elements.overwrite = el; }, $checkbox({
textContent: "Overwrite Existing Files.", $: (el) => { this.elements.overwrite = el; },
checked: false, textContent: "Overwrite Existing Files.",
}), checked: false,
}),
$checkbox({
$: (el) => { this.elements.downloadNotes = el; },
textContent: "Save Model Descriptions in Text Files.",
checked: settings["download-save-description-as-text-file"].checked,
}),
])
]); ]);
modelInfosHtml.unshift(header); modelInfosHtml.unshift(header);
} }
@@ -3219,6 +3227,8 @@ class SettingsView {
/** @type {HTMLInputElement} */ "model-show-add-button": null, /** @type {HTMLInputElement} */ "model-show-add-button": null,
/** @type {HTMLInputElement} */ "model-show-copy-button": null, /** @type {HTMLInputElement} */ "model-show-copy-button": null,
/** @type {HTMLInputElement} */ "model-info-button-on-left": null,
/** @type {HTMLInputElement} */ "model-preview-thumbnail-type": null,
/** @type {HTMLInputElement} */ "model-add-embedding-extension": null, /** @type {HTMLInputElement} */ "model-add-embedding-extension": null,
/** @type {HTMLInputElement} */ "model-add-drag-strict-on-field": null, /** @type {HTMLInputElement} */ "model-add-drag-strict-on-field": null,
/** @type {HTMLInputElement} */ "model-add-offset": null, /** @type {HTMLInputElement} */ "model-add-offset": null,
@@ -3424,7 +3434,7 @@ class SettingsView {
$el("h2", ["Download"]), $el("h2", ["Download"]),
$checkbox({ $checkbox({
$: (el) => (settings["download-save-description-as-text-file"] = el), $: (el) => (settings["download-save-description-as-text-file"] = el),
textContent: "Save descriptions as notes (in .txt file).", textContent: "Save model descriptions in .txt files by default.",
}), }),
]); ]);
} }