diff frontends/wix/xmlui.py @ 183:9ee4a1d0d7fb

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
author Goffi <goffi@goffi.org>
date Wed, 18 Aug 2010 15:57:26 +0800
parents 3c3f70c01333
children
line wrap: on
line diff
--- a/frontends/wix/xmlui.py	Wed Aug 18 12:45:48 2010 +0800
+++ b/frontends/wix/xmlui.py	Wed Aug 18 15:57:26 2010 +0800
@@ -88,6 +88,11 @@
                 ctrl = wx.TextCtrl(parent, -1, value, style=wx.TE_MULTILINE)
                 self.ctrl_list[name] = ({'type':type, 'control':ctrl})
                 _proportion = 1
+            elif type=="bool":
+                ctrl = wx.CheckBox(panel, -1, "", style = wx.CHK_2STATE)
+                ctrl.SetValue(value=="true")
+                self.ctrl_list[name] = ({'type':type, 'control':ctrl})
+                _proportion = 1
             elif type=="list":
                 style=wx.LB_MULTIPLE if elem.getAttribute("multi")=='yes' else wx.LB_SINGLE
                 ctrl = wx.ListBox(parent, -1, choices=[option.getAttribute("value") for option in elem.getElementsByTagName("option")], style=style)
@@ -138,13 +143,14 @@
                     parent.sizer.Add(current, _proportion, flag=wx.EXPAND)
             elif node.nodeName == "category":
                 name = node.getAttribute('name') 
+                label = node.getAttribute('label') 
                 if not node.nodeName in wanted or not name or not isinstance(parent,wx.Notebook):
                     raise Exception("Invalid XMLUI") #TODO: make a custom exception
                 notebook = parent
                 tab_panel = wx.Panel(notebook, -1) 
                 tab_panel.sizer = wx.BoxSizer(wx.VERTICAL)
                 tab_panel.SetSizer(tab_panel.sizer)
-                notebook.AddPage(tab_panel, name)
+                notebook.AddPage(tab_panel, label or name)
                 self.__parseChilds(tab_panel, None, node, ['layout'])
 
             else:
@@ -211,6 +217,8 @@
             ctrl = self.ctrl_list[ctrl_name]
             if isinstance(ctrl['control'], wx.ListBox):
                 data.append((ctrl_name, ctrl['control'].GetStringSelection()))
+            elif isinstance(ctrl['control'], wx.CheckBox):
+                data.append((ctrl_name, "true" if ctrl['control'].GetValue() else "false"))
             else:
                 data.append((ctrl_name, ctrl['control'].GetValue()))
         if self.misc.has_key('action_back'): #FIXME FIXME FIXME: WTF ! Must be cleaned