diff --git a/plugins/ui/examples/README.md b/plugins/ui/examples/README.md index 96351e74a..d464639f4 100644 --- a/plugins/ui/examples/README.md +++ b/plugins/ui/examples/README.md @@ -777,20 +777,16 @@ The `ui.table` component has a few events that you can listen to. You can listen import deephaven.ui as ui import deephaven.plot.express as dx -te = ( - ui.table(dx.data.stocks()) - .on_row_press(lambda row, data: print(f"Row Press: {row}, {data}")) - .on_row_double_press(lambda row, data: print(f"Row Double Press: {row}, {data}")) - .on_cell_press( - lambda cell_index, data: print(f"Cell Press: {cell_index}, {data}") - ) - .on_cell_double_press( - lambda cell_index, data: print(f"Cell Double Press: {cell_index}, {data}") - ) - .on_column_press(lambda column: print(f"Column Press: {column}")) - .on_column_double_press( - lambda column: print(f"Column Double Press: {column}") - ) +te = ui.table( + dx.data.stocks(), + on_row_press=lambda row, data: print(f"Row Press: {row}, {data}"), + on_row_double_press=lambda row, data: print(f"Row Double Press: {row}, {data}"), + on_cell_press=lambda cell_index, data: print(f"Cell Press: {cell_index}, {data}"), + on_cell_double_press=lambda cell_index, data: print( + f"Cell Double Press: {cell_index}, {data}" + ), + on_column_press=lambda column: print(f"Column Press: {column}"), + on_column_double_press=lambda column: print(f"Column Double Press: {column}"), ) ``` diff --git a/plugins/ui/src/deephaven/ui/elements/UITable.py b/plugins/ui/src/deephaven/ui/elements/UITable.py index 89837416d..351c4d724 100644 --- a/plugins/ui/src/deephaven/ui/elements/UITable.py +++ b/plugins/ui/src/deephaven/ui/elements/UITable.py @@ -1,10 +1,9 @@ from __future__ import annotations -import collections import logging import sys -from warnings import warn from typing import Callable, Literal, Sequence, Any, cast +from warnings import warn if sys.version_info < (3, 11): from typing_extensions import TypedDict, NotRequired @@ -458,10 +457,10 @@ def hide_columns(self, columns: str | list[str]) -> "UITable": """ raise NotImplementedError() - @DeprecationWarning def on_row_double_press(self, callback: RowPressCallback) -> "UITable": """ Add a callback for when a row is double clicked. + *Deprecated: Use the on_row_double_press keyword arg instead. Args: callback: The callback function to run when a row is double clicked. @@ -471,7 +470,11 @@ def on_row_double_press(self, callback: RowPressCallback) -> "UITable": Returns: A new UITable """ - warn("Use on_row_double_press arg on ui.table instead", DeprecationWarning) + warn( + "on_row_double_press function is deprecated. Use the on_row_double_press keyword arg instead.", + DeprecationWarning, + stacklevel=2, + ) return self._with_prop("on_row_double_press", callback) def quick_filter(