Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
182:556c2bd7c344 | 183:9ee4a1d0d7fb |
---|---|
84 ctrl = wx.TextCtrl(parent, -1, value, style=wx.TE_PASSWORD) | 84 ctrl = wx.TextCtrl(parent, -1, value, style=wx.TE_PASSWORD) |
85 self.ctrl_list[name] = ({'type':type, 'control':ctrl}) | 85 self.ctrl_list[name] = ({'type':type, 'control':ctrl}) |
86 _proportion = 1 | 86 _proportion = 1 |
87 elif type=="textbox": | 87 elif type=="textbox": |
88 ctrl = wx.TextCtrl(parent, -1, value, style=wx.TE_MULTILINE) | 88 ctrl = wx.TextCtrl(parent, -1, value, style=wx.TE_MULTILINE) |
89 self.ctrl_list[name] = ({'type':type, 'control':ctrl}) | |
90 _proportion = 1 | |
91 elif type=="bool": | |
92 ctrl = wx.CheckBox(panel, -1, "", style = wx.CHK_2STATE) | |
93 ctrl.SetValue(value=="true") | |
89 self.ctrl_list[name] = ({'type':type, 'control':ctrl}) | 94 self.ctrl_list[name] = ({'type':type, 'control':ctrl}) |
90 _proportion = 1 | 95 _proportion = 1 |
91 elif type=="list": | 96 elif type=="list": |
92 style=wx.LB_MULTIPLE if elem.getAttribute("multi")=='yes' else wx.LB_SINGLE | 97 style=wx.LB_MULTIPLE if elem.getAttribute("multi")=='yes' else wx.LB_SINGLE |
93 ctrl = wx.ListBox(parent, -1, choices=[option.getAttribute("value") for option in elem.getElementsByTagName("option")], style=style) | 98 ctrl = wx.ListBox(parent, -1, choices=[option.getAttribute("value") for option in elem.getElementsByTagName("option")], style=style) |
136 self.__parseElems(node, current) | 141 self.__parseElems(node, current) |
137 if parent: | 142 if parent: |
138 parent.sizer.Add(current, _proportion, flag=wx.EXPAND) | 143 parent.sizer.Add(current, _proportion, flag=wx.EXPAND) |
139 elif node.nodeName == "category": | 144 elif node.nodeName == "category": |
140 name = node.getAttribute('name') | 145 name = node.getAttribute('name') |
146 label = node.getAttribute('label') | |
141 if not node.nodeName in wanted or not name or not isinstance(parent,wx.Notebook): | 147 if not node.nodeName in wanted or not name or not isinstance(parent,wx.Notebook): |
142 raise Exception("Invalid XMLUI") #TODO: make a custom exception | 148 raise Exception("Invalid XMLUI") #TODO: make a custom exception |
143 notebook = parent | 149 notebook = parent |
144 tab_panel = wx.Panel(notebook, -1) | 150 tab_panel = wx.Panel(notebook, -1) |
145 tab_panel.sizer = wx.BoxSizer(wx.VERTICAL) | 151 tab_panel.sizer = wx.BoxSizer(wx.VERTICAL) |
146 tab_panel.SetSizer(tab_panel.sizer) | 152 tab_panel.SetSizer(tab_panel.sizer) |
147 notebook.AddPage(tab_panel, name) | 153 notebook.AddPage(tab_panel, label or name) |
148 self.__parseChilds(tab_panel, None, node, ['layout']) | 154 self.__parseChilds(tab_panel, None, node, ['layout']) |
149 | 155 |
150 else: | 156 else: |
151 message=_("Unknown tag") | 157 message=_("Unknown tag") |
152 error(message) | 158 error(message) |
209 data = [] | 215 data = [] |
210 for ctrl_name in self.ctrl_list: | 216 for ctrl_name in self.ctrl_list: |
211 ctrl = self.ctrl_list[ctrl_name] | 217 ctrl = self.ctrl_list[ctrl_name] |
212 if isinstance(ctrl['control'], wx.ListBox): | 218 if isinstance(ctrl['control'], wx.ListBox): |
213 data.append((ctrl_name, ctrl['control'].GetStringSelection())) | 219 data.append((ctrl_name, ctrl['control'].GetStringSelection())) |
220 elif isinstance(ctrl['control'], wx.CheckBox): | |
221 data.append((ctrl_name, "true" if ctrl['control'].GetValue() else "false")) | |
214 else: | 222 else: |
215 data.append((ctrl_name, ctrl['control'].GetValue())) | 223 data.append((ctrl_name, ctrl['control'].GetValue())) |
216 if self.misc.has_key('action_back'): #FIXME FIXME FIXME: WTF ! Must be cleaned | 224 if self.misc.has_key('action_back'): #FIXME FIXME FIXME: WTF ! Must be cleaned |
217 id = self.misc['action_back']("SUBMIT",self.misc['target'], data) | 225 id = self.misc['action_back']("SUBMIT",self.misc['target'], data) |
218 self.host.current_action_ids.add(id) | 226 self.host.current_action_ids.add(id) |