# PPTemp
PPTemp is a wrapper for
[python-pptx](https://python-pptx.readthedocs.io/en/latest/index.html).
It enables you to make powerpoint files in a simple python commands.
## Installation
```bash
pip install git+https://github.com/Ameyanagi/pptemp
```
## Usage
```python
from pptemp import pptemp
# Initialization
presentation = pptemp()
# Initialization with template
presentation = pptemp(template="./sample/template.pptx")
# Title
presentation.add_title_slide("Title", "Subtitle")
# Create Blank Slide with title on the top
presentation.add_content_slide("Title of the slide")
# Create slides from figures
presentation.add_figure_slide()
# Create slides from figures with label
# Set use_bar=False if you don't want the bars to appear
presentation.add_figure_label_slide(dir_path="./sample/fig/*/")
presentation.add_figure_label_slide(dir_path="./sample/fig/*/", use_label=False)
# Save
presentation.save("./test.pptx")
```
## add_figure_label_slide()
add_figure_slide() and add_figure_label_slide() are use to import figures automatically from the "./fig" directory.
It will search figures specified by dir_path and img_path.
```
dir_path = "./fig/*/"
img_path = "*.png"
```
By Default, the title of the slides are taken from the dir_path and img_path."_" and "." are used as a separator.
```
If dir_path = "./fig/01_test/", then the title will be "test".
If img_path = "01_test.png", then the label will be "test".
```
To change where to look for the title and label, you can use the following arguments.
```
file_regex = re.compile(r".*[_/\\](.*)\.[a-zA-Z]+")
dir_regex = re.compile(r".*[_/\\](.*)[/\\]")
```
## Samples
```python
# Basic sample
python sample1.py
# Samples using template-slides
# You need to prepare template pptx files without any slides. If there is a slide, new slides will be appended.
python sample2_using_template.py
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Ameyanagi/pptemp",
"name": "pptemp",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "powerpoint,pptx",
"author": "Ameyanagi",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/60/a3/4bec24ce0cf7177510470414c98a366d0ecac8042eada3a1784f014bde01/pptemp-0.1.0.tar.gz",
"platform": null,
"description": "# PPTemp\n\nPPTemp is a wrapper for \n[python-pptx](https://python-pptx.readthedocs.io/en/latest/index.html).\nIt enables you to make powerpoint files in a simple python commands.\n\n\n## Installation\n\n```bash\npip install git+https://github.com/Ameyanagi/pptemp\n```\n\n## Usage\n```python\nfrom pptemp import pptemp\n\n# Initialization\npresentation = pptemp()\n\n# Initialization with template\npresentation = pptemp(template=\"./sample/template.pptx\")\n \n# Title\npresentation.add_title_slide(\"Title\", \"Subtitle\")\n\n# Create Blank Slide with title on the top\npresentation.add_content_slide(\"Title of the slide\")\n\n# Create slides from figures\npresentation.add_figure_slide()\n\n# Create slides from figures with label\n# Set use_bar=False if you don't want the bars to appear\npresentation.add_figure_label_slide(dir_path=\"./sample/fig/*/\")\n\npresentation.add_figure_label_slide(dir_path=\"./sample/fig/*/\", use_label=False)\n\n# Save\npresentation.save(\"./test.pptx\")\n```\n\n## add_figure_label_slide()\nadd_figure_slide() and add_figure_label_slide() are use to import figures automatically from the \"./fig\" directory.\n\nIt will search figures specified by dir_path and img_path.\n```\ndir_path = \"./fig/*/\"\nimg_path = \"*.png\"\n```\n\nBy Default, the title of the slides are taken from the dir_path and img_path.\"_\" and \".\" are used as a separator.\n\n```\nIf dir_path = \"./fig/01_test/\", then the title will be \"test\".\nIf img_path = \"01_test.png\", then the label will be \"test\".\n```\n\nTo change where to look for the title and label, you can use the following arguments.\n\n```\nfile_regex = re.compile(r\".*[_/\\\\](.*)\\.[a-zA-Z]+\")\ndir_regex = re.compile(r\".*[_/\\\\](.*)[/\\\\]\")\n```\n\n## Samples\n\n```python\n# Basic sample\npython sample1.py\n\n# Samples using template-slides\n# You need to prepare template pptx files without any slides. If there is a slide, new slides will be appended.\npython sample2_using_template.py\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "It enables you to make powerpoint files in a simple python commands.",
"version": "0.1.0",
"split_keywords": [
"powerpoint",
"pptx"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a81104396275223ff5449e88032d51527f7fb4513679936f70f1a11594ebc53e",
"md5": "2e8688caf71184f87b414aefaa7e319b",
"sha256": "a7636f322e23c7f1ce29e1a95291d7d15432f2811ad0107758366f3f96ecff0a"
},
"downloads": -1,
"filename": "pptemp-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2e8688caf71184f87b414aefaa7e319b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7412,
"upload_time": "2023-01-27T17:12:27",
"upload_time_iso_8601": "2023-01-27T17:12:27.769591Z",
"url": "https://files.pythonhosted.org/packages/a8/11/04396275223ff5449e88032d51527f7fb4513679936f70f1a11594ebc53e/pptemp-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "60a34bec24ce0cf7177510470414c98a366d0ecac8042eada3a1784f014bde01",
"md5": "eac5d91181c4498665d19439d0d53bba",
"sha256": "83eaa9673de8d712f8f4f5a9329b35dabccfd91a757dd0575147a79b72b761cf"
},
"downloads": -1,
"filename": "pptemp-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "eac5d91181c4498665d19439d0d53bba",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7476,
"upload_time": "2023-01-27T17:12:30",
"upload_time_iso_8601": "2023-01-27T17:12:30.865679Z",
"url": "https://files.pythonhosted.org/packages/60/a3/4bec24ce0cf7177510470414c98a366d0ecac8042eada3a1784f014bde01/pptemp-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-27 17:12:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Ameyanagi",
"github_project": "pptemp",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pptemp"
}