mirror of
https://github.com/fmtr/haco.git
synced 2026-12-05 14:20:02 -05:00
Move Text control
This commit is contained in:
parent
e1656be71c
commit
eaaa24e6e7
1 changed files with 0 additions and 0 deletions
27
haco/text.py
Normal file
27
haco/text.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from haco.control import Control
|
||||
|
||||
from haco.tools import get_range_pair
|
||||
|
||||
|
||||
class Text(Control):
|
||||
NAME = 'text'
|
||||
|
||||
def __init__(self, name, icon=None, size_range: range = None, pattern: str = None):
|
||||
self.min, self.max = get_range_pair(size_range)
|
||||
self.pattern = pattern
|
||||
|
||||
super().__init__(name, icon=icon)
|
||||
|
||||
def get_config_ha_ex(self):
|
||||
data = {
|
||||
'min': self.min,
|
||||
'max': self.max,
|
||||
'pattern': self.pattern,
|
||||
'mode': self.__class__.__name__.lower()
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class Password(Text):
|
||||
...
|
||||
Loading…
Add table
Add a link
Reference in a new issue