Skip to content

Commit

Permalink
Adjust docstrings of Card Types
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinHeist committed Oct 20, 2023
1 parent 5d0eebe commit 74791bb
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 236 deletions.
38 changes: 6 additions & 32 deletions modules/cards/AnimeTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ def __title_text_global_effects(self) -> ImageMagickCommands:
ImageMagick commands to implement the title text's global
effects. Specifically the the font, kerning, fontsize, and
southwest gravity.
Returns:
List of ImageMagick commands.
"""

kerning = 2.0 * self.font_kerning
Expand All @@ -149,9 +146,6 @@ def __title_text_global_effects(self) -> ImageMagickCommands:
def __title_text_black_stroke(self) -> ImageMagickCommands:
"""
ImageMagick commands to implement the title text's black stroke.
Returns:
List of ImageMagick commands.
"""

# No stroke, return empty command
Expand All @@ -169,13 +163,7 @@ def __title_text_black_stroke(self) -> ImageMagickCommands:

@property
def __title_text_effects(self) -> ImageMagickCommands:
"""
ImageMagick commands to implement the title text's standard
effects.
Returns:
List of ImageMagick commands.
"""
"""Subcommands to implement the title text's standard effects."""

return [
f'-fill "{self.font_color}"',
Expand All @@ -187,11 +175,8 @@ def __title_text_effects(self) -> ImageMagickCommands:
@property
def __series_count_text_global_effects(self) -> ImageMagickCommands:
"""
ImageMagick commands for global text effects applied to all
series count text (season/episode count and dot).
Returns:
List of ImageMagick commands.
Subcommands for global text effects applied to all series count
text (season/episode count and dot).
"""

return [
Expand All @@ -206,11 +191,8 @@ def __series_count_text_global_effects(self) -> ImageMagickCommands:
@property
def __series_count_text_black_stroke(self) -> ImageMagickCommands:
"""
ImageMagick commands for adding the necessary black stroke
effects to series count text.
Returns:
List of ImageMagick commands.
Subcommands for adding the necessary black stroke effects to
series count text.
"""

return [
Expand All @@ -222,12 +204,7 @@ def __series_count_text_black_stroke(self) -> ImageMagickCommands:

@property
def title_text_command(self) -> ImageMagickCommands:
"""
Subcommand for adding title text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommands for adding title text to the source image."""

# Base offset for the title text
base_offset = 175 + self.font_vertical_shift
Expand Down Expand Up @@ -267,9 +244,6 @@ def title_text_command(self) -> ImageMagickCommands:
def index_text_command(self) -> ImageMagickCommands:
"""
Subcommand for adding the index text to the source image.
Returns:
List of ImageMagick commands.
"""

# Hiding all index text, return blank commands
Expand Down
32 changes: 5 additions & 27 deletions modules/cards/ComicBookTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,7 @@ def get_angle(angle: Union[float, str]) -> Optional[float]:

@property
def title_text_commands(self) -> ImageMagickCommands:
"""
Get the ImageMagick commands required to add the title text.
Returns:
List of ImageMagick commands.
"""
"""Subcommands required to add the title text."""

# If no title text, return empty commands
if len(self.title_text) == 0:
Expand Down Expand Up @@ -277,14 +272,7 @@ def title_text_commands(self) -> ImageMagickCommands:

@property
def title_text_box_commands(self) -> ImageMagickCommands:
"""
Get the ImageMagick commands required to add the title text box
(if indicated).
Returns:
List of ImageMagick comands. Empty list if title text is
hidden.
"""
"""Subcommands required to add the title text box."""

# No index text, return empty commands
if len(self.title_text) == 0:
Expand Down Expand Up @@ -360,13 +348,7 @@ def title_text_box_commands(self) -> ImageMagickCommands:

@property
def index_text_commands(self) -> ImageMagickCommands:
"""
Get the ImageMagick commands required to add the index text.
Returns:
List of ImageMagick comands. Empty list if all index text is
hidden.
"""
"""Subcommands required to add the index text."""

# No index text, return empty commands
if self.hide_season_text and self.hide_episode_text:
Expand Down Expand Up @@ -416,12 +398,8 @@ def index_text_commands(self) -> ImageMagickCommands:
@property
def index_text_box_commands(self) -> ImageMagickCommands:
"""
Get the ImageMagick commands required to add the index text box
and the bottom fill rectangle (if indicated).
Returns:
List of ImageMagick comands. Empty list if all index text is
hidden.
Subcommands required to add the index text box and the bottom
fill rectangle.
"""

# No index text, return empty commands
Expand Down
7 changes: 1 addition & 6 deletions modules/cards/CutoutTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ def _format_episode_text(self, episode_text: str) -> str:

@property
def title_text_commands(self) -> ImageMagickCommands:
"""
Subcommand for adding title text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand for adding title text to the source image."""

font_size = 50 * self.font_size
font_kerning = 1 * self.font_kerning
Expand Down
14 changes: 2 additions & 12 deletions modules/cards/DividerTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,7 @@ def __init__(self,

@property
def index_text_command(self) -> ImageMagickCommands:
"""
Subcommand for adding the index text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand for adding the index text to the source image."""

gravity = 'west' if self.title_text_position == 'left' else 'east'

Expand All @@ -157,12 +152,7 @@ def index_text_command(self) -> ImageMagickCommands:

@property
def title_text_command(self) -> ImageMagickCommands:
"""
Subcommand for adding the title text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand for adding the title text to the source image."""

# No title text, return blank commands
if len(self.title_text) == 0:
Expand Down
21 changes: 3 additions & 18 deletions modules/cards/FadeTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,7 @@ def __init__(self,

@property
def add_logo(self) -> ImageMagickCommands:
"""
Subcommand to add the logo file to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand to add the logo file to the source image."""

# No logo indicated, return blank command
if self.logo is None or not self.logo.exists():
Expand All @@ -159,12 +154,7 @@ def add_logo(self) -> ImageMagickCommands:

@property
def add_title_text(self) -> ImageMagickCommands:
"""
Subcommand to add the title text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand to add the title text to the source image."""

# No title, return blank command
if len(self.title_text) == 0:
Expand All @@ -189,12 +179,7 @@ def add_title_text(self) -> ImageMagickCommands:

@property
def add_index_text(self) -> ImageMagickCommands:
"""
Subcommand to add the index text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand to add the index text to the source image."""

# No season or episode text, return blank command
if len(self.index_text) == 0:
Expand Down
21 changes: 4 additions & 17 deletions modules/cards/FrameTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,8 @@ def __init__(self, *,


@property
def _title_font_attributes(self) -> list[str]:
"""
Subcommands for the font attributes of title text.
Returns:
List of ImageMagick commands.
"""
def _title_font_attributes(self) -> ImageMagickCommands:
"""Subcommands for the font attributes of title text."""

title_size = 125 * self.font_size
interline_spacing = -45 + self.font_interline_spacing
Expand All @@ -140,13 +135,8 @@ def _title_font_attributes(self) -> list[str]:


@property
def _index_font_attributes(self) -> list[str]:
"""
Subcommand for the font attributes of the index text.
Returns:
List of ImageMagick commands.
"""
def _index_font_attributes(self) -> ImageMagickCommands:
"""Subcommand for the font attributes of the index text."""

return [
f'-background transparent',
Expand All @@ -161,9 +151,6 @@ def text_commands(self) -> ImageMagickCommands:
"""
Subcommand for adding all text. This includes the title, season,
and episode text.
Returns:
List of ImageMagick commands.
"""

# Command to add only the title to the source image
Expand Down
5 changes: 2 additions & 3 deletions modules/cards/LogoTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ def resize_logo(self) -> Path:


@property
def index_command(self) -> ImageMagickCommands:
"""
Subcommand for adding the index text to the source image.
def index_commands(self) -> ImageMagickCommands:
"""Subcommand for adding the index text to the source image."""

Returns:
List of ImageMagick commands.
Expand Down
21 changes: 3 additions & 18 deletions modules/cards/MarvelTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,7 @@ def __init__(self, *,

@property
def title_text_commands(self) -> ImageMagickCommands:
"""
Subcommand for adding title text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand for adding title text to the source image."""

# No title text, or not being shown
if len(self.title_text) == 0:
Expand Down Expand Up @@ -312,12 +307,7 @@ def scale_text(self, title_text_dimensions: Dimensions) -> Dimensions:

@property
def border_commands(self) -> ImageMagickCommands:
"""
Subcommands to add the border to the image.
Returns:
List of ImageMagick commands.
"""
"""Subcommands to add the border to the image."""

# Border is not being shown, skip
if self.hide_border:
Expand Down Expand Up @@ -347,12 +337,7 @@ def border_commands(self) -> ImageMagickCommands:

@property
def bottom_border_commands(self) -> ImageMagickCommands:
"""
Subcommands to add the bottom border to the image.
Returns:
List of ImageMagick commands.
"""
"""Subcommands to add the bottom border to the image."""

rectangle = Rectangle(
Coordinate(0, self.HEIGHT - self.text_box_height),
Expand Down
9 changes: 0 additions & 9 deletions modules/cards/OlivierTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ def title_text_command(self) -> ImageMagickCommands:
"""
Get the ImageMagick commands to add the episode title text to an
image.
Returns:
List of ImageMagick commands.
"""

font_size = 124 * self.font_size
Expand Down Expand Up @@ -152,9 +149,6 @@ def episode_prefix_command(self) -> ImageMagickCommands:
"""
Get the ImageMagick commands to add the episode prefix text to
an image.
Returns:
List of ImageMagick commands.
"""

# No episode prefix/text, return empty command
Expand Down Expand Up @@ -187,9 +181,6 @@ def episode_number_text_command(self) -> ImageMagickCommands:
"""
Get the ImageMagick commands to add the episode number text to
an image.
Returns:
List of ImageMagick commands.
"""

# No episode text, return empty command
Expand Down
21 changes: 3 additions & 18 deletions modules/cards/OverlineTitleCard.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,7 @@ def __init__(self, *,

@property
def gradient_commands(self) -> ImageMagickCommands:
"""
Subcommand to add the gradient overlay to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand to add the gradient overlay to the image."""

if self.omit_gradient:
return []
Expand All @@ -142,12 +137,7 @@ def gradient_commands(self) -> ImageMagickCommands:

@property
def title_text_commands(self) -> ImageMagickCommands:
"""
Subcommand for adding title text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommand for adding title text to the image."""

# No title text, or not being shown
if len(self.title_text) == 0:
Expand Down Expand Up @@ -184,12 +174,7 @@ def title_text_commands(self) -> ImageMagickCommands:

@property
def index_text_commands(self) -> ImageMagickCommands:
"""
Subcommands for adding index text to the source image.
Returns:
List of ImageMagick commands.
"""
"""Subcommands for adding index text to the source image."""

# If not showing index text, return
if self.hide_season_text and self.hide_episode_text:
Expand Down
Loading

0 comments on commit 74791bb

Please sign in to comment.