generated from childmindresearch/template-python-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor style inputs to a dataclass (#15)
- Loading branch information
1 parent
c144f41
commit 6630a34
Showing
9 changed files
with
106 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "cmi_docx" | ||
version = "0.1.6" | ||
version = "0.2.0" | ||
description = ".docx utilities" | ||
authors = ["Reinder Vos de Wael <[email protected]>"] | ||
license = "LGPL-2.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""Style interfaces for document properties.""" | ||
|
||
import dataclasses | ||
|
||
from docx.enum import text | ||
|
||
|
||
@dataclasses.dataclass | ||
class RunStyle: | ||
"""Dataclass for run style arguments.""" | ||
|
||
bold: bool | None = None | ||
italic: bool | None = None | ||
underline: bool | None = None | ||
superscript: bool | None = None | ||
subscript: bool | None = None | ||
font_size: int | None = None | ||
font_rgb: tuple[int, int, int] | None = None | ||
|
||
|
||
@dataclasses.dataclass | ||
class ParagraphStyle: | ||
"""Dataclass for paragraph style arguments.""" | ||
|
||
bold: bool | None = None | ||
italic: bool | None = None | ||
font_size: int | None = None | ||
font_rgb: tuple[int, int, int] | None = None | ||
line_spacing: float | None = None | ||
space_before: float | None = None | ||
space_after: float | None = None | ||
alignment: text.WD_PARAGRAPH_ALIGNMENT | None = None | ||
|
||
|
||
@dataclasses.dataclass | ||
class TableStyle: | ||
"""Dataclass for table style arguments.""" | ||
|
||
space_before: float | None = None | ||
space_after: float | None = None | ||
background_rgb: tuple[int, int, int] | None = None | ||
paragraph_style: ParagraphStyle | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters