Mercurial > libervia-backend
diff sat/tools/common/template_xmlui.py @ 2624:56f94936df1e
code style reformatting using black
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Jun 2018 20:14:46 +0200 |
parents | 26edcf3a30eb |
children | bdb8276fd2da |
line wrap: on
line diff
--- a/sat/tools/common/template_xmlui.py Wed Jun 27 07:51:29 2018 +0200 +++ b/sat/tools/common/template_xmlui.py Wed Jun 27 20:14:46 2018 +0200 @@ -23,14 +23,16 @@ """ from sat.core.log import getLogger + log = getLogger(__name__) from sat_frontends.tools import xmlui ## Widgets ## + class Widget(object): - category = u'widget' + category = u"widget" type = None enabled = True read_only = True @@ -44,7 +46,6 @@ class ValueWidget(Widget): - def __init__(self, xmlui_parent, value): super(ValueWidget, self).__init__(xmlui_parent) self.value = value @@ -55,21 +56,19 @@ @property def labels(self): - # helper property, there is not label for ValueWidget + # helper property, there is not label for ValueWidget # but using labels make rendering more easy (one single method to call) - # values are actually returned + # values are actually returned return [self.value] class InputWidget(ValueWidget): - def __init__(self, xmlui_parent, value, read_only=False): super(InputWidget, self).__init__(xmlui_parent, value) self.read_only = read_only class OptionsWidget(Widget): - def __init__(self, xmlui_parent, options, selected, style): super(OptionsWidget, self).__init__(xmlui_parent) self.options = options @@ -91,21 +90,20 @@ def items(self): """return suitable items, according to style""" no_select = self.no_select - for value,label in self.options: + for value, label in self.options: if no_select or value in self.selected: - yield value,label + yield value, label @property def inline(self): - return u'inline' in self.style + return u"inline" in self.style @property def no_select(self): - return u'noselect' in self.style + return u"noselect" in self.style class EmptyWidget(xmlui.EmptyWidget, Widget): - def __init__(self, _xmlui_parent): Widget.__init__(self) @@ -143,8 +141,9 @@ ## Containers ## + class Container(object): - category = u'container' + category = u"container" type = None def __init__(self, xmlui_parent): @@ -162,26 +161,27 @@ class VerticalContainer(xmlui.VerticalContainer, Container): - type = u'vertical' + type = u"vertical" class PairsContainer(xmlui.PairsContainer, Container): - type = u'pairs' + type = u"pairs" class LabelContainer(xmlui.PairsContainer, Container): - type = u'label' + type = u"label" ## Factory ## + class WidgetFactory(object): - def __getattr__(self, attr): if attr.startswith("create"): cls = globals()[attr[6:]] return cls + ## Core ##