mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2025-06-03 10:54:55 +00:00
Fix some IDE warnings and suggestions
This commit is contained in:
parent
5613bf5acb
commit
8d961b8320
4 changed files with 20 additions and 18 deletions
|
@ -284,8 +284,7 @@ class PDFExporter(ScheduleData):
|
||||||
show_qrcode = False
|
show_qrcode = False
|
||||||
icon = "fa-file-pdf"
|
icon = "fa-file-pdf"
|
||||||
|
|
||||||
def _add_pages(self, doc):
|
def _add_pages(self):
|
||||||
style = self._style()
|
|
||||||
pages = []
|
pages = []
|
||||||
for fahrplan_day in self.data:
|
for fahrplan_day in self.data:
|
||||||
for room_details in fahrplan_day["rooms"]:
|
for room_details in fahrplan_day["rooms"]:
|
||||||
|
@ -302,12 +301,13 @@ class PDFExporter(ScheduleData):
|
||||||
fahrplan_day,
|
fahrplan_day,
|
||||||
room_details,
|
room_details,
|
||||||
talk,
|
talk,
|
||||||
style,
|
self._style,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
pages.append(PageBreak())
|
pages.append(PageBreak())
|
||||||
return pages
|
return pages
|
||||||
|
|
||||||
|
@property
|
||||||
def _style(self):
|
def _style(self):
|
||||||
stylesheet = StyleSheet1()
|
stylesheet = StyleSheet1()
|
||||||
stylesheet.add(
|
stylesheet.add(
|
||||||
|
@ -366,7 +366,7 @@ class PDFExporter(ScheduleData):
|
||||||
topMargin=0,
|
topMargin=0,
|
||||||
bottomMargin=0,
|
bottomMargin=0,
|
||||||
)
|
)
|
||||||
doc.build(self._add_pages(doc))
|
doc.build(self._add_pages())
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -78,13 +78,15 @@ class VoctomixLowerThirdsExporter:
|
||||||
encoding="unic",
|
encoding="unic",
|
||||||
)
|
)
|
||||||
|
|
||||||
def _hex2rgb(self, hex_value):
|
@staticmethod
|
||||||
|
def _hex2rgb(hex_value):
|
||||||
hex_value = hex_value.lstrip("#")
|
hex_value = hex_value.lstrip("#")
|
||||||
# black insists this should have spaces around the :, but flake8
|
# black insists this should have spaces around the :, but flake8
|
||||||
# complains about spaces around the :, soooooo ....
|
# complains about spaces around the :, soooooo ....
|
||||||
return tuple(int(hex_value[i : i + 2], 16) for i in (0, 2, 4)) # NOQA
|
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()]
|
words = [i.strip() for i in input_text.split()]
|
||||||
lines = []
|
lines = []
|
||||||
line = []
|
line = []
|
||||||
|
@ -177,7 +179,7 @@ class VoctomixLowerThirdsExporter:
|
||||||
img.save(filename)
|
img.save(filename)
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
f"Generated single-speaker image for {speaker.get_display_name()!r} "
|
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
|
return filename
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ body {
|
||||||
margin-left: -510px;
|
margin-left: -510px;
|
||||||
padding: 15px;
|
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;
|
background-color: #3aa57c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,23 +8,23 @@ from django.utils.safestring import mark_safe
|
||||||
from django.views import View
|
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):
|
class BroadcastToolsFeedbackQrCodeSvg(View):
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
talk = self.request.event.submissions.filter(id=kwargs["talk"]).first()
|
talk = self.request.event.submissions.filter(id=kwargs["talk"]).first()
|
||||||
domain = request.event.custom_domain or settings.SITE_URL
|
domain = request.event.custom_domain or settings.SITE_URL
|
||||||
image = qrcode.make(
|
return _make_svg_response(f"{domain}{talk.urls.feedback}")
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
class BroadcastToolsPublicQrCodeSvg(View):
|
class BroadcastToolsPublicQrCodeSvg(View):
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
talk = self.request.event.submissions.filter(id=kwargs["talk"]).first()
|
talk = self.request.event.submissions.filter(id=kwargs["talk"]).first()
|
||||||
domain = request.event.custom_domain or settings.SITE_URL
|
domain = request.event.custom_domain or settings.SITE_URL
|
||||||
image = qrcode.make(
|
return _make_svg_response(f"{domain}{talk.urls.public}")
|
||||||
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")
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue