mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-09 18:52:40 +02:00
tool tip for config properties
This commit is contained in:
+12
-15
@@ -274,24 +274,24 @@ class CraftBeerPi(ActorAPI, SensorAPI):
|
||||
if isinstance(tmpObj.__getattribute__(m), Property.Number):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append(
|
||||
{"name": m, "label": t.label, "type": "number", "configurable": t.configurable})
|
||||
{"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), Property.Text):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append(
|
||||
{"name": m, "label": t.label, "type": "text", "configurable": t.configurable})
|
||||
{"name": m, "label": t.label, "type": "text", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), Property.Select):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append(
|
||||
{"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options})
|
||||
{"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), Property.Actor):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "actor", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "actor", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), Property.Sensor):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "sensor", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "sensor", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), Property.Kettle):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable, "description": t.description})
|
||||
|
||||
for name, method in cls.__dict__.iteritems():
|
||||
if hasattr(method, "action"):
|
||||
@@ -353,25 +353,22 @@ class CraftBeerPi(ActorAPI, SensorAPI):
|
||||
for m in members:
|
||||
if isinstance(tmpObj.__getattribute__(m), StepProperty.Number):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
#self.cache[key][name]["properties"].append(t.__dict__)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "default_value": t.default_value})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "default_value": t.default_value, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Text):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
print t.__dict__
|
||||
#self.cache[key][name]["properties"].append(t.__dict__)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "text", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "text", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Select):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Actor):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "actor", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "actor", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Sensor):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "sensor", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "sensor", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Kettle):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable, "description": t.description})
|
||||
|
||||
for name, method in cls.__dict__.iteritems():
|
||||
if hasattr(method, "action"):
|
||||
|
||||
+20
-10
@@ -3,55 +3,65 @@ class PropertyType(object):
|
||||
|
||||
class Property(object):
|
||||
class Select(PropertyType):
|
||||
def __init__(self, label, options):
|
||||
def __init__(self, label, options, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.options = options
|
||||
self.description = description
|
||||
|
||||
class Number(PropertyType):
|
||||
def __init__(self, label, configurable=False, default_value=None, unit=""):
|
||||
def __init__(self, label, configurable=False, default_value=None, unit="", description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = configurable
|
||||
self.default_value = default_value
|
||||
self.description = description
|
||||
|
||||
class Text(PropertyType):
|
||||
def __init__(self, label, configurable=False, default_value=""):
|
||||
def __init__(self, label, configurable=False, default_value="", description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = configurable
|
||||
self.description = description
|
||||
|
||||
class Actor(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
|
||||
class Sensor(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
|
||||
class Kettle(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
|
||||
|
||||
class StepProperty(Property):
|
||||
class Actor(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
class Sensor(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
class Kettle(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
Reference in New Issue
Block a user