Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion ox_ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"""


VERSION = '0.3.10'
VERSION = '0.3.11'
7 changes: 5 additions & 2 deletions ox_ui/tkdantic/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,11 @@ def _build_command_buttons(self):
add_tooltip(btn, model_doc)

def _open_command(self, info):
"""Open a ModelCommandWindow for *info*."""
assert len(info.parameters) <= 1
"""Open ModelCommandWindow for *info* or just run it if on params."""
if not info.parameters:
return info.callback(parent=self)
if len(info.parameters) != 1:
raise ValueError(f'Cannot handle {info=} when parameters !=1.')
ModelCommandWindow(
self, command=info, url_var=self._url_var,
timeout_var=self._timeout_var, max_horizontal=4)
Expand Down
4 changes: 2 additions & 2 deletions ox_ui/tkdantic/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from typing import Callable, List, Optional, Type
from typing_extensions import Self

from pydantic import BaseModel, model_validator
from pydantic import BaseModel, Field, model_validator


class Command(BaseModel):
"""Basic command object.
"""

title: str
parameters: List[Type[BaseModel]]
parameters: List[Type[BaseModel]] = Field(default_factory=list)
description: str
name: Optional[str] = None

Expand Down