|
2 | 2 | from PyQt5 import QtWebEngineWidgets, QtWebEngineCore |
3 | 3 | from PyQt5.QtCore import Qt, QPoint, QSettings |
4 | 4 | from floppy.templates import TEMPLATES |
5 | | -''' |
6 | | -TEMPLATES = {} |
7 | 5 |
|
8 | | -
|
9 | | -
|
10 | | -def template(func): |
11 | | - TEMPLATES[func.__name__] = func |
12 | | - return func |
13 | | -
|
14 | | -
|
15 | | -
|
16 | | -@template |
17 | | -def defaultTemplate(data, cache): |
18 | | - return """<h1 id="head">{nodeName} -- {nodeID}</h1> |
19 | | - <style> |
20 | | - h1 {{ text-align:center; color: white}}; |
21 | | - </style> |
22 | | -
|
23 | | - <style type="text/css"> |
24 | | - #wrap {{ |
25 | | - width:400; |
26 | | - margin:0 auto; |
27 | | - }} |
28 | | - #left_col {{ |
29 | | - float:left; |
30 | | - width:200; |
31 | | - text-align:left; |
32 | | - color: white |
33 | | - }} |
34 | | - #right_col {{ |
35 | | - float:right; |
36 | | - width:200; |
37 | | - text-align:right; |
38 | | - color: white |
39 | | - }} |
40 | | - </style> |
41 | | - <div id="wrap"> |
42 | | - <div id="left_col"> |
43 | | - {inputs} |
44 | | - </div> |
45 | | - <div id="right_col"> |
46 | | - {outputs} |
47 | | - </div> |
48 | | - </div>""".format(nodeName=data['class'], nodeID=data['ID'], |
49 | | - inputs='<br>'.join(['{}[{}]: {}'.format(name, varType, value) for name, varType, value in data['inputs']]), |
50 | | - outputs='<br>'.join(['{}[{}]: {}'.format(name, varType, value) for name, varType, value in data['outputs']])) |
51 | | -
|
52 | | -''' |
53 | | -#class ReportWidget(QtWebKitWidgets.QWebView): |
54 | 6 | class ReportWidget(QtWebEngineWidgets.QWebEngineView): |
55 | 7 |
|
56 | 8 | def __init__(self, *args, **kwargs): |
@@ -106,62 +58,6 @@ def _update(self): |
106 | 58 | #scrollValue = self.page().scrollPosition() |
107 | 59 | self.setHtml(tmplt(data, self.cache[:], self.fileBase, self.width()), url) |
108 | 60 |
|
109 | | -''' |
110 | | -@template |
111 | | -def defaultTemplate(data, cache, fileBase): |
112 | | - return """ |
113 | | - <style> |
114 | | - h1 {{ text-align:center; color: white}} |
115 | | - </style> |
116 | | -
|
117 | | - <style type="text/css"> |
118 | | - #wrap {{ |
119 | | - width:400; |
120 | | - margin:0 auto; |
121 | | - }} |
122 | | - #left_col {{ |
123 | | - float:left; |
124 | | - width:200; |
125 | | - text-align:left; |
126 | | - color: white |
127 | | - }} |
128 | | - #right_col {{ |
129 | | - float:right; |
130 | | - width:200; |
131 | | - text-align:right; |
132 | | - color: white |
133 | | - }} |
134 | | - </style> |
135 | | - <HTML> |
136 | | - <h1 id="head">{nodeName} -- {nodeID}</h1> |
137 | | - <div id="wrap"> |
138 | | - <div id="left_col"> |
139 | | - {inputs} |
140 | | - </div> |
141 | | - <div id="right_col"> |
142 | | - {outputs} |
143 | | - </div> |
144 | | - </div></HTML> |
145 | | - """.format(nodeName=data['class'], nodeID=data['ID'], |
146 | | - inputs='<br>'.join(['{}[{}]: {}'.format(name, varType, value) for name, varType, value in data['inputs']]), |
147 | | - outputs='<br>'.join(['{}[{}]: {}'.format(name, varType, value) for name, varType, value in data['outputs']])) |
148 | | -''' |
149 | | -from floppy.quickPlot import test |
150 | | -def defaultTemplate(data, cache, fileBase, width): |
151 | | - print(width) |
152 | | - |
153 | | - return ''' |
154 | | -<HTML> |
155 | 61 |
|
156 | | - <BODY bgcolor="#606060"> |
157 | | - <H1>{nodeName}</H1> |
158 | | - <div id=nodeID>ID: {ID} </div> |
159 | | - <P>This is very minimal "hello world" HTML document.</P> |
160 | | -{plot} |
161 | | - </BODY> |
162 | | -</HTML> |
163 | | - '''.format(nodeName=data['class'], |
164 | | - ID=data['ID'], |
165 | | - plot=test(width-30)) |
166 | 62 |
|
167 | 63 |
|
0 commit comments