defauls state is None, state and sizes are not updated when Save or Reload is pressed

This commit is contained in:
EtSL33py
2024-09-20 03:30:11 +03:00
parent 844f286f24
commit 7a5d19eeec
2 changed files with 36 additions and 31 deletions

View File

@@ -200,7 +200,7 @@ def ui_rules():
Rule("sidebar-control-always-compact", False, bool),
Rule("sidebar-default-width", 0.5, float, 0.0, 1.0),
Rule("sidebar-default-height", 0.5, float, 0.0, 1.0),
Rule("sidebar-default-state", "Left", str),
Rule("sidebar-default-state", "None", str),
Rule("text-input-always-hide-search-button", False, bool),
Rule("text-input-always-hide-clear-button", False, bool),

View File

@@ -4611,7 +4611,7 @@ class SettingsView {
}),
$select({
$: (el) => (settings['sidebar-default-state'] = el),
textContent: 'Default model manager position',
textContent: 'Default model manager position (on start up)',
options: ['Left', 'Right', 'Top', 'Bottom', 'None'],
}),
$checkbox({
@@ -5356,37 +5356,27 @@ class ModelManager extends ComfyDialog {
async #init() {
await this.#settingsView.reload(false);
await this.#refreshModels();
}
#updateSidebarSettings = (settings) => {
const newSidebarState = settings['sidebar-default-state'].value;
let buttonNumb = 0;
if (newSidebarState === 'Left') {
buttonNumb = 4;
} else if (newSidebarState === 'Right') {
buttonNumb = 1;
} else if (newSidebarState === 'Top') {
buttonNumb = 2;
} else if (newSidebarState === 'Bottom') {
buttonNumb = 3;
}
if(!this.#sidebarButtonGroup.children[buttonNumb].classList.contains('radio-button-group-active')){
this.#sidebarButtonGroup.children[buttonNumb].click();
}
const settings = this.#settingsView.elements.settings;
{
// initialize buttons' visibility state
const hideSearchButtons =
settings['text-input-always-hide-search-button'].checked;
const hideClearSearchButtons =
settings['text-input-always-hide-clear-button'].checked;
this.#downloadView.elements.searchButton.style.display = hideSearchButtons
? 'none'
: '';
this.#downloadView.elements.clearSearchButton.style.display =
hideClearSearchButtons ? 'none' : '';
}
// set initial sidebar state
const newSidebarState = settings['sidebar-default-state'].value;
let buttonNumb = 0;
if (newSidebarState === 'Right') {
buttonNumb = 1;
} else if (newSidebarState === 'Top') {
buttonNumb = 2;
} else if (newSidebarState === 'Bottom') {
buttonNumb = 3;
} else if (newSidebarState === 'Left') {
buttonNumb = 4;
}
const button = this.#sidebarButtonGroup.children[buttonNumb];
if(!button.classList.contains('radio-button-group-active')){
button.click();
}
}
{
// set initial sidebar widths & heights
@@ -5430,6 +5420,21 @@ class ModelManager extends ComfyDialog {
}
}
#updateSidebarSettings = (settings) => {
{
// update buttons' visibility state
const hideSearchButtons =
settings['text-input-always-hide-search-button'].checked;
const hideClearSearchButtons =
settings['text-input-always-hide-clear-button'].checked;
this.#downloadView.elements.searchButton.style.display = hideSearchButtons
? 'none'
: '';
this.#downloadView.elements.clearSearchButton.style.display =
hideClearSearchButtons ? 'none' : '';
}
}
#resetManagerContentsScroll = () => {
this.#tabManagerContents.scrollTop = 0;
};