annotate pyink/extensions.py @ 1343:c2fbae4f0adc

Delegate to component_manager with method object
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 08 Feb 2011 13:35:21 +0800
parents 599b606c4669
children 2d56ed5b0995
rev   line source
1341
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
1 import pybExtension
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
2 import html5css3
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
3
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
4 _all_extensions = [html5css3.extension]
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
5
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
6 _DEBUG_FLAG_NAME = 'PYINK_EXT_DBG_ENABLE'
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
7
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
8 def _reg_extensions():
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
9 import os
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
10
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
11 if os.environ.has_key(_DEBUG_FLAG_NAME):
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
12 debug_level = int(os.environ[_DEBUG_FLAG_NAME])
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
13 else:
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
14 debug_level = 0
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
15 pass
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
16
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
17 if debug_level > 0:
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
18 print 'Loading extensions'
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
19 pass
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
20
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
21 for ext_imp, ext_id, ext_name, ioe_name, ioe_items in _all_extensions:
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
22 if debug_level > 0:
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
23 print ' register %s -- %s' % (ext_id, ext_name)
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
24 pass
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
25
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
26 #
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
27 # ioe_items is description items for input, output, and effect.
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
28 #
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
29 if ioe_name not in ('input', 'output', 'effect'):
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
30 raise ValueError, 'invalid extension type (%s)' % (ioe_name)
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
31
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
32 kws = {ioe_name: ioe_items}
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
33 pybExtension.register_extension(ext_imp, ext_id, ext_name, **kws)
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
34 pass
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
35 pass
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
36
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
37 def initial():
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
38 _reg_extensions()
599b606c4669 Start to implement HTML5/CSS3 exporter
Thinker K.F. Li <thinker@codemud.net>
parents:
diff changeset
39 pass