diff -r 7685cec9fd3c -r f2ddfa555b0f doc/api/python/helium.output.widgets-pysrc.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/api/python/helium.output.widgets-pysrc.html Fri Sep 11 11:54:49 2009 +0100 @@ -0,0 +1,1863 @@ + + + + + helium.output.widgets + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package helium :: + Package output :: + Module widgets + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module helium.output.widgets

+
+  1  #============================================================================  
+  2  #Name        : widgets.py  
+  3  #Part of     : Helium  
+  4   
+  5  #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+  6  #All rights reserved. 
+  7  #This component and the accompanying materials are made available 
+  8  #under the terms of the License "Eclipse Public License v1.0" 
+  9  #which accompanies this distribution, and is available 
+ 10  #at the URL "http://www.eclipse.org/legal/epl-v10.html". 
+ 11  # 
+ 12  #Initial Contributors: 
+ 13  #Nokia Corporation - initial contribution. 
+ 14  # 
+ 15  #Contributors: 
+ 16  # 
+ 17  #Description: 
+ 18  #=============================================================================== 
+ 19   
+ 20   
+ 21  # pylint: disable-msg=E1101 
+ 22   
+ 23  import xml.dom.minidom 
+
24 -class Widget: +
25 - def __init__(self): +
26 pass +
27 +
28 - def getDOMContainer(self): +
29 pass +
30 + 31 +
32 -class Box(Widget): +
33 - def __init__(self, doc, container, divId = "mb", divClass = "mc"): +
34 Widget.__init__(self) + 35 d1 = doc.createElementNS("", "div") + 36 d1.setAttributeNS("", "id", divId) + 37 container.appendChild(d1) + 38 mc = doc.createElementNS("", "div") + 39 mc.setAttributeNS("", "class", divClass) + 40 d1.appendChild(mc) + 41 self.__doc = doc + 42 self.__title = None + 43 self.__mc = mc +
44 +
45 - def setTitle(self, title=""): +
46 if self.__title == None: + 47 t = self.__doc.createElementNS("", "h1") + 48 self.__mc.insertBefore(t, self.__mc.firstChild) + 49 self.__title = self.__doc.createTextNode(title) + 50 t.appendChild(self.__title) + 51 self.__title.data = title +
52 +
53 - def getDOMContainer(self): +
54 return self.__mc +
55 +
56 -class Summary(Box): +
57 - def __init__(self, doc, container): +
58 Box.__init__(self, doc, container, divId = "s_mb", divClass = "s_mc") + 59 self.__table = doc.createElementNS("", "table") + 60 self.__table.setAttributeNS("", "cellspacing", "0") + 61 self.__table.setAttributeNS("", "cellpadding", "0") + 62 self.__table.setAttributeNS("", "border", "0") + 63 self.__table.setAttributeNS("", "width", "100%") + 64 self.__table.appendChild(self._Box__doc.createTextNode("")) + 65 div = self._Box__doc.createElementNS("", "div") + 66 div.setAttributeNS("", "class", "t_wrapper") + 67 div.appendChild(self.__table) + 68 self.getDOMContainer().appendChild(div) + 69 self.__table_stat = None + 70 self.setTitle() +
71 + 72 +
73 - def addElement(self, tag, value): +
74 row = self._Box__doc.createElementNS("", "tr") + 75 #Tag + 76 td = self._Box__doc.createElementNS("", "td") + 77 td.setAttributeNS("", "valign", "top") + 78 td.setAttributeNS("", "nowrap", "nowrap") + 79 div = self._Box__doc.createElementNS("", "div") + 80 div.setAttributeNS("", "class", "s_tag") + 81 div.appendChild(self._Box__doc.createTextNode(tag)) + 82 td.appendChild(div) + 83 row.appendChild(td) + 84 + 85 # Value + 86 td = self._Box__doc.createElementNS("", "td") + 87 td.setAttributeNS("", "width", "100%") + 88 div = self._Box__doc.createElementNS("", "div") + 89 div.setAttributeNS("", "class", "s_val") + 90 div.appendChild(self._Box__doc.createTextNode(value)) + 91 td.appendChild(div) + 92 row.appendChild(td) + 93 + 94 self.__table.appendChild(row) +
95 +
96 - def addStatistics(self, type, value): +
97 if self.__table_stat == None: + 98 h1 = self._Box__doc.createElementNS("", "h1") + 99 h1.appendChild(self._Box__doc.createTextNode("Global Statistics")) +100 self.getDOMContainer().appendChild(h1) +101 +102 div = self._Box__doc.createElementNS("", "div") +103 div.setAttributeNS("", "class", "t_wrapper") +104 self.getDOMContainer().appendChild(div) +105 self.__table_stat = self._Box__doc.createElementNS("", "table") +106 self.__table_stat.setAttributeNS("", "cellspacing", "0") +107 self.__table_stat.setAttributeNS("", "cellpadding", "0") +108 self.__table_stat.setAttributeNS("", "border", "0") +109 self.__table_stat.setAttributeNS("", "width", "100%") +110 div.appendChild(self.__table_stat) +111 +112 row = self._Box__doc.createElementNS("", "tr") +113 self.__table_stat.appendChild(row) +114 self.__table_stat = row +115 +116 td = self._Box__doc.createElementNS("", "td") +117 div = self._Box__doc.createElementNS("", "div") +118 div.setAttributeNS("", "class", "gbl_cnt_" + type) +119 div.appendChild(self._Box__doc.createTextNode("%d %ss" % (value, type))) +120 td.appendChild(div) +121 self.__table_stat.appendChild(td) +
122 +123 +124 +
125 -class Event(Widget): +
126 - def __init__(self, doc, container, id): +
127 Widget.__init__(self) +128 self.__doc = doc +129 node_head = doc.createElementNS("", "div") +130 node_head.setAttributeNS("", "class", "node_head") +131 container.appendChild(node_head) +132 +133 link = doc.createElementNS("", "a") +134 link.setAttributeNS("", "href", "javascript:ToggleNode('Img%d')" % id) +135 node_head.appendChild(link) +136 +137 span = doc.createElementNS("", "span") +138 span.setAttributeNS("", "id", "Img%d" % id) +139 span.setAttributeNS("", "style", "background:url(http://fawww.europe.nokia.com/isis/isis_interface/img/icons/button_open.gif) no-repeat") +140 link.appendChild(span) +141 +142 stitle = doc.createElementNS("", "span") +143 stitle.setAttributeNS("", "class", "node_title") +144 self.__title = doc.createTextNode("") +145 stitle.appendChild(self.__title) +146 span.appendChild(stitle) +147 +148 # shaow all +149 showall = doc.createElementNS("", "a") +150 showall.setAttributeNS("", "href", "javascript:ShowChilds('Img%d')" % id) +151 span = doc.createElementNS("", "span") +152 span.setAttributeNS("", "class", "node_action") +153 span.appendChild(doc.createTextNode("[Show All]")) +154 showall.appendChild(span) +155 +156 #hide all +157 hideall = doc.createElementNS("", "a") +158 hideall.setAttributeNS("", "href", "javascript:HideChilds('Img%d')" % id) +159 span = doc.createElementNS("", "span") +160 span.setAttributeNS("", "class", "node_action") +161 span.appendChild(doc.createTextNode("[Hide All]")) +162 hideall.appendChild(span) +163 +164 #toggle node +165 self.__togglenode = doc.createElementNS("", "a") +166 self.__togglenode.setAttributeNS("", "href", "javascript:ToggleNode('Img%d')" % id) +167 self.__togglenode.appendChild(doc.createTextNode("")) +168 # append container +169 node_head.appendChild(showall) +170 node_head.appendChild(hideall) +171 node_head.appendChild(self.__togglenode) +172 +173 contentx = doc.createElementNS("", "div") +174 contentx.setAttributeNS("", "id", "Content%d" % id) +175 contentx.setAttributeNS("", "style", "display:none") +176 container.appendChild(contentx) +177 content = doc.createElementNS("", "div") +178 content.setAttributeNS("", 'class', "node_content") +179 content.appendChild(doc.createTextNode("")) +180 contentx.appendChild(content) +181 self.__container = content +182 self.__node_info = None +
183 +
184 - def setTitle(self, title = ""): +
185 self.__title.data = title +
186 +
187 - def addStatistics(self, type, value): +
188 if self.__node_info == None: +189 self.__node_info = self.__doc.createElementNS("", "span") +190 self.__node_info.setAttributeNS("", "class", "node_info") +191 self.__togglenode.appendChild(self.__node_info) +192 span = self.__doc.createElementNS("", "span") +193 span.setAttributeNS("", "class","cnt_%s" % type) +194 span.appendChild(self.__doc.createTextNode("%d %ss" % (value, type))) +195 self.__node_info.appendChild(span) +
196 #<span class="node_info"> +197 # <span class="cnt_warning">2 warnings</span> +198 #</span> +199 +
200 - def getDOMContainer(self): +
201 return self.__container +
202 +203 +
204 -class Header(Widget): +
205 - def __init__(self, doc, container): +
206 Widget.__init__(self) +207 self.__doc = doc +208 h_wrapper = self.__doc.createElementNS("", "div") +209 h_wrapper.setAttributeNS("", "id", "h_wrapper") +210 h_elmt = self.__doc.createElementNS("", "div") +211 h_elmt.setAttributeNS("", "class", "h_elmt") +212 h_wrapper.appendChild(h_elmt) +213 container.appendChild(h_wrapper) +214 #title +215 t = self.__doc.createElementNS("", "div") +216 self.__title = doc.createTextNode("") +217 t.appendChild(self.__title) +218 t.setAttributeNS("", "class", "h_title") +219 h_elmt.appendChild(t) +220 #subtitle +221 t = self.__doc.createElementNS("", "div") +222 self.__subtitle = doc.createTextNode("") +223 t.appendChild(self.__subtitle) +224 t.setAttributeNS("", "class", "h_subtitle") +225 h_elmt.appendChild(t) +
226 +227 +228 +
229 - def setTitle(self, title): +
230 self.__title.data = title +
231 +
232 - def setSubTitle(self, title): +
233 self.__subtitle.data = title +234 +
235 - def getDOMContainer(self): +
236 return None +
237 +263 +
264 - def setSubTitle(self, title): +
265 self.__subtitle.data = title +266 +
267 -class Text(Widget): +
268 - def __init__(self, doc, container): +
269 Widget.__init__(self) +270 self.__doc = doc +271 self.__div = self.__doc.createElementNS("", "div") +272 self.__div.setAttributeNS("", "class", "icn_dft") +273 container.appendChild(self.__div) +
274 +
275 - def setIcon(self, name): +
276 self.__div.setAttributeNS("", "class", name) +
277 +
278 - def appendText(self, text): +
279 def pushContent(arg): +280 self.getDOMContainer().appendChild(self.__doc.createTextNode(arg)) +281 self.getDOMContainer().appendChild(self.__doc.createElementNS("","br")) +
282 map(pushContent, text.strip().split("\n")) +283 +
284 - def getDOMContainer(self): +
285 return self.__div +
286 +
287 -class RawText(Text): +
288 - def appendText(self, text): +
289 for child in xml.dom.minidom.parseString("<xhtml>" + text.strip() + "</xhtml>").documentElement.childNodes: +290 self.getDOMContainer().appendChild(child.cloneNode(True)) +
291 +
292 -class BoldText(Text): +
293 - def __init__(self, doc, container): +
294 Text.__init__(self, doc, container) +295 self.__bold = doc.createElementNS("","b") +296 self._Text__div.appendChild(self.__bold) +
297 +
298 - def getDOMContainer(self): +
299 return self.__bold +
300 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +