Skip to content

Commit

Permalink
Tweak a bunch of docs in nodebox
Browse files Browse the repository at this point in the history
  • Loading branch information
stuaxo committed Dec 16, 2015
1 parent 75c7a9a commit 6551335
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions shoebot/grammar/nodebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,17 @@ def drawpath(self,path, **kwargs):
p.addpoint(point)
p.draw()

def drawimage(self, image):
def drawimage(self, image, x=None, y=None):
"""
:param image: Image to draw
:param x: optional, x coordinate (default is image.x)
:param y: optional, y coordinate (default is image.y)
:return:
"""
if x is None:
x = image.x
if y is None:
y = image.y
self.image(image.path, image.x, image.y, data = image.data)

def autoclosepath(self, close=True):
Expand Down Expand Up @@ -621,7 +631,7 @@ def strokewidth(self, w=None):
'''Set the stroke width.
:param w: Stroke width.
:return: If no width was specified then it will be returned.
:return: If no width was specified then current width is returned.
'''
if w is not None:
self._canvas.strokewidth = w
Expand Down Expand Up @@ -706,16 +716,20 @@ def textpath(self, txt, x, y, width=None, height=1000000, draw=False, **kwargs):
return path

def textmetrics(self, txt, width=None, height=None, **kwargs):
'''Returns the width and height of a string of text as a tuple
(according to current font settings).
'''
:return: the width and height of a string of text as a tuple
according to current font settings.
'''
# for now only returns width and height (as per Nodebox behaviour)
# but maybe we could use the other data from cairo
txt = self.Text(txt, 0, 0, width, height, enableRendering=False, **kwargs)
return txt.metrics

def textwidth(self, txt, width=None):
'''Returns the width of a string of text according to the current
'''
:return: the width of a string of text according to the current
font settings.
'''
w = width
Expand Down

0 comments on commit 6551335

Please sign in to comment.