Skip to content

Commit

Permalink
Moved setting html id to the method call instead of constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
washad committed Jun 26, 2019
1 parent e92439b commit 3bd20d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions pyrediseasyio/html/html_io_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

class HMTLIOGroup:

def __init__(self, io_group: IOGroup, html_id: str = None):
def __init__(self, io_group: IOGroup):
self._io_group = io_group
self.namespace = io_group.namespace
self.html_id = html_id


def _heading(self, headers, row_tag: dominate.tags, cell_tag: dominate.tags):
Expand All @@ -29,10 +28,11 @@ def html(self, headers: List[str] = None,
show_units: bool = True,
show_set_reset: bool = False,
set_text: str = "On",
reset_text: str = "Off"):
reset_text: str = "Off",
html_id: str = None):

attrs = self._io_group.get_attributes(by_names, by_type, by_lambda_each, by_lambda_results)
html_id = f'{attrs[0].key}_io_container' if self.html_id is None else self.html_id
html_id = f'{attrs[0].key}_io_container' if html_id is None else html_id

with div(cls=f'easyio_container', id=html_id) as container:
self._heading(headers, div, div)
Expand All @@ -50,10 +50,11 @@ def html_table(self, headers: List[str] = None,
show_units: bool = True,
show_set_reset: bool = False,
set_text: str = "On",
reset_text: str = "Off"):
reset_text: str = "Off",
html_id: str = None):

attrs = self._io_group.get_attributes(by_names, by_type, by_lambda_each, by_lambda_results)
html_id = f'{attrs[0].addr}_io_container' if self.html_id is None else self.html_id
html_id = f'{attrs[0].addr}_io_container' if html_id is None else html_id

with table(cls=f'easyio_container', id=html_id) as container:
self._heading(headers, tr, th)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pyrediseasyio",
version="0.0.22",
version="0.0.23",
author="Steve Jackson",
author_email="washad@gmail.com",
description="A set of tools for simplifying reading and writing of single values to/from Redis.",
Expand Down

0 comments on commit 3bd20d9

Please sign in to comment.