Skip to content

Commit

Permalink
Timepicker: stricter parameters and minor doc changes (#7308)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt authored Sep 23, 2024
1 parent 85e259e commit 3f4d443
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
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="""
clock = param.Selector(default='12h', objects=['12h', '24h'], doc="""
Whether to use 12 hour or 24 hour clock.""")

__abstract = True
Expand Down

0 comments on commit 3f4d443

Please sign in to comment.