Skip to content

Commit

Permalink
deviceView user_tappable_color works
Browse files Browse the repository at this point in the history
  • Loading branch information
James Boulton committed Oct 17, 2024
1 parent c5ebda2 commit c63b842
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dashio/iotcontrol/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def _get_color_str(color: str | Color) -> str:


def _get_color(color_str: str) -> Color | str:
if color_str == '':
return color_str
if color_str[0] == '#':
return color_str
color_name = color_str.upper().replace(" ", "_")
Expand Down
10 changes: 8 additions & 2 deletions dashio/iotcontrol/device_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def from_dict(cls, cfg_dict: dict):
cfg_dict["ctrlMaxFontSize"],
cfg_dict["ctrlBkgndTransparency"],
cfg_dict["gridColumns"],
cfg_dict["gridRows"]
cfg_dict["gridRows"],
_get_color(cfg_dict.get("ctrlUItapColor", ''))
)
return tmp_cls

Expand Down Expand Up @@ -140,6 +141,8 @@ class DeviceView(Control):
The num of grid columns on the edit view
num_grid_rows : int
The num of grid rows on the edit view
user_tappable_color : Color
The color of user table buttons on screen in controls
column_no : int, optional default is 1. Must be 1..3
The Dash App reports its screen size in columns. column_no allows you to specify which column no to load into.
Each control can store three configs that define how the device looks for Dash apps installed on single column
Expand Down Expand Up @@ -174,6 +177,7 @@ def __init__(
control_background_transparency=0,
num_grid_columns=22,
num_grid_rows=32,
user_tappable_color='',
column_no=1
):
super().__init__("DVVW", control_id)
Expand All @@ -195,7 +199,8 @@ def __init__(
control_max_font_size,
control_background_transparency,
num_grid_columns,
num_grid_rows
num_grid_rows,
user_tappable_color
)
)
self._state_str = ""
Expand Down Expand Up @@ -231,6 +236,7 @@ def from_cfg_dict(cls, cfg_dict: dict, column_no=1):
cfg_dict["ctrlBkgndTransparency"],
cfg_dict["gridColumns"],
cfg_dict["gridRows"],
_get_color(cfg_dict.get("ctrlUItapColor", '')),
column_no
)

Expand Down

0 comments on commit c63b842

Please sign in to comment.