|
@@ -4,6 +4,24 @@
|
4
|
4
|
class GmonPluginError(Exception):
|
5
|
5
|
pass
|
6
|
6
|
|
|
7
|
+class XGPRenderer(object):
|
|
8
|
+
|
|
9
|
+ def __init__(self, txt=None):
|
|
10
|
+ self.txt = txt
|
|
11
|
+ self.img = None
|
|
12
|
+ self.tool = txt
|
|
13
|
+ self.bar = None
|
|
14
|
+ self.click = None
|
|
15
|
+ self._fields = ['txt', 'img', 'tool', 'bar', 'click']
|
|
16
|
+
|
|
17
|
+ def __str__(self):
|
|
18
|
+ out = ""
|
|
19
|
+ for field in self._fields:
|
|
20
|
+ value = getattr(self, field, None)
|
|
21
|
+ if value is not None:
|
|
22
|
+ out += "<%(f)s>%(v)s</%(f)s>" % {'f': field, 'v': value}
|
|
23
|
+ return out
|
|
24
|
+
|
7
|
25
|
|
8
|
26
|
class BasePlugin(object):
|
9
|
27
|
|
|
@@ -18,3 +36,6 @@ class BasePlugin(object):
|
18
|
36
|
|
19
|
37
|
render_fn = getattr(self, method_n, ex)
|
20
|
38
|
return render_fn()
|
|
39
|
+
|
|
40
|
+ def render_xgp(self):
|
|
41
|
+ return XGPRenderer(self.render_plain())
|