1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2025-06-01 20:12:23 +00:00

Fix some IDE warnings and suggestions

This commit is contained in:
Franzi 2025-05-16 17:08:17 +01:00
parent 5613bf5acb
commit 8d961b8320
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 20 additions and 18 deletions

View file

@ -284,8 +284,7 @@ class PDFExporter(ScheduleData):
show_qrcode = False
icon = "fa-file-pdf"
def _add_pages(self, doc):
style = self._style()
def _add_pages(self):
pages = []
for fahrplan_day in self.data:
for room_details in fahrplan_day["rooms"]:
@ -302,12 +301,13 @@ class PDFExporter(ScheduleData):
fahrplan_day,
room_details,
talk,
style,
self._style,
)
)
pages.append(PageBreak())
return pages
@property
def _style(self):
stylesheet = StyleSheet1()
stylesheet.add(
@ -366,7 +366,7 @@ class PDFExporter(ScheduleData):
topMargin=0,
bottomMargin=0,
)
doc.build(self._add_pages(doc))
doc.build(self._add_pages())
f.seek(0)
return (

View file

@ -78,13 +78,15 @@ class VoctomixLowerThirdsExporter:
encoding="unic",
)
def _hex2rgb(self, hex_value):
@staticmethod
def _hex2rgb(hex_value):
hex_value = hex_value.lstrip("#")
# black insists this should have spaces around the :, but flake8
# complains about spaces around the :, soooooo ....
return tuple(int(hex_value[i : i + 2], 16) for i in (0, 2, 4)) # NOQA
def _fit_text(self, input_text, font, max_width):
@staticmethod
def _fit_text(input_text, font, max_width):
words = [i.strip() for i in input_text.split()]
lines = []
line = []
@ -177,7 +179,7 @@ class VoctomixLowerThirdsExporter:
img.save(filename)
self.log.debug(
f"Generated single-speaker image for {speaker.get_display_name()!r} "
"of talk {talk.submission.title!r}, saved as {filename}"
f"of talk {talk.submission.title!r}, saved as {filename}"
)
return filename

View file

@ -63,7 +63,7 @@ body {
margin-left: -510px;
padding: 15px;
box-shadow: 5px 5px 10px 0px rgba(50, 50, 50, 0.75);
box-shadow: 5px 5px 10px 0 rgba(50, 50, 50, 0.75);
background-color: #3aa57c;
}

View file

@ -8,23 +8,23 @@ from django.utils.safestring import mark_safe
from django.views import View
def _make_svg_response(url):
image = qrcode.make(
url, image_factory=qrcode.image.svg.SvgImage
)
svg_data = mark_safe(ElementTree.tostring(image.get_image()).decode())
return HttpResponse(svg_data, content_type="image/svg+xml")
class BroadcastToolsFeedbackQrCodeSvg(View):
def get(self, request, *args, **kwargs):
talk = self.request.event.submissions.filter(id=kwargs["talk"]).first()
domain = request.event.custom_domain or settings.SITE_URL
image = qrcode.make(
f"{domain}{talk.urls.feedback}", image_factory=qrcode.image.svg.SvgImage
)
svg_data = mark_safe(ElementTree.tostring(image.get_image()).decode())
return HttpResponse(svg_data, content_type="image/svg+xml")
return _make_svg_response(f"{domain}{talk.urls.feedback}")
class BroadcastToolsPublicQrCodeSvg(View):
def get(self, request, *args, **kwargs):
talk = self.request.event.submissions.filter(id=kwargs["talk"]).first()
domain = request.event.custom_domain or settings.SITE_URL
image = qrcode.make(
f"{domain}{talk.urls.public}", image_factory=qrcode.image.svg.SvgImage
)
svg_data = mark_safe(ElementTree.tostring(image.get_image()).decode())
return HttpResponse(svg_data, content_type="image/svg+xml")
return _make_svg_response(f"{domain}{talk.urls.public}")