Some fixes to disabled buttons (#3288)

* Fixes to button disable

* button

* formatting

* fixes

* formatter
This commit is contained in:
Abubakar Abid 2023-02-22 13:23:38 -06:00 committed by GitHub
parent 5df113a4d6
commit 06c4cd705f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -2,7 +2,7 @@
## New Features:
- Updated image upload component to accept all image formats, including lossless formats like .webp by [@fienestar](https://github.com/fienestar) in [PR 3225](https://github.com/gradio-app/gradio/pull/3225)
- Adds a disabled mode to the `gr.Button` component by setting `interactive=False` by [@abidlabs](https://github.com/abidlabs) in [PR 3266](https://github.com/gradio-app/gradio/pull/3266)
- Adds a disabled mode to the `gr.Button` component by setting `interactive=False` by [@abidlabs](https://github.com/abidlabs) in [PR 3266](https://github.com/gradio-app/gradio/pull/3266) and [PR 3288](https://github.com/gradio-app/gradio/pull/3288)
## Bug Fixes:

View File

@ -2945,13 +2945,13 @@ class Button(Clickable, IOComponent, SimpleSerializable):
visible: bool | None = None,
interactive: bool | None = None,
):
return {
updated_config = {
"variant": variant,
"visible": visible,
"value": value,
"interactive": interactive,
"__type__": "update",
}
return IOComponent.add_interactive_to_config(updated_config, interactive)
def style(self, *, full_width: bool | None = None, **kwargs):
"""

View File

@ -886,8 +886,8 @@ def tex2svg(formula, *args):
svg_start = xml_code.index("<svg ")
svg_code = xml_code[svg_start:]
svg_code = re.sub(r"<metadata>.*<\/metadata>", "", svg_code, flags=re.DOTALL)
svg_code = re.sub(r' width="[^"]+"', '', svg_code)
svg_code = re.sub(r' height="[^"]+"', '', svg_code)
svg_code = re.sub(r' width="[^"]+"', "", svg_code)
svg_code = re.sub(r' height="[^"]+"', "", svg_code)
copy_code = f"<span style='font-size: 0px'>{formula}</span>"
return f"{copy_code}{svg_code}"

View File

@ -39,6 +39,8 @@
}
button[disabled] {
opacity: 0.5;
filter: grayscale(30%);
cursor: not-allowed;
}