Classes | |
class | SVGDepthIterator |
nested class More... | |
Public Member Functions | |
def | __contains__ (self, value) |
def | __delitem__ (self, ti) |
def | __eq__ (self, other) |
def | __getitem__ (self, ti) |
def | __init__ (self, t_sub, attr) |
def | __iter__ (self) |
def | __ne__ (self, other) |
def | __repr__ (self) |
def | __setitem__ (self, ti, value) |
def | __str__ (self) |
def | append (self, x) |
def | breadth_first (self, depth_limit=None) |
def | clone (self, shallow=False) |
def | depth_first (self, depth_limit=None) |
end nested class More... | |
def | extend (self, x) |
def | firefox (self, fileName=None, encoding="utf-8") |
def | inkscape (self, fileName=None, encoding="utf-8") |
def | inkview (self, fileName=None, encoding="utf-8") |
def | interpret_fileName (self, fileName=None) |
def | items (self, sub=True, attr=True, text=True) |
def | keys (self, sub=True, attr=True, text=True) |
def | prepend (self, x) |
def | save (self, fileName=None, encoding="utf-8", compresslevel=None) |
def | standalone_xml (self, indent=" ", newl="\) |
def | tree (self, depth_limit=None, sub=True, attr=True, text=True, tree_width=20, obj_width=80) |
def | values (self, sub=True, attr=True, text=True) |
def | xml (self, indent=" ", newl="\, depth_limit=None, depth=0) |
Public Attributes | |
attr | |
sub | |
t | |
Private Member Functions | |
def | __standalone_xml (self, indent, newl) |
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 124 of file svgfig.py.
def svgfig.SVG.__contains__ | ( | self, | |
value | |||
) |
x in svg == True iff x is an attribute in svg.
Definition at line 169 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 173 of file svgfig.py.
References svgfig.SVG.attr, l1ctLayer2EG_cff.id, svgfig.SVG.sub, svgfig.SVG.t, and AlignmentMonitorMuonSystemMap1D::MyCSCDetId.t.
Referenced by SequenceTypes._UnarySequenceOperator.__ne__().
def svgfig.SVG.__getitem__ | ( | self, | |
ti | |||
) |
def svgfig.SVG.__iter__ | ( | self | ) |
Definition at line 247 of file svgfig.py.
References svgfig.SVG.depth_first().
def svgfig.SVG.__ne__ | ( | self, | |
other | |||
) |
def svgfig.SVG.__repr__ | ( | self | ) |
Definition at line 285 of file svgfig.py.
References svgfig.SVG.xml().
Referenced by data_sources.json_file.__str__().
def svgfig.SVG.__setitem__ | ( | self, | |
ti, | |||
value | |||
) |
|
private |
Definition at line 373 of file svgfig.py.
References svgfig.SVG.attr, svgfig.SVG.items(), join(), svgfig.SVG.sub, svgfig.SVG.t, AlignmentMonitorMuonSystemMap1D::MyCSCDetId.t, and betterConfigParser.unicode.
def svgfig.SVG.__str__ | ( | self | ) |
Print (actually, return a string of) the tree in a form useful for browsing.
Definition at line 287 of file svgfig.py.
References tree.Tree.tree, HIPMonitorVariables.tree, SimpleTreeProducer.SimpleTreeProducer.tree, eventstfile.Events.tree, CSCTFAnalyzer.tree, CSCTFanalyzer.tree, core.TreeAnalyzerNumpy.TreeAnalyzerNumpy.tree, TreeWriterForEcalCorrection.tree, AlignmentIORootBase.tree, TkOfflineVariables.tree, HIPTwoBodyDecayAnalyzer.tree, EcalPerEvtMatacqAnalyzer.tree, HcalIsoTrackAnalyzer.tree, CheckSecondary.tree, KVFTest.tree, SiStripHitEfficiencyHarvester.tree, EcalMatacqAnalyzer.tree, BPHHistoSpecificDecay.tree, PhysicsTools::TreeReader.tree, KinematicVertex.tree, IsoTrackCalibration.tree, IsoTrackCalib.tree, KinematicParticle.tree, TkAlMap.TkAlMap.tree, HcalIsoTrkSimAnalyzer.tree, HcalIsoTrkAnalyzer.tree, and svgfig.SVG.tree().
Referenced by edmStreamStallGrapher.Point.__repr__(), 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 182 of file svgfig.py.
References svgfig.SVG.sub.
Referenced by diclist.diclist.add(), and BeautifulSoup.Tag.setString().
def svgfig.SVG.breadth_first | ( | self, | |
depth_limit = None |
|||
) |
Not implemented yet. Any ideas on how to do it? Returns a breadth-first generator over the SVG. If depth_limit is a number, stop recursion at that depth.
def svgfig.SVG.clone | ( | self, | |
shallow = False |
|||
) |
Deep copy of SVG tree. Set shallow=True for a shallow copy.
Definition at line 196 of file svgfig.py.
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 235 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 192 of file svgfig.py.
References svgfig.SVG.sub.
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 462 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 450 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 438 of file svgfig.py.
References svgfig.SVG.interpret_fileName(), and svgfig.SVG.save().
def svgfig.SVG.interpret_fileName | ( | self, | |
fileName = None |
|||
) |
Definition at line 402 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 249 of file svgfig.py.
Referenced by DictTypes.SortedKeysDict.__repr__(), svgfig.SVG.__standalone_xml(), event.Event.__str__(), config.CFG.__str__(), generateEDF.LumiInfoCont.__str__(), generateEDF.LumiInfoCont._integrateContainer(), betterConfigParser.BetterConfigParser.exists(), submitPVValidationJobs.BetterConfigParser.exists(), crabConfigParser.CrabConfigParser.getSectionLines(), svgfig.SVG.keys(), python.rootplot.core.Options.kwarg_list(), svgfig.SVG.values(), and svgfig.SVG.xml().
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 267 of file svgfig.py.
References PixelDCSObject< T >.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 187 of file svgfig.py.
References svgfig.SVG.sub.
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 409 of file svgfig.py.
References svgfig.SVG.interpret_fileName(), and svgfig.SVG.standalone_xml().
Referenced by svgfig.SVG.firefox(), svgfig.SVG.inkscape(), svgfig.SVG.inkview(), and SpecificationBuilder_cfi.Specification.saveAll().
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 358 of file svgfig.py.
References svgfig.canvas(), join(), svgfig.SVG.t, and AlignmentMonitorMuonSystemMap1D::MyCSCDetId.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 291 of file svgfig.py.
References svgfig.SVG.depth_first(), and join().
Referenced by svgfig.SVG.__str__(), ZJetsTreeAnalyzer.ZJetsTreeAnalyzer.beginLoop(), MetTreeProducer.MetTreeProducer.declareVariables(), core.AutoFillTreeProducer.AutoFillTreeProducer.declareVariables(), core.AutoFillTreeProducer.AutoFillTreeProducer.fillTree(), ZJetsTreeAnalyzer.ZJetsTreeAnalyzer.process(), 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 276 of file svgfig.py.
References PixelDCSObject< T >.items, and svgfig.SVG.items().
Referenced by genericValidation.ValidationWithPlotsSummaryBase.SummaryItem.value().
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 320 of file svgfig.py.
References svgfig.SVG.attr, svgfig.SVG.items(), join(), svgfig.SVG.sub, svgfig.SVG.t, and AlignmentMonitorMuonSystemMap1D::MyCSCDetId.t.
Referenced by svgfig.SVG.__repr__().
svgfig.SVG.attr |
Definition at line 134 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.SVG.__standalone_xml(), 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(), svgfig.YErrorBars.SVG(), and svgfig.SVG.xml().
svgfig.SVG.sub |
Definition at line 130 of file svgfig.py.
Referenced by svgfig.SVG.__eq__(), svgfig.SVG.__standalone_xml(), svgfig.SVG.append(), svgfig.SVG.extend(), svgfig.SVG.prepend(), and svgfig.SVG.xml().
svgfig.SVG.t |
Definition at line 128 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().