mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2026-10-02 01:37:17 +00:00
Ruff fixes in progress
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from reportlab.lib.units import inch
|
from reportlab.lib.units import inch
|
||||||
from reportlab.pdfbase import pdfmetrics
|
from reportlab.pdfbase import pdfmetrics
|
||||||
@@ -70,10 +71,10 @@ def make_doc_template(
|
|||||||
client: str,
|
client: str,
|
||||||
document_subheader: str,
|
document_subheader: str,
|
||||||
left_margin=0.5 * inch,
|
left_margin=0.5 * inch,
|
||||||
fonts: List[TTFont] = [],
|
fonts: list[TTFont] = [],
|
||||||
) -> ADRDocTemplate:
|
) -> ADRDocTemplate:
|
||||||
right_margin = top_margin = bottom_margin = 0.5 * inch
|
right_margin = top_margin = bottom_margin = 0.5 * inch
|
||||||
page_box = GRect(0.0, 0.0, page_size[0], page_size[1])
|
page_box: GRect = GRect(0.0, 0.0, page_size[0], page_size[1])
|
||||||
_, page_box = page_box.split_x(left_margin, direction="l")
|
_, page_box = page_box.split_x(left_margin, direction="l")
|
||||||
_, page_box = page_box.split_x(right_margin, direction="r")
|
_, page_box = page_box.split_x(right_margin, direction="r")
|
||||||
_, page_box = page_box.split_y(bottom_margin, direction="u")
|
_, page_box = page_box.split_y(bottom_margin, direction="u")
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
from typing import List, Tuple
|
|
||||||
|
|
||||||
from reportlab.lib.pagesizes import letter, portrait
|
from reportlab.lib.pagesizes import letter, portrait
|
||||||
from reportlab.lib.styles import getSampleStyleSheet
|
from reportlab.lib.styles import getSampleStyleSheet
|
||||||
@@ -9,8 +8,6 @@ from reportlab.platypus import Paragraph, Table
|
|||||||
from ptulsconv.broadcast_timecode import TimecodeFormat
|
from ptulsconv.broadcast_timecode import TimecodeFormat
|
||||||
from ptulsconv.pdf import make_doc_template
|
from ptulsconv.pdf import make_doc_template
|
||||||
|
|
||||||
# TODO: A Continuity
|
|
||||||
|
|
||||||
|
|
||||||
def table_for_scene(scene, tc_format, font_name="Helvetica"):
|
def table_for_scene(scene, tc_format, font_name="Helvetica"):
|
||||||
scene_style = getSampleStyleSheet()["Normal"]
|
scene_style = getSampleStyleSheet()["Normal"]
|
||||||
@@ -19,11 +16,8 @@ def table_for_scene(scene, tc_format, font_name="Helvetica"):
|
|||||||
scene_style.leftPadding = 0.0
|
scene_style.leftPadding = 0.0
|
||||||
scene_style.spaceAfter = 18.0
|
scene_style.spaceAfter = 18.0
|
||||||
|
|
||||||
tc_data = "<em>%s</em><br />%s" % (
|
tc_data = f"<em>{tc_format.seconds_to_smpte(scene[2])}</em><br />{tc_format.seconds_to_smpte(scene[3])}"
|
||||||
tc_format.seconds_to_smpte(scene[2]),
|
|
||||||
tc_format.seconds_to_smpte(scene[3]),
|
|
||||||
)
|
|
||||||
|
|
||||||
row = [
|
row = [
|
||||||
Paragraph(tc_data, scene_style),
|
Paragraph(tc_data, scene_style),
|
||||||
Paragraph(scene[1], scene_style),
|
Paragraph(scene[1], scene_style),
|
||||||
@@ -40,14 +34,14 @@ def table_for_scene(scene, tc_format, font_name="Helvetica"):
|
|||||||
|
|
||||||
|
|
||||||
def output_report(
|
def output_report(
|
||||||
scenes: List[Tuple[str, str, Fraction, Fraction]],
|
scenes: list[tuple[str, str, Fraction, Fraction]],
|
||||||
tc_display_format: TimecodeFormat,
|
tc_display_format: TimecodeFormat,
|
||||||
title: str,
|
title: str,
|
||||||
client: str,
|
client: str,
|
||||||
supervisor,
|
supervisor,
|
||||||
paper_size=letter,
|
paper_size=letter,
|
||||||
):
|
):
|
||||||
filename = "%s Continuity.pdf" % title
|
filename = f"{title} Continuity.pdf"
|
||||||
document_header = "Continuity"
|
document_header = "Continuity"
|
||||||
|
|
||||||
doc = make_doc_template(
|
doc = make_doc_template(
|
||||||
@@ -61,7 +55,7 @@ def output_report(
|
|||||||
document_header=document_header,
|
document_header=document_header,
|
||||||
left_margin=0.5 * inch,
|
left_margin=0.5 * inch,
|
||||||
)
|
)
|
||||||
story = list()
|
story = []
|
||||||
# story.append(Spacer(height=0.5 * inch, width=1.))
|
# story.append(Spacer(height=0.5 * inch, width=1.))
|
||||||
for scene in scenes:
|
for scene in scenes:
|
||||||
story.append(table_for_scene(scene, tc_display_format))
|
story.append(table_for_scene(scene, tc_display_format))
|
||||||
|
|||||||
Reference in New Issue
Block a user