本文整理汇总了Python中inkex.Effect方法的典型用法代码示例。如果您正苦于以下问题:Python inkex.Effect方法的具体用法?Python inkex.Effect怎么用?Python inkex.Effect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inkex
的用法示例。
在下文中一共展示了inkex.Effect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
inkex.Effect.__init__(self)
self.settings = Settings()
self.OptionParser.add_option(
"-t", "--text", action="store", type="string",
dest="text", default=None)
self.OptionParser.add_option(
"-p", "--preamble-file", action="store", type="string",
dest="preamble_file",
default=self.settings.get('preamble', str, ""))
self.OptionParser.add_option(
"-s", "--scale-factor", action="store", type="float",
dest="scale_factor",
default=self.settings.get('scale', float, 1.0))
示例2: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
inkex.Effect.__init__(self)
self.inkscapeResolution_dpi = 96.0 # number of pixels per inch
resolution_in = self.inkscapeResolution_dpi
resolution_mm = self.inkscapeResolution_dpi / 25.4
self.unitsDict = {'mm': resolution_mm, # 25.4mm per inch
'cm': resolution_mm * 10.0, # 1cm = 10mm
'm': resolution_mm * 1.0e3, # 1m = 1000mm
'km': resolution_mm * 1.0e6, # 1km = 1e6mm
'in': resolution_in, # 1in = 96px
'ft': resolution_in * 12.0, # foot = 12*in
'yd': resolution_in * 12.0 * 3.0, # yard = 3*ft
'pt': resolution_in / 72.0, # point 1pt = 1/72th of an inch
'px': 1.0, 'pc': resolution_in / 6.0} # picas 1pc = 1/6th of and inch
# coordinates o the origin of the grid. unfortunately the grid does not fit
# x0=0
# y0=-7.637817382813
示例3: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
"""
Constructor.
"""
inkex.Effect.__init__(self)
self.arg_parser.add_argument(
'-c', '--conversion',
dest='conversion', default='top',
help='Conversion to perform: (top|left|right)')
self.arg_parser.add_argument(
'-r', '--reverse',
dest='reverse', default="false",
help='Reverse the transformation from isometric projection ' +
'to flat 2D')
示例4: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
"""
Constructor.
Defines the "--name" option of a script.
"""
# Call the base class constructor.
inkex.Effect.__init__(self)
#import matplotlib
#Define string option "--name" with "-n" shortcut and default value "World".
self.arg_parser.add_argument('-n', '--name', action = 'store',
type = str, dest = 'name', default = 'none',
help = 'Name group')
inkex.NSS[u"figurefirst"] = u"http://flyranch.github.io/figurefirst/"
try:
etree.register_namespace("figurefirst","http://flyranch.github.io/figurefirst/")
except AttributeError:
#inkex.etree._NamespaceRegistry.update(inkex.addNS("name", "figurefirst"))
#This happens on windows version of inkscape - it might be good to check
#and see if the namespace has been correctly added to the document
pass
示例5: effect
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def effect(self):
"""
Effect behaviour.
Overrides base class' method and inserts "Hello World" text into SVG document.
"""
# Get script's "--what" option value.
name = self.options.name
# Get access to main SVG document element and get its dimensions.
svg = self.document.getroot()
# or alternatively
# Create text element
if len(self.svg.selected.values())>1:
raise Exception('too many items')
else:
el = list(self.svg.selected.values())[0]
newElm = etree.Element(inkex.addNS("group", "figurefirst"))
newElm.attrib[inkex.addNS("name", "figurefirst")] = name
#print inkex.NSS
el.append(newElm)
# Create effect instance and apply it.
示例6: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
"""
Constructor.
Defines the "--name" option of a script.
"""
# Call the base class constructor.
inkex.Effect.__init__(self)
#import matplotlib
#Define string option "--name" with "-n" shortcut and default value "World".
self.arg_parser.add_argument('-n', '--name', action = 'store',
type = str, dest = 'name', default = 'none',
help = 'Name linespec')
inkex.NSS[u"figurefirst"] = u"http://flyranch.github.io/figurefirst/"
try:
etree.register_namespace("figurefirst","http://flyranch.github.io/figurefirst/")
except AttributeError:
#inkex.etree._NamespaceRegistry.update(inkex.addNS("name", "figurefirst"))
#This happens on windows version of inkscape - it might be good to check
#and see if the namespace has been correctly added to the document
pass
示例7: effect
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def effect(self):
"""
Effect behaviour.
Overrides base class' method and inserts "Hello World" text into SVG document.
"""
# Get script's "--what" option value.
name = self.options.name
# Get access to main SVG document element and get its dimensions.
svg = self.document.getroot()
# or alternatively
# Create text element
if len(self.svg.selected.values())>1:
raise Exception('too many items')
else:
el = list(self.svg.selected.values())[0]
newElm = etree.Element(inkex.addNS("linespec", "figurefirst"))
newElm.attrib[inkex.addNS("name", "figurefirst")] = name
#print inkex.NSS
el.append(newElm)
# Create effect instance and apply it.
示例8: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
"""
Constructor.
Defines the "--name" option of a script.
"""
# Call the base class constructor.
inkex.Effect.__init__(self)
#import matplotlib
#Define string option "--name" with "-n" shortcut and default value "World".
self.arg_parser.add_argument('-n', '--name', action = 'store',
type =str, dest = 'name', default = 'none',
help = 'Name figure')
self.arg_parser.add_argument('-t', '--template', action = 'store',
type = str, dest = 'template', default = 'none',
help = 'Name template (optional)')
inkex.NSS[u"figurefirst"] = u"http://flyranch.github.io/figurefirst/"
try:
etree.register_namespace("figurefirst","http://flyranch.github.io/figurefirst/")
except AttributeError:
#inkex.etree._NamespaceRegistry.update(inkex.addNS("name", "figurefirst"))
#This happens on windows version of inkscape - it might be good to check
#and see if the namespace has been correctly added to the document
pass
示例9: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
"""
Constructor.
Defines the "--spinespec" option of a script.
"""
# Call the base class constructor.
inkex.Effect.__init__(self)
#import matplotlib
#Define string option "--spinespec" with "-sp" shortcut and default value "left,bottom".
self.arg_parser.add_argument('-s', '--spinespec', action = 'store',
type =str, dest = 'spinespec', default = 'left,bottom',
help = "Add a spine specification as a comma separated list of spine locations. \n Valid values are: top,bottom,right or left")
inkex.NSS[u"figurefirst"] = u"http://flyranch.github.io/figurefirst/"
try:
etree.register_namespace("figurefirst","http://flyranch.github.io/figurefirst/")
except AttributeError:
#inkex.etree._NamespaceRegistry.update(inkex.addNS("name", "figurefirst"))
#This happens on windows version of inkscape - it might be good to check
#and see if the namespace has been correctly added to the document
pass
示例10: effect
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def effect(self):
"""
Effect behaviour.
"""
# Get script's "--what" option value.
spinelist = self.options.spinespec
# Get access to main SVG document element and get its dimensions.
svg = self.document.getroot()
# or alternatively
# Create text element
if len(self.svg.selected.values())>1:
raise Exception('too many items')
else:
el = list(self.svg.selected.values())[0]
newElm = etree.Element(inkex.addNS("spinespec", "figurefirst"))
newElm.attrib[inkex.addNS("spinelist", "figurefirst")] = spinelist
#print inkex.NSS
el.append(newElm)
# Create effect instance and apply it.
示例11: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
"""
Constructor.
Defines the "--name" option of a script.
"""
# Call the base class constructor.
inkex.Effect.__init__(self)
#Define string option "--mplmethod" with "-m" shortcut and default value "none".
self.arg_parser.add_argument('-m', '--mplmethod', action = 'store',
type = str, dest = 'mplmethod', default = 'none',
help = 'Method name')
#Define string option "--mplmethodarg" with "-z" shortcut and default value "none".
self.arg_parser.add_argument('-a', '--mplmethodarg', action = 'store',
type = str, dest = 'mplmethodarg', default = 'none',
help = 'Method arguments')
inkex.NSS[u"figurefirst"] = u"http://flyranch.github.io/figurefirst/"
try:
etree.register_namespace("figurefirst","http://flyranch.github.io/figurefirst/")
except AttributeError:
#inkex.etree._NamespaceRegistry.update(inkex.addNS("name", "figurefirst"))
#This happens on windows version of inkscape - it might be good to check
#and see if the namespace has been correctly added to the document
pass
示例12: effect
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def effect(self):
"""
Effect behaviour.
Overrides base class' method and inserts figurefirst:mplmethods node into SVG document,
with figurefirst:mplmethod, mplmethodarg attribute, value pair.
"""
# Get script's "--what" option value.
mplmethod = self.options.mplmethod
mplmethodarg = self.options.mplmethodarg
# Get access to main SVG document element and get its dimensions.
svg = self.document.getroot()
# or alternatively
# Create text element
if len(self.svg.selected.values())>1:
raise Exception('too many items')
else:
el = list(self.svg.selected.values())[0]
newElm = etree.Element(inkex.addNS("mplmethods", "figurefirst"))
newElm.attrib[inkex.addNS(mplmethod, "figurefirst")] = mplmethodarg
#print inkex.NSS
el.append(newElm)
# Create effect instance and apply it.
示例13: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
"""
Constructor.
Defines the "--name" option of a script.
"""
# Call the base class constructor.
inkex.Effect.__init__(self)
#import matplotlib
#Define string option "--name" with "-n" shortcut and default value "World".
self.arg_parser.add_argument('-n', '--name', action = 'store',
type = str, dest = 'name', default = 'none',
help = 'Name svgitem')
inkex.NSS[u"figurefirst"] = u"http://flyranch.github.io/figurefirst/"
try:
etree.register_namespace("figurefirst","http://flyranch.github.io/figurefirst/")
except AttributeError:
#inkex.etree._NamespaceRegistry.update(inkex.addNS("name", "figurefirst"))
#This happens on windows version of inkscape - it might be good to check
#and see if the namespace has been correctly added to the document
pass
示例14: __init__
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def __init__(self):
"""
Constructor.
Defines the "--name" option of a script.
"""
# Call the base class constructor.
inkex.Effect.__init__(self)
#import matplotlib
#Define string option "--name" with "-n" shortcut and default value "World".
self.arg_parser.add_argument('-n', '--name', action = 'store',
type = str, dest = 'name', default = 'none',
help = 'Name patch')
inkex.NSS[u"figurefirst"] = u"http://flyranch.github.io/figurefirst/"
try:
etree.register_namespace("figurefirst","http://flyranch.github.io/figurefirst/")
except AttributeError:
#inkex.etree._NamespaceRegistry.update(inkex.addNS("name", "figurefirst"))
#This happens on windows version of inkscape - it might be good to check
#and see if the namespace has been correctly added to the document
pass
示例15: effect
# 需要导入模块: import inkex [as 别名]
# 或者: from inkex import Effect [as 别名]
def effect(self):
"""
Effect behaviour.
Overrides base class' method and inserts "Hello World" text into SVG document.
"""
# Get script's "--what" option value.
name = self.options.name
# Get access to main SVG document element and get its dimensions.
svg = self.document.getroot()
# or alternatively
# Create text element
if len(self.svg.selected.values())>1:
raise Exception('too many items')
else:
el = list(self.svg.selected.values())[0]
newElm = etree.Element(inkex.addNS("patchspec", "figurefirst"))
newElm.attrib[inkex.addNS("name", "figurefirst")] = name
#print inkex.NSS
el.append(newElm)
# Create effect instance and apply it.