frontends (xmlui): class_map is now an arg of create function:
class_map was so far used as a global value, but in some cases, several XMLUI managers may be used (it's the case in Cagou's remote controllers plugins, template_xmlui is used to manage remotes). This patch set class_map as a create argument, this way it can be set with partial, and several XMLUI managers can be instanced at the same time.
This commit is contained in:
parent
14fd4252eb
commit
5d6321ec9f
1 changed files with 49 additions and 60 deletions
|
|
@ -26,6 +26,7 @@ from sat.core.log import getLogger
|
|||
|
||||
log = getLogger(__name__)
|
||||
from sat_frontends.tools import xmlui
|
||||
from functools import partial
|
||||
|
||||
|
||||
## Widgets ##
|
||||
|
|
@ -176,6 +177,7 @@ class LabelContainer(xmlui.PairsContainer, Container):
|
|||
|
||||
|
||||
class WidgetFactory(object):
|
||||
|
||||
def __getattr__(self, attr):
|
||||
if attr.startswith("create"):
|
||||
cls = globals()[attr[6:]]
|
||||
|
|
@ -199,6 +201,6 @@ class XMLUIDialog(xmlui.XMLUIDialog):
|
|||
raise NotImplementedError
|
||||
|
||||
|
||||
xmlui.registerClass(xmlui.CLASS_PANEL, XMLUIPanel)
|
||||
xmlui.registerClass(xmlui.CLASS_DIALOG, XMLUIDialog)
|
||||
create = xmlui.create
|
||||
create = partial(xmlui.create, class_map={
|
||||
xmlui.CLASS_PANEL: XMLUIPanel,
|
||||
xmlui.CLASS_DIALOG: XMLUIDialog})
|
||||
|
|
|
|||
Loading…
Reference in a new issue