Added auto(dis)connect params + misc
- parameters,xmlui: "bool" type is now managed - parameters,xmlui: categories now use label in addition of name - QuickFrontend: auto(dis)connection management - plugin XEP-0045: an error dialog is now show in frontend if room cannot be joined - Wix: fixed unproper close event management
This commit is contained in:
parent
b3bff009e8
commit
007f12d2ae
1 changed files with 125 additions and 59 deletions
|
|
@ -81,12 +81,14 @@ def paramsXml2xmlUI(xml):
|
|||
param_ui = XMLUI("param", "tabs")
|
||||
for category in top.getElementsByTagName("category"):
|
||||
name = category.getAttribute('name')
|
||||
label = category.getAttribute('label')
|
||||
if not name:
|
||||
error(_('INTERNAL ERROR: params categories must have a name'))
|
||||
assert(False)
|
||||
param_ui.addCategory(name, 'pairs')
|
||||
param_ui.addCategory(name, 'pairs', label=label)
|
||||
for param in category.getElementsByTagName("param"):
|
||||
name = param.getAttribute('name')
|
||||
label = param.getAttribute('label')
|
||||
if not name:
|
||||
error(_('INTERNAL ERROR: params must have a name'))
|
||||
assert(False)
|
||||
|
|
@ -96,7 +98,7 @@ def paramsXml2xmlUI(xml):
|
|||
if type == "button":
|
||||
param_ui.addEmpty()
|
||||
else:
|
||||
param_ui.addLabel(name)
|
||||
param_ui.addLabel(label or name)
|
||||
param_ui.addElement(name=name, type=type, value=value, callback_id=callback_id)
|
||||
|
||||
return param_ui.toXml()
|
||||
|
|
@ -209,6 +211,12 @@ class XMLUI:
|
|||
if value:
|
||||
elem.setAttribute('value', value)
|
||||
|
||||
def addBool(self, name=None, value="true"):
|
||||
"""Add a string box"""
|
||||
assert value in ["true","false"]
|
||||
elem = self.__createElem('bool', name, self.currentLayout)
|
||||
elem.setAttribute('value', value)
|
||||
|
||||
def addList(self, options, name=None, value=None, style=set()):
|
||||
"""Add a list of choices"""
|
||||
styles = set(style)
|
||||
|
|
@ -253,6 +261,10 @@ class XMLUI:
|
|||
self.addPassword(name, value)
|
||||
elif type == 'textbox':
|
||||
self.addTextBox(name, value)
|
||||
elif type == 'bool':
|
||||
if not value:
|
||||
value = "true"
|
||||
self.addBool(name, value)
|
||||
elif type == 'list':
|
||||
self.addList(options, name, value)
|
||||
elif type == 'button':
|
||||
|
|
@ -267,7 +279,7 @@ class XMLUI:
|
|||
opt.setAttribute('value', option)
|
||||
parent.appendChild(opt)
|
||||
|
||||
def addCategory(self, name, layout):
|
||||
def addCategory(self, name, layout, label=None):
|
||||
"""Add a category to current layout (must be a tabs layout)"""
|
||||
assert(layout != 'tabs')
|
||||
if not self.parentTabsLayout:
|
||||
|
|
@ -276,8 +288,12 @@ class XMLUI:
|
|||
if self.parentTabsLayout.getAttribute('type') != 'tabs':
|
||||
error(_("parent layout of a category is not tabs"))
|
||||
assert(False)
|
||||
|
||||
if not label:
|
||||
label = name
|
||||
self.currentCategory = cat = self.doc.createElement('category')
|
||||
cat.setAttribute('name', name)
|
||||
cat.setAttribute('label', label)
|
||||
self.changeLayout(layout)
|
||||
self.parentTabsLayout.appendChild(cat)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue