summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2009-03-18 20:58:41 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2009-03-18 20:58:41 +0000
commit8511f5d4be3f9aba890cf1e79d578f88c8483921 (patch)
tree8be3bd87ce4e27b3e506ef7c056529acee53c999
parentfix typos (diff)
downloadinkscape-8511f5d4be3f9aba890cf1e79d578f88c8483921.tar.gz
inkscape-8511f5d4be3f9aba890cf1e79d578f88c8483921.zip
display tooltip as well, control that it must exist
(bzr r7522)
-rw-r--r--share/filters/samplify.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/share/filters/samplify.py b/share/filters/samplify.py
index cbd875354..231f05f37 100644
--- a/share/filters/samplify.py
+++ b/share/filters/samplify.py
@@ -38,6 +38,7 @@ def addNS(tag, ns=None):
# attributes and elements we will use, prepared with their namespace
a_href = addNS('href', 'xlink')
a_menu = addNS('menu', 'inkscape')
+a_tooltip = addNS('menu-tooltip', 'inkscape')
a_label = addNS('label', 'inkscape')
e_text = addNS('text', 'svg')
e_tspan = addNS('tspan', 'svg')
@@ -128,6 +129,7 @@ for ch in root.getchildren():
menu = fi.attrib[a_menu]
clone.attrib["transform"] = 'translate('+str( q['width'] * menu_shifts[menu] )+', '+str( q['height'] * (menus.index(menu) + 1) )+')'
newroot.append(clone)
+
text = etree.Element(e_text, nsmap=NSS)
text.attrib['x']=str( q['x'] + q['width'] * (menu_shifts[menu] + 0.5) )
text.attrib['y']=str( q['y'] + q['height'] * (menus.index(menu) + 1.8) )
@@ -135,6 +137,17 @@ for ch in root.getchildren():
text.text = fi.attrib[a_label]
newroot.append(text)
+ if a_tooltip not in fi.keys():
+ print "no menu-tooltip for", fi.attrib["id"]
+ sys.exit()
+
+ text = etree.Element(e_text, nsmap=NSS)
+ text.attrib['x']=str( q['x'] + q['width'] * (menu_shifts[menu] + 0.5) )
+ text.attrib['y']=str( q['y'] + q['height'] * (menus.index(menu) + 1.9) )
+ text.attrib['style']="font-size:%d;text-anchor:middle;" % (q['height']*0.04)
+ text.text = fi.attrib[a_tooltip]
+ newroot.append(text)
+
menu_shifts[menu] = menu_shifts[menu] + 1
break