Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
.vsdx files can be processed in two ways, directly via python code as in example 1 below, or indirectly using a jinja template as in example 2
For quick start documentation please see https://vsdx.readthedocs.io/en/latest/quickstart.html
Example 1 code to find a shape with specific text, remove it, and then save the updated .vsdx file:
from vsdx import VisioFile
filename = 'my_file.vsdx'
# open a visio file
with VisioFile(filename) as vis:
# find shape by its text on first page
shape = vis.pages[0].find_shape_by_text('Shape to remove')
# remove the shape if found
if shape:
shape.remove()
# save a new copy
vis.save_vsdx('shape_removed.vsdx')
Example 2 creating a new vsdx file from a template and context data
using jinja.
Note that as vsdx does not lend itself well to ordered statements like
{% if something %}my content{% endif %}
or {% for x in list_value %}x={{ x }}{% endfor %}
this package provides mechanisms to help -
refer to tests for more details.
from vsdx import VisioFile
filename = 'my_template_file.vsdx' # file containing jinja code
context = {'value1': 10, 'list_value': [1,2,3]} # data for the template
with VisioFile('my_template_file.vsdx') as vis:
vis.jinja_render_vsdx(context=context)
vis.save_vsdx('my_new_file.vsdx')
Please refer to tests/test.py for more usage examples in the form of pytest tests.
Shape.fill_color
and Shape.text_color
properties with get and set testsShape.find_shapes_by_regex()
& Page.find_shapes_by_regex()
- add check in save_vsdx()
that file is open with more meaningful VisioFileNotOpen
errorPage.master_base_id
propertyPage.all_shapes
and Shape.all_shapes
. Add Page.is_master_page
and Shape.is_master_shape
.Shape.text
with missing master shape. Improve VisioFile.remove_page_by_index()
and add VisioFile.remove_page_by_name()
.Shape.find_shape_by_property_label()
and Shape.find_shapes_by_property_label
) to find shape or shapes by data property name.Shape.data_properties
property, and new class ShapeProperty
to represent Visio Shape DataShape.master_shape
, ability to
update master shapes and persist changes to master shapes in save_vsdx()
{% showif <statement> %}
in page nameVisioFile.add_page_at()
method taking index
to allow insertion
at a specific point; Added VisionFile.copy_page()
method to copy an existing page
and insert at a specific index or relative to copied page (using PagePosition
enum).{% set self.x = self x + n * 3.2 %}
VisioFile.jinja_set_selfs
to allow setting shape x and
y properties in Jinja template. Setting values, calculations, or if
statements are supported e.g. {% set self.x = 1.5 %}
or {% set self.y = n * 3 %}
or {% set self.x = 1.0 if n else 2.0 %}
VisioFile.add_page()
method and testsVisioFile.remove_page_by_index()
method to remove a
page, with associated testVisioFile.jinja_render_vsdx()
- similar to for loops but using a {% showif statement %}
in text of group shape controls whether that
group shape is included in vsdx file rendered. Note that the showif
statement is replaced with a standard if statement around the group
shape prior to rendering. Refer to test.py::test_jinja_if() for an
exampleVisioFile.jinja_render_vsdx()
- applying jinja
processing to Shape.text onlyShape.copy()
. Find and load master pages when file is opened, store
in VisioFile.master_page_objects and .master_pagesShape.copy()
methodPage.get_connectors_between()
to get zero or many
connectors between two shapes, by shape id or textFAQs
vsdx - A python library for processing .vsdx files
We found that vsdx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.