annotate pyink/extensions.py @ 1381:9a585df24e52

Consider the width and height attribute for the rect elements. The inkscape will change the width and height directly without using transform when we resize the rectangle.
author wycc
date Wed, 23 Mar 2011 23:02:36 +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