mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
modernui configurable grid images size
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
- configurable horizontal vs vertical panel layout
|
||||
in settings -> user interface -> panel min width
|
||||
*example*: if panel width is less than specified value, layout switches to verical
|
||||
- configurable grid images size
|
||||
in *settings -> user interface -> grid image size*
|
||||
- **Offloading**
|
||||
- enable offload during pre-forward by default
|
||||
- improve offloading of models with multiple dits
|
||||
|
||||
+4
-5
@@ -532,10 +532,10 @@ options_templates.update(options_section(('ui', "User Interface"), {
|
||||
"subpath": OptionInfo("", "Mount URL subpath"),
|
||||
"ui_request_timeout": OptionInfo(120000, "UI request timeout", gr.Slider, {"minimum": 1000, "maximum": 300000, "step": 10}),
|
||||
|
||||
"cards_sep_ui": OptionInfo("<h2>Card options</h2>", "", gr.HTML),
|
||||
"extra_networks_card_size": OptionInfo(140, "UI card size (px)", gr.Slider, {"minimum": 20, "maximum": 2000, "step": 1}),
|
||||
"extra_networks_card_cover": OptionInfo("sidebar", "UI position", gr.Radio, {"choices": ["cover", "inline", "sidebar"]}),
|
||||
"extra_networks_card_square": OptionInfo(True, "UI disable variable aspect ratio"),
|
||||
"cards_sep_ui": OptionInfo("<h2>Networks panel</h2>", "", gr.HTML),
|
||||
"extra_networks_card_size": OptionInfo(140, "Network card size (px)", gr.Slider, {"minimum": 20, "maximum": 2000, "step": 1}),
|
||||
"extra_networks_card_cover": OptionInfo("sidebar", "Network panel position", gr.Radio, {"choices": ["cover", "inline", "sidebar"]}),
|
||||
"extra_networks_card_square": OptionInfo(True, "Disable variable aspect ratio"),
|
||||
|
||||
"other_sep_ui": OptionInfo("<h2>Other...</h2>", "", gr.HTML),
|
||||
"ui_locale": OptionInfo("Auto", "UI locale", gr.Dropdown, lambda: {"choices": theme.list_locales()}),
|
||||
@@ -555,7 +555,6 @@ options_templates.update(options_section(('ui', "User Interface"), {
|
||||
"return_mask_composite": OptionInfo(False, "Inpainting include masked composite in results"),
|
||||
"send_seed": OptionInfo(True, "Send seed when sending prompt or image to other interface", gr.Checkbox, {"visible": False}),
|
||||
"send_size": OptionInfo(False, "Send size when sending prompt or image to another interface", gr.Checkbox, {"visible": False}),
|
||||
|
||||
}))
|
||||
|
||||
options_templates.update(options_section(('live-preview', "Live Previews"), {
|
||||
|
||||
@@ -9,9 +9,7 @@ class FormComponent:
|
||||
gr.Dropdown.get_expected_parent = FormComponent.get_expected_parent
|
||||
|
||||
|
||||
class ToolButton(FormComponent, gr.Button):
|
||||
"""Small button with single emoji as text, fits inside gradio forms"""
|
||||
|
||||
class ToolButton(FormComponent, gr.Button): # small button with single emoji as text
|
||||
def __init__(self, *args, **kwargs):
|
||||
classes = kwargs.pop("elem_classes", [])
|
||||
super().__init__(*args, elem_classes=["tool", *classes], **kwargs)
|
||||
@@ -19,66 +17,49 @@ class ToolButton(FormComponent, gr.Button):
|
||||
def get_block_name(self):
|
||||
return "button"
|
||||
|
||||
### unused components below for compatibility with extensions ###
|
||||
|
||||
class FormRow(FormComponent, gr.Row): # unused
|
||||
"""Same as gr.Row but fits inside gradio forms"""
|
||||
|
||||
def get_block_name(self):
|
||||
return "row"
|
||||
|
||||
|
||||
class FormColumn(FormComponent, gr.Column): # unused
|
||||
"""Same as gr.Column but fits inside gradio forms"""
|
||||
|
||||
def get_block_name(self):
|
||||
return "column"
|
||||
|
||||
|
||||
class FormGroup(FormComponent, gr.Group): # unused
|
||||
"""Same as gr.Row but fits inside gradio forms"""
|
||||
|
||||
def get_block_name(self):
|
||||
return "group"
|
||||
|
||||
|
||||
class FormHTML(FormComponent, gr.HTML): # unused
|
||||
"""Same as gr.HTML but fits inside gradio forms"""
|
||||
|
||||
def get_block_name(self):
|
||||
return "html"
|
||||
|
||||
|
||||
class FormColorPicker(FormComponent, gr.ColorPicker): # unused
|
||||
"""Same as gr.ColorPicker but fits inside gradio forms"""
|
||||
|
||||
def get_block_name(self):
|
||||
return "colorpicker"
|
||||
|
||||
|
||||
class DropdownMulti(FormComponent, gr.Dropdown): # unused
|
||||
"""Same as gr.Dropdown but always multiselect"""
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(multiselect=True, **kwargs)
|
||||
|
||||
def get_block_name(self):
|
||||
return "dropdown"
|
||||
|
||||
|
||||
class DropdownEditable(FormComponent, gr.Dropdown): # unused
|
||||
"""Same as gr.Dropdown but allows editing value"""
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(allow_custom_value=True, **kwargs)
|
||||
|
||||
def get_block_name(self):
|
||||
return "dropdown"
|
||||
|
||||
|
||||
class InputAccordion(gr.Checkbox): # unused
|
||||
"""A gr.Accordion that can be used as an input - returns True if open, False if closed.
|
||||
Actaully just a hidden checkbox, but creates an accordion that follows and is followed by the state of the checkbox.
|
||||
"""
|
||||
global_index = 0
|
||||
|
||||
def __init__(self, value, **kwargs):
|
||||
self.accordion_id = kwargs.get('elem_id')
|
||||
if self.accordion_id is None:
|
||||
@@ -97,15 +78,6 @@ class InputAccordion(gr.Checkbox): # unused
|
||||
self.accordion = gr.Accordion(**kwargs_accordion)
|
||||
|
||||
def extra(self):
|
||||
"""Allows you to put something into the label of the accordion.
|
||||
Use it like this:
|
||||
```
|
||||
with InputAccordion(False, label="Accordion") as acc:
|
||||
with acc.extra():
|
||||
FormHTML(value="hello", min_width=0)
|
||||
...
|
||||
```
|
||||
"""
|
||||
return gr.Column(elem_id=self.accordion_id + '-extra', elem_classes='input-accordion-extra', min_width=0)
|
||||
|
||||
def __enter__(self):
|
||||
@@ -120,11 +92,8 @@ class InputAccordion(gr.Checkbox): # unused
|
||||
|
||||
|
||||
class ResizeHandleRow(gr.Row): # unusued
|
||||
"""Same as gr.Row but fits inside gradio forms"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.elem_classes.append("resize-handle-row")
|
||||
|
||||
def get_block_name(self):
|
||||
return "row"
|
||||
|
||||
Reference in New Issue
Block a user