Skip to content

Commit

Permalink
run precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
sumpfork committed Mar 19, 2024
1 parent 616a956 commit 424cdf6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
pip install -r requirements.txt
pip install .
- name: Lint
run: pre-commit run --all-files
run: pre-commit run --all-files --show-diff-on-failure -v
- name: Test
run: pytest
76 changes: 45 additions & 31 deletions src/domdiv/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ def __init__(
0 # Exact Centre special case, so swapping is still exact centre
)
elif CardPlot.tabNumber == 1:
self.tabIndex = (
self.tabIndexBack
) = 1 # There is only one tab, so can only use 1 for both sides
self.tabIndex = self.tabIndexBack = (
1 # There is only one tab, so can only use 1 for both sides
)
elif 1 <= self.tabIndex <= CardPlot.tabNumber:
self.tabIndexBack = CardPlot.tabNumber + 1 - self.tabIndex
else:
Expand Down Expand Up @@ -629,9 +629,11 @@ def registerFonts(self):
pdfmetrics.registerFont(
TTFont(
font,
fontpath
if is_local
else pkg_resources.resource_filename("domdiv", fontpath),
(
fontpath
if is_local
else pkg_resources.resource_filename("domdiv", fontpath)
),
)
)
registered[font] = fontpath
Expand Down Expand Up @@ -786,9 +788,7 @@ def drawPanelOutline(
line = (
plotter.LINE
if lineType.lower() == "line"
else plotter.DOT
if lineType.lower() == "dot"
else NO_LINE
else plotter.DOT if lineType.lower() == "dot" else NO_LINE
)
# lines ending at a midpoint (no dots)
midline = NO_LINE if line == plotter.DOT else line
Expand Down Expand Up @@ -1012,9 +1012,7 @@ def tabHeight(panelStyle, panelHeight):
return (
panelHeight
if panelStyle in ["tab", "strap"]
else item.tabHeight
if panelStyle == "folder"
else 0.0
else item.tabHeight if panelStyle == "folder" else 0.0
)

headTabHeight = tabHeight(self.options.head, headHeight)
Expand Down Expand Up @@ -1692,11 +1690,15 @@ def drawTab(self, item, panel=None, backside=False):
side = (
CardPlot.CENTRE
if self.options.tab_name_align == "centre" or self.wantCentreTab(card)
else CardPlot.LEFT
if self.options.tab_name_align == "left"
else CardPlot.RIGHT
if self.options.tab_name_align == "right"
else item.getClosestSide(backside=backside)
else (
CardPlot.LEFT
if self.options.tab_name_align == "left"
else (
CardPlot.RIGHT
if self.options.tab_name_align == "right"
else item.getClosestSide(backside=backside)
)
)
)

# calculate x position and write text
Expand Down Expand Up @@ -2170,24 +2172,36 @@ def calculatePages(self, cards):
options.headHeight = (
0.0
if options.head == "none"
else options.head_height * cm
if options.head_height
else options.dividerBaseHeight + options.labelHeight
if options.head == "folder"
else options.dividerBaseHeight
if options.head == "cover"
else options.labelHeight # tab or strap
else (
options.head_height * cm
if options.head_height
else (
options.dividerBaseHeight + options.labelHeight
if options.head == "folder"
else (
options.dividerBaseHeight
if options.head == "cover"
else options.labelHeight
)
)
) # tab or strap
)
options.tailHeight = (
0.0
if options.tail in ["none", "tab"] # not a real tab
else options.tail_height * cm
if options.tail_height
else options.dividerBaseHeight + options.labelHeight
if options.tail == "folder"
else options.dividerBaseHeight
if options.tail == "cover"
else options.labelHeight # strap
else (
options.tail_height * cm
if options.tail_height
else (
options.dividerBaseHeight + options.labelHeight
if options.tail == "folder"
else (
options.dividerBaseHeight
if options.tail == "cover"
else options.labelHeight
)
)
) # strap
)

# Set Height
Expand Down

0 comments on commit 424cdf6

Please sign in to comment.