comparison frontends/src/wix/xmlui.py @ 587:952322b1d490

Remove trailing whitespaces.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:34 +0100
parents ca13633d3b6b
children 84a6e83157c2
comparison
equal deleted inserted replaced
586:6a718ede8be1 587:952322b1d490
41 self.ctrl_list = {} # usefull to access ctrl 41 self.ctrl_list = {} # usefull to access ctrl
42 42
43 self.sizer = wx.BoxSizer(wx.VERTICAL) 43 self.sizer = wx.BoxSizer(wx.VERTICAL)
44 self.SetSizer(self.sizer) 44 self.SetSizer(self.sizer)
45 self.SetAutoLayout(True) 45 self.SetAutoLayout(True)
46 46
47 #events 47 #events
48 if not 'NO_CANCEL' in self.options: 48 if not 'NO_CANCEL' in self.options:
49 self.Bind(wx.EVT_CLOSE, self.onClose, self) 49 self.Bind(wx.EVT_CLOSE, self.onClose, self)
50 50
51 self.MakeModal() 51 self.MakeModal()
52 52
53 self.constructUI(xml_data) 53 self.constructUI(xml_data)
54 54
55 self.Show() 55 self.Show()
81 self.ctrl_list[name] = ({'type':type, 'control':ctrl}) 81 self.ctrl_list[name] = ({'type':type, 'control':ctrl})
82 _proportion = 1 82 _proportion = 1
83 elif type=="password": 83 elif type=="password":
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}) 89 self.ctrl_list[name] = ({'type':type, 'control':ctrl})
90 _proportion = 1 90 _proportion = 1
91 elif type=="bool": 91 elif type=="bool":
140 current.SetSizer(current.sizer) 140 current.SetSizer(current.sizer)
141 self.__parseElems(node, current) 141 self.__parseElems(node, current)
142 if parent: 142 if parent:
143 parent.sizer.Add(current, _proportion, flag=wx.EXPAND) 143 parent.sizer.Add(current, _proportion, flag=wx.EXPAND)
144 elif node.nodeName == "category": 144 elif node.nodeName == "category":
145 name = node.getAttribute('name') 145 name = node.getAttribute('name')
146 label = node.getAttribute('label') 146 label = node.getAttribute('label')
147 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):
148 raise Exception("Invalid XMLUI") #TODO: make a custom exception 148 raise Exception("Invalid XMLUI") #TODO: make a custom exception
149 notebook = parent 149 notebook = parent
150 tab_panel = wx.Panel(notebook, -1) 150 tab_panel = wx.Panel(notebook, -1)
151 tab_panel.sizer = wx.BoxSizer(wx.VERTICAL) 151 tab_panel.sizer = wx.BoxSizer(wx.VERTICAL)
152 tab_panel.SetSizer(tab_panel.sizer) 152 tab_panel.SetSizer(tab_panel.sizer)
153 notebook.AddPage(tab_panel, label or name) 153 notebook.AddPage(tab_panel, label or name)
154 self.__parseChilds(tab_panel, None, node, ['layout']) 154 self.__parseChilds(tab_panel, None, node, ['layout'])
155 155
160 160
161 161
162 def constructUI(self, xml_data): 162 def constructUI(self, xml_data):
163 panel=wx.Panel(self) 163 panel=wx.Panel(self)
164 panel.sizer = wx.BoxSizer(wx.VERTICAL) 164 panel.sizer = wx.BoxSizer(wx.VERTICAL)
165 165
166 cat_dom = minidom.parseString(xml_data.encode('utf-8')) 166 cat_dom = minidom.parseString(xml_data.encode('utf-8'))
167 top= cat_dom.documentElement 167 top= cat_dom.documentElement
168 self.type = top.getAttribute("type") 168 self.type = top.getAttribute("type")
169 self.title = top .getAttribute("title") 169 self.title = top .getAttribute("title")
170 if self.title: 170 if self.title:
228 self.misc['callback'](data) 228 self.misc['callback'](data)
229 else: 229 else:
230 warning (_("The form data is not sent back, the type is not managed properly")) 230 warning (_("The form data is not sent back, the type is not managed properly"))
231 self.MakeModal(False) 231 self.MakeModal(False)
232 self.Destroy() 232 self.Destroy()
233 233
234 def onFormCancelled(self, event): 234 def onFormCancelled(self, event):
235 """Called when cancel button is clicked""" 235 """Called when cancel button is clicked"""
236 debug(_("Cancelling form")) 236 debug(_("Cancelling form"))
237 self.MakeModal(False) 237 self.MakeModal(False)
238 self.Close() 238 self.Close()
239 239
240 def onClose(self, event): 240 def onClose(self, event):
241 """Close event: we have to send the form.""" 241 """Close event: we have to send the form."""
242 debug(_("close")) 242 debug(_("close"))
243 self.MakeModal(False) 243 self.MakeModal(False)
244 event.Skip() 244 event.Skip()