Tanium Hygiene Assessment Tool (THAT) Power Point builder module.
tanium_hat.pptx_builder.
PptxBuilder
(pptx_output_path, pptx_input_path, **kwargs)[source]¶Bases: object
Power Point builder for THAT.
Parameters: |
|
---|
PPTX_OUTPUT_PATH
¶str
–
tanium_hat.pptx_builder.PptxBuilder.add_slides()
, set at initPRESO
¶LOG
¶ENGINE
¶tanium_hat.pptx_builder.TemplateEngine
–
add_slide_from_layouts
(layout_idx, layout_def)[source]¶Add a layout slide from pptx_input_path as a master slide to pptx_output_path.
tanium_hat.pptx_builder.PptxBuilder.SLIDE_MAP
, returns that slide object and does not re-add ittanium_hat.pptx_builder.PptxBuilder.get_layout_slide
to fetch the layout slide by index layout_idx
pptx.slide.Slides.add_slide()
to add the layout slide as a master slidetanium_hat.pptx_builder.PptxBuilder.SLIDE_MAP
with a mapping of layout_def[name] to master slide objectParameters: | |
---|---|
Returns: | ret –
|
Return type: |
add_slides
(layouts, results, check_unset=True)[source]¶Add layout slides as master slides based on layout definitions.
tanium_hat.pptx_builder.PptxBuilder.ENGINE
by instantiating tanium_hat.pptx_builder.TemplateEngine
with results
tanium_hat.pptx_builder.PptxBuilder.SORTED_LAYOUTS
using tanium_hat.pptx_builder.PptxBuilder.layouts_sorted()
tanium_hat.pptx_builder.PptxBuilder.SORTED_LAYOUTS
:tanium_hat.pptx_builder.PptxBuilder.add_slide_from_layouts()
tanium_hat.pptx_builder.PptxBuilder.update_slide_items()
tanium_hat.pptx_builder.PptxBuilder.check_unset_slide_items()
Parameters: |
---|
check_unset_slide_items
(layout_idx, layout_def)[source]¶Check a master slide for unset items.
tanium_hat.pptx_builder.PptxBuilder.SLIDE_MAP
Parameters: |
---|
get_layout_slide
(idx, name)[source]¶Get a layout slide from pptx_input_path by index idx
.
idx
from pptx.slide.SlideMaster.slide_layouts
idx
Parameters: | |
---|---|
Returns: | ret –
|
Return type: |
layouts_sorted
(layouts, results)[source]¶Sort layout definitions based on add_order.
add_dependency
that does not exist as a key name in results
, that means the plugin was not enabled, so we will not add that layout definitionadd_order
, determine add_order by:Parameters: | |
---|---|
Returns: | ret –
|
Return type: |
load_input_file
(pptx_input_path)[source]¶Load pptx_input_file as a Presentation object.
Parameters: | pptx_input_path (str ) –
|
---|---|
Returns: | ret –
|
Return type: | pptx.Presentation |
log_slides
(layouts=False, debug=False)[source]¶Log all slides found in tanium_hat.pptx_builder.PptxBuilder.PRESO
.
Parameters: |
---|
save
(**kwargs)[source]¶Save tanium_hat.pptx_builder.PptxBuilder.PRESO
to pptx_output_path as a powerpoint file.
Parameters: | pptx_output_path (str , optional) –
|
---|
slide_map_by_name
(name)[source]¶Get a slide map from tanium_hat.pptx_builder.PptxBuilder.SLIDE_MAP
by name.
Parameters: | name (str ) –
|
---|---|
Returns: | ret –
|
Return type: | dict |
update_slide_item
(idx, tmpl, name)[source]¶Update an item by idx on a master slide.
name
from tanium_hat.pptx_builder.PptxBuilder.SLIDE_MAP
idx
from the master slidetanium_hat.pptx_builder.TemplateEngine.render()
to templatize tmpl
text
attribute of the placeholder item with the templatized tmpl
Parameters: |
---|
update_slide_items
(layout_idx, layout_def)[source]¶Update items on a master slide.
tanium_hat.pptx_builder.PptxBuilder.SLIDE_MAP
tanium_hat.pptx_builder.PptxBuilder.update_slide_item()
to update the item in the master slideParameters: |
---|
tanium_hat.pptx_builder.
TemplateEngine
(results, **kwargs)[source]¶Bases: object
String templating engine.
Uses jinja2
to render all text templates.
Parameters: | results (dict ) –
|
---|
ENGINE
¶fetch
(section, key)[source]¶Custom method made available to the global jinja2 environment.
Examples
On render, if this is found in a template string:
“{{ fetch(‘config’, ‘prepared_on’) }}”
The value of results[config][prepared_on] will be substituted inline
Parameters: |
|
---|---|
Returns: | ret –
|
Return type: |
render
(source, **kwargs)[source]¶Render source as a jinja2 template using jinja2.Environment.from_string()
.
Parameters: | source (str ) –
|
---|---|
Returns: | ret –
|
Return type: | str |