Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation ux #350

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7c88eca
Changed UX
clr-li May 1, 2024
1f7f1db
UI changes
clr-li May 2, 2024
7635e21
Added modal
clr-li May 3, 2024
43a999a
Fixed modal
clr-li May 7, 2024
d71b9d0
Merge branch 'master' into Animation-UX
clr-li May 7, 2024
ee6edf7
Smaller number input
clr-li May 8, 2024
dd0d742
Preview video
clr-li May 8, 2024
ddcf21f
Merge branch 'master' into Animation-UX
clr-li May 8, 2024
f6e1bfb
More room
clr-li May 9, 2024
ef01b76
Merge branch 'master' into Animation-UX
clr-li May 13, 2024
854c867
Fixed max frames
clr-li May 13, 2024
06463e4
Fixed time formatting
clr-li May 13, 2024
194f215
Merge branch 'master' into Animation-UX
clr-li May 16, 2024
ee09815
Merge branch 'master' into Animation-UX
clr-li May 20, 2024
7f945b4
Frames to seconds display
clr-li May 20, 2024
c67972c
Merge branch 'master' into Animation-UX
clr-li May 22, 2024
7eeaa89
Added zoom changes
clr-li May 22, 2024
cc1530e
Added pan settings
clr-li May 22, 2024
ad9bcc8
Merge branch 'master' into Animation-UX
clr-li May 23, 2024
d28b971
Frames to second fixes, adding frame fixes
clr-li May 23, 2024
f839a5f
Fixed modal bug
clr-li May 24, 2024
cad9492
More fixes
clr-li May 24, 2024
ff2facd
Possible lead
clr-li May 25, 2024
1adf9de
It keeps converting to frames
clr-li May 25, 2024
e3cd877
Added image generator
clr-li May 28, 2024
924ec5c
Added check
clr-li May 28, 2024
9637ff0
Generate preview image
clr-li May 30, 2024
86f2bda
Removed preview
clr-li May 30, 2024
4230c4b
Updated run cost note
clr-li May 30, 2024
fe95827
Merge branch 'master' into Animation-UX
clr-li Jun 4, 2024
c6a7f83
Added step 2
clr-li Jun 4, 2024
5583391
Merge branch 'master' into Animation-UX
clr-li Jun 5, 2024
b5561e2
Fixed fps issue
clr-li Jun 10, 2024
71ccbcb
Sean's UI changes
clr-li Jun 11, 2024
03a9e9a
Fixed modal values
clr-li Jun 11, 2024
a28510a
Fixed FPS
clr-li Jun 11, 2024
825abf5
Default to 0
clr-li Jun 11, 2024
105177b
Merge branch 'master' into Animation-UX
clr-li Jun 13, 2024
f675a4a
Merge branch 'master' into Animation-UX
clr-li Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 64 additions & 1 deletion gooey_ui/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,62 @@ def horizontal_radio(
return value


def custom_radio(
label: str,
options: typing.Sequence[T],
format_func: typing.Callable[[T], typing.Any] = _default_format,
key: str = None,
help: str = None,
*,
disabled: bool = False,
label_visibility: LabelVisibility = "visible",
) -> T | None:
if not key:
key = md5_values("custom_radio", label, options, help, label_visibility)
value = radio(
label=label,
options=options,
format_func=format_func,
key=key,
help=help,
disabled=disabled,
label_visibility=label_visibility,
validate_value=False,
)
is_custom = value not in options
custom = {
"label": "Custom",
"input": lambda label, key: number_input(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use of lambda discouraged

label=label,
min_value=1,
max_value=60,
step=1,
key=key,
style={"margin-top": "-8px"},
),
}
with div(className="d-flex", style={"gap": "1ch", "flex-direction": "row-reverse"}):
with div(className="flex-grow-1"):
state.session_state.setdefault(f"custom-{key}", value)
val = custom["input"](label="", key=f"custom-{key}")
with div():
state.RenderTreeNode(
name="input",
props=dict(
type="radio",
name=key,
label=dedent(str(custom["label"])),
value=val,
defaultChecked=is_custom,
help=help,
disabled=disabled,
),
).mount()
if type(options[0])(value) not in options:
value = state.session_state[key] = state.session_state[f"custom-{key}"]
return value


def radio(
label: str,
options: typing.Sequence[T],
Expand All @@ -701,14 +757,15 @@ def radio(
disabled: bool = False,
checked_by_default: bool = True,
label_visibility: LabelVisibility = "visible",
validate_value: bool = True,
) -> T | None:
if not options:
return None
options = list(options)
if not key:
key = md5_values("radio", label, options, help, label_visibility)
value = state.session_state.setdefault(key, value)
if value not in options and checked_by_default:
if (value not in options and validate_value) and checked_by_default:
value = state.session_state[key] = options[0]
if label_visibility != "visible":
label = None
Expand Down Expand Up @@ -850,6 +907,8 @@ def number_input(
help: str = None,
*,
disabled: bool = False,
className: str = "",
**props,
) -> float:
value = _input_widget(
input_type="number",
Expand All @@ -862,6 +921,8 @@ def number_input(
min=min_value,
max=max_value,
step=_step_value(min_value, max_value, step),
className=className,
**props,
)
return value or 0

Expand Down Expand Up @@ -911,6 +972,7 @@ def _input_widget(
disabled: bool = False,
label_visibility: LabelVisibility = "visible",
default_value_attr: str = "defaultValue",
className: str = "",
**kwargs,
) -> typing.Any:
# if key:
Expand All @@ -930,6 +992,7 @@ def _input_widget(
default_value_attr: value,
"help": help,
"disabled": disabled,
"className": className,
**kwargs,
},
).mount()
Expand Down
Loading