MCPcopy Create free account
hub / github.com/PageBot/PageBot / __init__

Method __init__

Lib/pagebot/contexts/svgcontext/svgcontext.py:48–76  ·  view source on GitHub ↗

Constructor of SvgContext. >>> context = SvgContext() >>> context.newPage(1000, 1000) >>> context.saveDrawing('_export/SvgContext.%s' % FILETYPE_SVG)

(self)

Source from the content-addressed store, hash-verified

46 VALID_EXTENSIONS = ('svg', 'svgz')
47
48 def __init__(self):
49 """Constructor of SvgContext.
50
51 >>> context = SvgContext()
52 >>> context.newPage(1000, 1000)
53 >>> context.saveDrawing('_export/SvgContext.%s' % FILETYPE_SVG)
54
55 """
56 super().__init__()
57 self.b = svgBuilder
58 self.name = self.__class__.__name__
59 self._language = DEFAULT_LANGUAGE
60 self._filePath = self.TMP_PATH % uniqueID()
61 self.fill(noColor) # Sets self._svgFill
62 self.stroke(noColor) # Sets self._svgStroke
63 self._strokeWidth = pt(0)
64 self._frameDuration = seconds(1)
65 self._fontSize = DEFAULT_FONT_SIZE
66 self._font = getDefaultFontPath()
67 self._ox = pt(0) # Origin set by self.translate()
68 self._oy = pt(0)
69 self._rotate = 0
70 self._gState = [] # Stack of graphic states.
71 self.save() # Save current set of values on gState stack.
72 self._numberOfPages = 1
73 self._bezierpath = None # Hold current open SVG path
74 self._w = None
75 self._h = None
76 self.drawing = []
77
78 # Drawing.
79

Callers

nothing calls this directly

Calls 7

fillMethod · 0.95
strokeMethod · 0.95
uniqueIDFunction · 0.90
ptFunction · 0.90
secondsFunction · 0.90
getDefaultFontPathFunction · 0.90
saveMethod · 0.45

Tested by

no test coverage detected