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

Timepicker: stricter parameters and minor doc changes #7308

Merged
merged 2 commits into from
Sep 23, 2024
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
14 changes: 7 additions & 7 deletions examples/reference/widgets/TimePicker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
"* **``start``** (str | datetime.time): Inclusive lower bound of the allowed time selection\n",
"* **``end``** (str | datetime.time): Inclusive upper bound of the allowed time selection\n",
"\n",
"##### Display\n",
"\n",
"* **``disabled``** (boolean): Whether the widget is editable\n",
"* **``name``** (str): The title of the widget\n",
"* **``format``** (str): Formatting specification for the display of the picked date.\n",
"\n",
" ```\n",
" +---+------------------------------------+------------+\n",
" | H | Hours (24 hours) | 00 to 23 |\n",
Expand All @@ -44,17 +50,11 @@
" See also https://flatpickr.js.org/formatting/#date-formatting-tokens.\n",
"\n",
"\n",
"\n",
"##### Display\n",
"\n",
"* **``disabled``** (boolean): Whether the widget is editable\n",
"* **``name``** (str): The title of the widget\n",
"* **``format``** (str): Formatting specification for the display of the picked date.\n",
"* **``hour_increment``** (int): Defines the granularity of hour value increments in the UI. Default is 1.\n",
"* **``minute_increment``** (int): Defines the granularity of minute value increments in the UI. Default is 1.\n",
"* **``second_increment``** (int): Defines the granularity of second value increments in the UI. Default is 1.\n",
"* **``seconds``** (bool): Allows to select seconds. By default, only hours and minutes are selectable, and AM/PM depending on the `clock` option. Default is False.\n",
"* **``clock``** (bool): Whether to use 12 hour or 24 hour clock.\n",
"* **``clock``** (str): Whether to use 12 hour or 24 hour clock. Default is `'12h'`.\n",
"___"
]
},
Expand Down
8 changes: 4 additions & 4 deletions panel/widgets/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,15 +813,15 @@ def _deserialize_value(self, value):

class _TimeCommon(Widget):

hour_increment = param.Integer(default=1, doc="""
hour_increment = param.Integer(default=1, bounds=(1, None), doc="""
Defines the granularity of hour value increments in the UI.
""")

minute_increment = param.Integer(default=1, doc="""
minute_increment = param.Integer(default=1, bounds=(1, None), doc="""
Defines the granularity of minute value increments in the UI.
""")

second_increment = param.Integer(default=1, doc="""
second_increment = param.Integer(default=1, bounds=(1, None), doc="""
Defines the granularity of second value increments in the UI.
""")

Expand All @@ -830,7 +830,7 @@ class _TimeCommon(Widget):
selectable, and AM/PM depending on the `clock` option.
""")

clock = param.String(default='12h', doc="""
Copy link
Member

Choose a reason for hiding this comment

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

Honestly should have aligned this with DatetimePicker:

military_time = param.Boolean(default=True, doc="""
      Whether to display time in 24 hour format.""")

clock = param.Selector(default='12h', objects=['12h', '24h'], doc="""
Whether to use 12 hour or 24 hour clock.""")

__abstract = True
Expand Down
Loading