diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-10 10:02:50 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-10 10:02:50 +0000 |
commit | 08838105923255e66ef0d58115fc9ce671d202ae (patch) | |
tree | 2cf3ead8efd0473d0ccf09a6031dae1d483e465b | |
parent | faca86620d53b122eac00fd0a4ab54b3a2e3108e (diff) | |
download | stable-diffusion-webui-gfx803-08838105923255e66ef0d58115fc9ce671d202ae.tar.gz stable-diffusion-webui-gfx803-08838105923255e66ef0d58115fc9ce671d202ae.tar.bz2 stable-diffusion-webui-gfx803-08838105923255e66ef0d58115fc9ce671d202ae.zip |
comment for InputAccordion
-rw-r--r-- | modules/ui_components.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/ui_components.py b/modules/ui_components.py index 598ce738..9df9ddf4 100644 --- a/modules/ui_components.py +++ b/modules/ui_components.py @@ -74,6 +74,11 @@ class DropdownEditable(FormComponent, gr.Dropdown): class InputAccordion(gr.Checkbox):
+ """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):
@@ -91,6 +96,19 @@ class InputAccordion(gr.Checkbox): self.accordion = gr.Accordion(kwargs.get('label', 'Accordion'), open=value, elem_id=self.accordion_id, elem_classes=['input-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):
|