Classes | |
class | SVGDepthIterator |
nested class More... | |
Public Member Functions | |
def | __contains__ |
def | __delitem__ |
def | __eq__ |
def | __getitem__ |
def | __init__ |
def | __iter__ |
def | __ne__ |
def | __repr__ |
def | __setitem__ |
def | __str__ |
def | append |
def | breadth_first |
def | clone |
def | depth_first |
end nested class More... | |
def | extend |
def | firefox |
def | inkscape |
def | inkview |
def | interpret_fileName |
def | items |
def | keys |
def | prepend |
def | save |
def | standalone_xml |
def | tree |
def | values |
def | xml |
Public Attributes | |
attr | |
sub | |
t | |
Private Member Functions | |
def | __standalone_xml |
A tree representation of an SVG image or image fragment. SVG(t, sub, sub, sub..., attribute=value) t required SVG type name sub optional list nested SVG elements or text/Unicode attribute=value pairs optional keywords SVG attributes In attribute names, "__" becomes ":" and "_" becomes "-". SVG in XML <g id="mygroup" fill="blue"> <rect x="1" y="1" width="2" height="2" /> <rect x="3" y="3" width="2" height="2" /> </g> SVG in Python >>> svg = SVG("g", SVG("rect", x=1, y=1, width=2, height=2), \ ... SVG("rect", x=3, y=3, width=2, height=2), \ ... id="mygroup", fill="blue") Sub-elements and attributes may be accessed through tree-indexing: >>> svg = SVG("text", SVG("tspan", "hello there"), stroke="none", fill="black") >>> svg[0] <tspan (1 sub) /> >>> svg[0, 0] 'hello there' >>> svg["fill"] 'black' Iteration is depth-first: >>> svg = SVG("g", SVG("g", SVG("line", x1=0, y1=0, x2=1, y2=1)), \ ... SVG("text", SVG("tspan", "hello again"))) ... >>> for ti, s in svg: ... print ti, repr(s) ... (0,) <g (1 sub) /> (0, 0) <line x2=1 y1=0 x1=0 y2=1 /> (0, 0, 'x2') 1 (0, 0, 'y1') 0 (0, 0, 'x1') 0 (0, 0, 'y2') 1 (1,) <text (1 sub) /> (1, 0) <tspan (1 sub) /> (1, 0, 0) 'hello again' Use "print" to navigate: >>> print svg None <g (2 sub) /> [0] <g (1 sub) /> [0, 0] <line x2=1 y1=0 x1=0 y2=1 /> [1] <text (1 sub) /> [1, 0] <tspan (1 sub) />
def svgfig.SVG.__init__ | ( | self, | |
t_sub, | |||
attr | |||
) |
Definition at line 123 of file svgfig.py.
def svgfig.SVG.__contains__ | ( | self, | |
value | |||
) |
x in svg == True iff x is an attribute in svg.
Definition at line 168 of file svgfig.py.
References svgfig.SVG.attr.
def svgfig.SVG.__delitem__ | ( | self, | |
ti | |||
) |
def svgfig.SVG.__eq__ | ( | self, | |
other | |||
) |
x == y iff x represents the same SVG as y.
Definition at line 172 of file svgfig.py.
References svgfig.SVG.attr, svgfig.SVG.sub, AlignmentMonitorMuonSystemMap1D::MyCSCDetId.t, and svgfig.SVG.t.
Referenced by SequenceTypes._UnarySequenceOperator.__ne__().
def svgfig.SVG.__getitem__ | ( | self, | |
ti | |||
) |
Index is a list that descends tree, returning a sub-element if it ends with a number and an attribute if it ends with a string.
Definition at line 135 of file svgfig.py.
Referenced by python.seqvaluedict.seqdict.slice().
def svgfig.SVG.__iter__ | ( | self | ) |
def svgfig.SVG.__ne__ | ( | self, | |
other | |||
) |
def svgfig.SVG.__repr__ | ( | self | ) |
Definition at line 284 of file svgfig.py.
References svgfig.SVG.xml().
def svgfig.SVG.__setitem__ | ( | self, | |
ti, | |||
value | |||
) |
Index is a list that descends tree, returning a sub-element if it ends with a number and an attribute if it ends with a string.
Definition at line 146 of file svgfig.py.
Referenced by python.seqvaluedict.seqdict.update().
|
private |
Definition at line 372 of file svgfig.py.
References join(), svgfig.SVG.sub, AlignmentMonitorMuonSystemMap1D::MyCSCDetId.t, and svgfig.SVG.t.
def svgfig.SVG.__str__ | ( | self | ) |
Print (actually, return a string of) the tree in a form useful for browsing.
Definition at line 286 of file svgfig.py.
References tree.Tree.tree, SimpleTreeProducer.SimpleTreeProducer.tree, eventstfile.Events.tree, CSCTFanalyzer.tree, CSCTFAnalyzer.tree, core.TreeAnalyzerNumpy.TreeAnalyzerNumpy.tree, HcalTestHistoManager.tree, TreeWriterForEcalCorrection.tree, TkOfflineVariables.tree, AlignmentIORootBase.tree, IsolatedParticlesGeneratedJets.tree, KVFTest.tree, EcalPerEvtMatacqAnalyzer.tree, CheckSecondary.tree, ShallowTree.tree, EcalDeadChannelRecoveryNN< DetIdT >::MultiLayerPerceptronContext.tree, TreeSaver.tree, EcalMatacqAnalyzer.tree, PhysicsTools::TreeReader.tree, HcalIsoTrkAnalyzer.tree, KinematicVertex.tree, IsoTrackCalibration.tree, IsoTrackCalib.tree, KinematicParticle.tree, IsolatedGenParticles.tree, IsolatedTracksHcalScale.tree, IsolatedTracksNxN.tree, and svgfig.SVG.tree().
Referenced by BeautifulSoup.Tag.__repr__(), BeautifulSoup.Tag.__unicode__(), and BeautifulSoup.Tag.prettify().
def svgfig.SVG.append | ( | self, | |
x | |||
) |
Appends x to the list of sub-elements (drawn last, overlaps other primatives).
Definition at line 181 of file svgfig.py.
Referenced by diclist.diclist.add(), Vispa.Views.PropertyView.PropertyView.addProperty(), python.seqvaluedict.seqdict.push(), and BeautifulSoup.Tag.setString().
def svgfig.SVG.breadth_first | ( | self, | |
depth_limit = None |
|||
) |
def svgfig.SVG.depth_first | ( | self, | |
depth_limit = None |
|||
) |
end nested class
Returns a depth-first generator over the SVG. If depth_limit is a number, stop recursion at that depth.
Definition at line 234 of file svgfig.py.
Referenced by svgfig.SVG.__iter__(), and svgfig.SVG.tree().
def svgfig.SVG.extend | ( | self, | |
x | |||
) |
Extends list of sub-elements by a list x.
Definition at line 191 of file svgfig.py.
Referenced by MatrixUtil.WF.__init__(), Config.Process.extend(), Config.Process.load(), and Mixins._ValidatingParameterListBase.setValue().
def svgfig.SVG.firefox | ( | self, | |
fileName = None , |
|||
encoding = "utf-8" |
|||
) |
View in "firefox", assuming that program is available on your system. fileName default=None note that any file named _default_fileName will be overwritten if no fileName is specified. If the extension is ".svgz" or ".gz", the output will be gzipped encoding default="utf-8" file encoding (default is Unicode)
Definition at line 461 of file svgfig.py.
References svgfig.SVG.interpret_fileName(), and svgfig.SVG.save().
def svgfig.SVG.inkscape | ( | self, | |
fileName = None , |
|||
encoding = "utf-8" |
|||
) |
View in "inkscape", assuming that program is available on your system. fileName default=None note that any file named _default_fileName will be overwritten if no fileName is specified. If the extension is ".svgz" or ".gz", the output will be gzipped encoding default="utf-8" file encoding (default is Unicode)
Definition at line 449 of file svgfig.py.
References svgfig.SVG.interpret_fileName(), and svgfig.SVG.save().
def svgfig.SVG.inkview | ( | self, | |
fileName = None , |
|||
encoding = "utf-8" |
|||
) |
View in "inkview", assuming that program is available on your system. fileName default=None note that any file named _default_fileName will be overwritten if no fileName is specified. If the extension is ".svgz" or ".gz", the output will be gzipped encoding default="utf-8" file encoding (default is Unicode)
Definition at line 437 of file svgfig.py.
References svgfig.SVG.interpret_fileName(), and svgfig.SVG.save().
def svgfig.SVG.interpret_fileName | ( | self, | |
fileName = None |
|||
) |
Definition at line 401 of file svgfig.py.
Referenced by svgfig.SVG.firefox(), svgfig.SVG.inkscape(), svgfig.SVG.inkview(), and svgfig.SVG.save().
Get a recursively-generated list of tree-index, sub-element/attribute pairs. If sub == False, do not show sub-elements. If attr == False, do not show attributes. If text == False, do not show text/Unicode sub-elements.
Definition at line 248 of file svgfig.py.
Referenced by python.seqvaluedict.seqdict.__add__(), python.seqvaluedict.seqdict.__radd__(), betterConfigParser.BetterConfigParser.exists(), svgfig.SVG.keys(), python.rootplot.core.Options.kwarg_list(), python.seqvaluedict.seqdict.map(), python.seqvaluedict.seqdict.reduce(), python.seqvaluedict.seqdict.swap(), and svgfig.SVG.values().
Get a recursively-generated list of tree-indexes. If sub == False, do not show sub-elements. If attr == False, do not show attributes. If text == False, do not show text/Unicode sub-elements.
Definition at line 266 of file svgfig.py.
References ora::RecordSpecImpl.items, PixelDCSObject< class >.items, HDQMInspector::DetIdItemList.items, argparse.HelpFormatter._Section.items, python.rootplot.argparse.HelpFormatter._Section.items, and svgfig.SVG.items().
Referenced by psClasses.queueList.__init__(), psClasses.queueList.smallestQueue(), and psClasses.queueList.thinerQueue().
def svgfig.SVG.prepend | ( | self, | |
x | |||
) |
Prepends x to the list of sub-elements (drawn first may be overlapped by other primatives).
Definition at line 186 of file svgfig.py.
References svgfig.SVG.sub.
def svgfig.SVG.save | ( | self, | |
fileName = None , |
|||
encoding = "utf-8" , |
|||
compresslevel = None |
|||
) |
Save to a file for viewing. Note that svg.save() overwrites the file named _default_fileName. fileName default=None note that _default_fileName will be overwritten if no fileName is specified. If the extension is ".svgz" or ".gz", the output will be gzipped encoding default="utf-8" file encoding (default is Unicode) compresslevel default=None if a number, the output will be gzipped with that compression level (1-9, 1 being fastest and 9 most thorough)
Definition at line 408 of file svgfig.py.
References svgfig.SVG.interpret_fileName(), and svgfig.SVG.standalone_xml().
Referenced by Vispa.Main.TabController.TabController.allowClose(), Vispa.Main.TabController.TabController.checkModificationTimestamp(), svgfig.SVG.firefox(), svgfig.SVG.inkscape(), and svgfig.SVG.inkview().
def svgfig.SVG.standalone_xml | ( | self, | |
indent = " " , |
|||
newl = "\n" |
|||
) |
Get an XML representation of the SVG that can be saved/rendered. indent string used for indenting newl string used for newlines
Definition at line 357 of file svgfig.py.
References svgfig.canvas(), join(), AlignmentMonitorMuonSystemMap1D::MyCSCDetId.t, and svgfig.SVG.t.
Referenced by svgfig.SVG.save().
def svgfig.SVG.tree | ( | self, | |
depth_limit = None , |
|||
sub = True , |
|||
attr = True , |
|||
text = True , |
|||
tree_width = 20 , |
|||
obj_width = 80 |
|||
) |
Print (actually, return a string of) the tree in a form useful for browsing. If depth_limit == a number, stop recursion at that depth. If sub == False, do not show sub-elements. If attr == False, do not show attributes. If text == False, do not show text/Unicode sub-elements. tree_width is the number of characters reserved for printing tree indexes. obj_width is the number of characters reserved for printing sub-elements/attributes.
Definition at line 290 of file svgfig.py.
References svgfig.SVG.depth_first(), join(), and list().
Referenced by svgfig.SVG.__str__(), MetTreeProducer.MetTreeProducer.declareVariables(), core.AutoFillTreeProducer.AutoFillTreeProducer.declareVariables(), core.AutoFillTreeProducer.AutoFillTreeProducer.fillTree(), MetTreeProducer.MetTreeProducer.process(), and python.cmstools.EventTree.SetAlias().
Get a recursively-generated list of sub-elements and attributes. If sub == False, do not show sub-elements. If attr == False, do not show attributes. If text == False, do not show text/Unicode sub-elements.
Definition at line 275 of file svgfig.py.
References ora::RecordSpecImpl.items, PixelDCSObject< class >.items, HDQMInspector::DetIdItemList.items, argparse.HelpFormatter._Section.items, python.rootplot.argparse.HelpFormatter._Section.items, and svgfig.SVG.items().
Referenced by python.seqvaluedict.seqdict.items().
def svgfig.SVG.xml | ( | self, | |
indent = " " , |
|||
newl = "\n" , |
|||
depth_limit = None , |
|||
depth = 0 |
|||
) |
Get an XML representation of the SVG. indent string used for indenting newl string used for newlines If depth_limit == a number, stop recursion at that depth. depth starting depth (not useful for users) print svg.xml()
Definition at line 319 of file svgfig.py.
References join(), svgfig.SVG.sub, AlignmentMonitorMuonSystemMap1D::MyCSCDetId.t, and svgfig.SVG.t.
Referenced by svgfig.SVG.__repr__().
svgfig.SVG.attr |
Definition at line 133 of file svgfig.py.
Referenced by svgfig.SVG.__contains__(), svgfig.SVG.__eq__(), svgfig.Path.__repr__(), svgfig.Curve.__repr__(), svgfig.Poly.__repr__(), svgfig.Text.__repr__(), svgfig.TextGlobal.__repr__(), svgfig.Dots.__repr__(), svgfig.Line.__repr__(), svgfig.LineGlobal.__repr__(), svgfig.VLine.__repr__(), svgfig.HLine.__repr__(), svgfig.Rect.__repr__(), svgfig.Ellipse.__repr__(), svgfig.Ticks.__repr__(), svgfig.CurveAxis.__repr__(), svgfig.LineAxis.__repr__(), svgfig.XAxis.__repr__(), svgfig.YAxis.__repr__(), svgfig.Axes.__repr__(), svgfig.HGrid.__repr__(), svgfig.VGrid.__repr__(), svgfig.Grid.__repr__(), svgfig.Curve.Path(), svgfig.Poly.Path(), svgfig.Rect.Path(), svgfig.Path.SVG(), svgfig.Text.SVG(), svgfig.TextGlobal.SVG(), svgfig.LineGlobal.SVG(), svgfig.Axes.SVG(), svgfig.XErrorBars.SVG(), and svgfig.YErrorBars.SVG().
svgfig.SVG.sub |
Definition at line 129 of file svgfig.py.
Referenced by svgfig.SVG.__eq__(), svgfig.SVG.__standalone_xml(), svgfig.SVG.prepend(), and svgfig.SVG.xml().
svgfig.SVG.t |
Definition at line 127 of file svgfig.py.
Referenced by svgfig.SVG.__eq__(), svgfig.Curve.Sample.__repr__(), svgfig.SVG.__standalone_xml(), svgfig.SVG.standalone_xml(), and svgfig.SVG.xml().