Skip to content

Commit c63b842

Browse files
author
James Boulton
committed
deviceView user_tappable_color works
1 parent c5ebda2 commit c63b842

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dashio/iotcontrol/control.py

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def _get_color_str(color: str | Color) -> str:
4949

5050

5151
def _get_color(color_str: str) -> Color | str:
52+
if color_str == '':
53+
return color_str
5254
if color_str[0] == '#':
5355
return color_str
5456
color_name = color_str.upper().replace(" ", "_")

dashio/iotcontrol/device_view.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ def from_dict(cls, cfg_dict: dict):
106106
cfg_dict["ctrlMaxFontSize"],
107107
cfg_dict["ctrlBkgndTransparency"],
108108
cfg_dict["gridColumns"],
109-
cfg_dict["gridRows"]
109+
cfg_dict["gridRows"],
110+
_get_color(cfg_dict.get("ctrlUItapColor", ''))
110111
)
111112
return tmp_cls
112113

@@ -140,6 +141,8 @@ class DeviceView(Control):
140141
The num of grid columns on the edit view
141142
num_grid_rows : int
142143
The num of grid rows on the edit view
144+
user_tappable_color : Color
145+
The color of user table buttons on screen in controls
143146
column_no : int, optional default is 1. Must be 1..3
144147
The Dash App reports its screen size in columns. column_no allows you to specify which column no to load into.
145148
Each control can store three configs that define how the device looks for Dash apps installed on single column
@@ -174,6 +177,7 @@ def __init__(
174177
control_background_transparency=0,
175178
num_grid_columns=22,
176179
num_grid_rows=32,
180+
user_tappable_color='',
177181
column_no=1
178182
):
179183
super().__init__("DVVW", control_id)
@@ -195,7 +199,8 @@ def __init__(
195199
control_max_font_size,
196200
control_background_transparency,
197201
num_grid_columns,
198-
num_grid_rows
202+
num_grid_rows,
203+
user_tappable_color
199204
)
200205
)
201206
self._state_str = ""
@@ -231,6 +236,7 @@ def from_cfg_dict(cls, cfg_dict: dict, column_no=1):
231236
cfg_dict["ctrlBkgndTransparency"],
232237
cfg_dict["gridColumns"],
233238
cfg_dict["gridRows"],
239+
_get_color(cfg_dict.get("ctrlUItapColor", '')),
234240
column_no
235241
)
236242

0 commit comments

Comments
 (0)