Warning
This page is still a Draft!
Beampy main file
beampy.document(quiet=False, latex_packages=None, source_filename=None, **kwargs)¶Main function to define the document style etc…
dict_deep_update(original, update)¶Recursively update a dict. Subdict’s won’t be overwritten but also updated. from http://stackoverflow.com/questions/38987/how-can-i-merge-two-python-dictionaries-in-a-single-expression/44512#44512
print_variables()¶Print information on the document class and the content of its private data and methods.
beampy.beampy_module(**kargs)¶Base class for creating a module
Each module need a render method and need to return a register
above(other_element)¶Set the current module to appears above the other_element_id.
add_border(svg_style={‘stroke’: ‘red’, ’stroke-width’: 0.5, ’fill’: ‘none’})¶function to add a border to the given element
add_layers(layerslist)¶Function to add this elements to given layers :param layerslist: list of layers where the module should be printed :return:
add_svgdef(svgdef, svgdefsargs=None)¶Function to add svg clipPath or filter.
below(other_element)¶Set the current module to appears beow the othe_element
check_args_from_theme(arg_values_dict, parent=None)¶Function to check input function keyword args.
Functions args are defined in the default_theme.py or if a theme is added the new value is taken rather than the default one
| Parameters: |
|
|---|
export_svg()¶function to export rendered svg in a group positionned in the slide
export_svg_def()¶function to export rendered svg in a group positionned in the slide
first()¶Set the current object in the background
last()¶Set the current object in the foreground
load_args(kwargs_dict)¶Function to transform input kwargs dict into attribute of the module
load_extra_args(theme_key)¶Function to load default args from the theme for the given theme_key and add them to the module
load_special_kwargs()¶Load all attributes contained in self.sepcial_kwargs dictionnary as attributes of the beampy_module with the setattr function.
pre_render()¶A method that is called at the begining of the slide.newrender method
process_with()¶Function called by the __exit__ function
Need to be redefined by each module to adjust the behaviours of “with :”
render_svgdefs()¶Function to render the svgdefs
run_render()¶Run the function self.render if the module is not in cache
update_size(width, height)¶Update the size (width, height) of the current module
beampy.positionner(x, y, width, height, elem_id, slideid)¶compute_anchors()¶Compute the anchors for the element self.left self.right self.top and self.bottom
guess_size_for_group()¶Function to guess parent group final position to place elements relatively to this group.
place(available_size, ytop=0)¶Method to place the given element. This method is used by renders.py in the place_content function
available_size: (width, heith) is the page or group width and height
update_size(width, height)¶Update width and height to computed ones by the element render.
If width is less than 1px, use it as a percentage of the width
update_x(x)¶Update the x position and run the converter
update_y(y)¶Update the y position and run the converter
beampy.group(elements_to_group=None, x=’center’, y=’auto’, width=None, height=None, background=None, parentid=None, parent_slide_id=None, opengroup=True)¶Group Beampy modules together and manipulate them as a group
| Parameters: |
|
|---|
Note
When the position of a group (x, y) are relative to a parent group and that the parent group has width`=None or `height`=None and positions `x or y equal to ‘auto’ or ‘center’, the render will use the slide.curwidth as width and the document._height as height. This will produce unexpected positioning of child group.
compute_group_size()¶Function to compute the size of a given group
Update the size with self.update_size(width, height) at the end
export_svg_content_layer(layer)¶Function to export group content for a given layer to svg :param layer: :return:
propagate_layers()¶Function to recusivly propagate the layers to group elements :return:
remove_element_in_group(elementid)¶Function to remove element from the group key stores
| Parameters: | elementid – The id of the module to remove |
|---|
render()¶group render
reset_outputs()¶Rewrite the reset_outputs function of beampy_module to add content_layer.
beampy.figure(content, ext=None, **kwargs)¶Include a figure to the current slide. Figure formats could be (svg, pdf, png, jpeg, gif, matplotib figure, and bokeh figure)
| Parameters: |
|
|---|
render()¶function to render figures
beampy.text(textin=None, **kwargs)¶Add text to the current slide. Input text is by default processed using Latex and could use Latex syntax.
| Parameters: |
|
|---|
Example
>>> text('this is my text', x='20', y='20')
local_render()¶Function to render only on text of this module.
It’s slower than writing all texts to one latex file and then render it to dvi then svg.
parse_dvisvgm_svg(soup_data)¶Function to transform the svg produced by dvisvgm. Make a global glyph store to use them as defs in svg to reduce the size off the global presentation.
soup_data: BeautifulSoup parsed svg
return: soup_data (without the defs part)
pre_render()¶Prepare the latex render of the text
process_with()¶Process the text inside the width
render()¶Text is rendered using latex if self.usetex = True if not use simple svg
beampy.video(videofile, **kwargs)¶Include a figure to the current slide. Figure formats could be (svg, pdf, png, jpeg, matplotib figure, and bokeh figure)
| Parameters: |
|
|---|
render()¶Render video (webm) encoded in base64 in svg command
Render Need to produce an html and an svg
video_image()¶Function used to get the first image of a video
It use FFMPEG to extract one image
beampy.tikz(tikzcmd, **kwargs)¶Add Tikz/pgf graphic to the slide.
| Parameters: |
|
|---|
render()¶Latex -> dvi -> svg for tikz image
beampy.svg(svg_content, **kwargs)¶Insert svg content.
| Parameters: |
|
|---|
render()¶The render of an svg part