Skip to content
Snippets Groups Projects
Commit bf1ba348 authored by Mayr, Hannes's avatar Mayr, Hannes
Browse files

Fix linting errors.

parent 52aa2ba8
Branches
Tags v0.3.0
1 merge request!60Enable customization of plotted IDs
Pipeline #888140 failed
...@@ -44,7 +44,9 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: ...@@ -44,7 +44,9 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer:
color = tuple(rgb_value * 255 for rgb_value in plotid_object.fontcolor) color = tuple(rgb_value * 255 for rgb_value in plotid_object.fontcolor)
# font = ImageFont.load_default() # font = ImageFont.load_default()
font_path = files("plotid.resources").joinpath("OpenSans", "OpenSans-Regular.ttf") font_path = (
files("plotid.resources").joinpath("OpenSans").joinpath("OpenSans-Regular.ttf")
)
font = ImageFont.truetype(str(font_path), plotid_object.fontsize) font = ImageFont.truetype(str(font_path), plotid_object.fontsize)
if plotid_object.font: if plotid_object.font:
......
...@@ -41,8 +41,12 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer: ...@@ -41,8 +41,12 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer:
matplotlib.font_manager.fontManager.addfont(plotid_object.font) matplotlib.font_manager.fontManager.addfont(plotid_object.font)
font = matplotlib.font_manager.FontProperties(fname=plotid_object.font) font = matplotlib.font_manager.FontProperties(fname=plotid_object.font)
else: else:
font = files("plotid.resources").joinpath("OpenSans", "OpenSans-Regular.ttf") font = (
matplotlib.font_manager.fontManager.addfont(font) files("plotid.resources")
.joinpath("OpenSans")
.joinpath("OpenSans-Regular.ttf")
)
matplotlib.font_manager.fontManager.addfont(str(font))
font = matplotlib.font_manager.FontProperties(fname=font) font = matplotlib.font_manager.FontProperties(fname=font)
# Loop to create and position the IDs # Loop to create and position the IDs
......
...@@ -5,7 +5,6 @@ Unittests for tagplot_matplotlib ...@@ -5,7 +5,6 @@ Unittests for tagplot_matplotlib
""" """
import unittest import unittest
from importlib.resources import files
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from matplotlib.figure import Figure from matplotlib.figure import Figure
from plotid.tagplot_matplotlib import tagplot_matplotlib from plotid.tagplot_matplotlib import tagplot_matplotlib
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment