class MainPage(DictPage):
    """Главная страница с основными характеристиками приложения"""
    info = PageAttribute()
    start_time = Attribute()
    queries = PageAttribute(default=0)

    @PageAttribute.property
    def work_time(self):
        return str(Time(self.start_time, ago=True))
Exemple #2
0
    def add_attr(self, name, value=None, **kwargs):
        """
        Add an attribute.

         .. todo::: 
             - add attribute type mapper.
        """
        attr_type = kwargs.get('attr_type', None)
        #print('\t"%s.%s" type: %s' %(self.name, name, attr_type)
        attr = Attribute(name, value, dagnode=self, **kwargs)
        self._attributes.update({attr.name: attr})
        return attr
Exemple #3
0
class AD(AttributeStorage):
    default = Attribute(default=100)
    required = Attribute()
Exemple #4
0
class A4(AttributeStorage):
    first_attr = Attribute()
    second_attr = Attribute()
Exemple #5
0
class A1(AttributeStorage):
    a = Attribute(description="a1")
    b = Attribute(description="a1")
Exemple #6
0
 class XX(AK):
     c = Attribute()
     yy_kwargs = KwargsAttribute()
Exemple #7
0
class MDC(AttributeStorage):
    x = Attribute(default=lambda: dict())
Exemple #8
0
class MethodTwo(AttributeStorage):
    a = Attribute()

    @Attribute.property
    def a2(self):
        return self.a * 2
Exemple #9
0
class LabelTwo(LabelName):
    x = Attribute()
Exemple #10
0
class A2(A1):
    b = Attribute(description="a2")
    c = Attribute(description="a2")
Exemple #11
0
class XXX(AttributeStorage):
    uid = Attribute(uid=True)
    value = Attribute()
Exemple #12
0
class ZZZ(XXX):
    uid = Attribute(uid=True)
Exemple #13
0
class TModel(Model):
    uid = Attribute(uid=True)
    name: str = Attribute()
    value: int = Attribute()
Exemple #14
0
class TLink(Link):
    direction = Link.LTR
    param = Attribute(default=None)
Exemple #15
0
class TModelChild(Model):
    id = Attribute(uid=True)
    some = Attribute()
Exemple #16
0
class AK(AttributeStorage):
    x = Attribute()
    params = KwargsAttribute()
Exemple #17
0
 class XX(AttributeStorage):
     b = Attribute()
     xx_kwargs = KwargsAttribute()
     c = Attribute()
     yy_kwargs = KwargsAttribute()
Exemple #18
0
class LabelName(Model):
    uid = Attribute(uid=True)
    param_one = Attribute()
Exemple #19
0
class A3(A2):
    c = Attribute(description="a3")
    d = Attribute(description="a3")
Exemple #20
0
class MethodOne(AttributeStorage):
    def _calc(self):
        return self.a * 2

    a = Attribute()
    a2 = Attribute(method=_calc)
Exemple #21
0
 class TWrong(Model):
     x = ModelAttribute()
     y = Attribute()