core (xmlui), frontends: handling of "text" type in params xml + bug fixes
This commit is contained in:
parent
b2f32986be
commit
8f0cf4697b
3 changed files with 9 additions and 7 deletions
|
|
@ -315,7 +315,7 @@ class XMLUI(object):
|
||||||
print(_("FIXME FIXME FIXME: widget type [%s] is not implemented") % type_)
|
print(_("FIXME FIXME FIXME: widget type [%s] is not implemented") % type_)
|
||||||
raise NotImplementedError(_("FIXME FIXME FIXME: type [%s] is not implemented") % type_)
|
raise NotImplementedError(_("FIXME FIXME FIXME: type [%s] is not implemented") % type_)
|
||||||
|
|
||||||
if self.type == 'param':
|
if self.type == 'param' and type_ != 'text':
|
||||||
try:
|
try:
|
||||||
ctrl._xmluiOnChange(self.onParamChange)
|
ctrl._xmluiOnChange(self.onParamChange)
|
||||||
ctrl._param_category = self._current_category
|
ctrl._param_category = self._current_category
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import wx
|
||||||
from logging import debug, info, warning, error
|
from logging import debug, info, warning, error
|
||||||
from sat.tools.jid import JID
|
from sat.tools.jid import JID
|
||||||
from sat_frontends.tools import xmlui
|
from sat_frontends.tools import xmlui
|
||||||
|
from sat_frontends.constants import Const
|
||||||
|
|
||||||
|
|
||||||
class EventWidget(object):
|
class EventWidget(object):
|
||||||
|
|
@ -280,7 +281,8 @@ class XMLUI(xmlui.XMLUI, wx.Frame):
|
||||||
def onParamChange(self, ctrl):
|
def onParamChange(self, ctrl):
|
||||||
super(XMLUI, self).onParamChange(ctrl)
|
super(XMLUI, self).onParamChange(ctrl)
|
||||||
### FIXME # Some hacks for better presentation, should be generic # FIXME ###
|
### FIXME # Some hacks for better presentation, should be generic # FIXME ###
|
||||||
if (ctrl._param_category, ctrl._param_name) == ('Connection', 'JabberID'):
|
param_name = ctrl._xmlui_name.split(Const.SAT_PARAM_SEPARATOR)[1]
|
||||||
|
if (ctrl._param_category, param_name) == ('Connection', 'JabberID'):
|
||||||
domain = JID(ctrl._xmluiGetValue()).domain
|
domain = JID(ctrl._xmluiGetValue()).domain
|
||||||
for widget in (ctl['control'] for ctl in self.ctrl_list.values()):
|
for widget in (ctl['control'] for ctl in self.ctrl_list.values()):
|
||||||
if (widget._param_category, widget._param_name) == ('Connection', 'Server'):
|
if (widget._param_category, widget._param_name) == ('Connection', 'Server'):
|
||||||
|
|
|
||||||
|
|
@ -199,10 +199,10 @@ def paramsXML2XMLUI(xml):
|
||||||
|
|
||||||
param_name = param.getAttribute('name')
|
param_name = param.getAttribute('name')
|
||||||
param_label = param.getAttribute('label')
|
param_label = param.getAttribute('label')
|
||||||
if not param_name:
|
type_ = param.getAttribute('type')
|
||||||
|
if not param_name and type_ != 'text':
|
||||||
raise exceptions.DataError(_('INTERNAL ERROR: params must have a name'))
|
raise exceptions.DataError(_('INTERNAL ERROR: params must have a name'))
|
||||||
|
|
||||||
type_ = param.getAttribute('type')
|
|
||||||
value = param.getAttribute('value') or None
|
value = param.getAttribute('value') or None
|
||||||
callback_id = param.getAttribute('callback_id') or None
|
callback_id = param.getAttribute('callback_id') or None
|
||||||
|
|
||||||
|
|
@ -210,7 +210,7 @@ def paramsXML2XMLUI(xml):
|
||||||
options = _getParamListOptions(param)
|
options = _getParamListOptions(param)
|
||||||
widget_kwargs['options'] = options
|
widget_kwargs['options'] = options
|
||||||
|
|
||||||
if type_ == "button":
|
if type_ in ("button", "text"):
|
||||||
param_ui.addEmpty()
|
param_ui.addEmpty()
|
||||||
value = param_label
|
value = param_label
|
||||||
else:
|
else:
|
||||||
|
|
@ -513,9 +513,9 @@ class EmptyWidget(Widget):
|
||||||
class TextWidget(Widget):
|
class TextWidget(Widget):
|
||||||
type = 'text'
|
type = 'text'
|
||||||
|
|
||||||
def __init__(self, xmlui, text, name=None, parent=None):
|
def __init__(self, xmlui, value, name=None, parent=None):
|
||||||
super(TextWidget, self).__init__(xmlui, name, parent)
|
super(TextWidget, self).__init__(xmlui, name, parent)
|
||||||
text = self.xmlui.doc.createTextNode(text)
|
text = self.xmlui.doc.createTextNode(value)
|
||||||
self.elem.appendChild(text)
|
self.elem.appendChild(text)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue