From 5325906c22b2094ca2840ad475cc7bba0e214360 Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Fri, 9 Jul 2021 01:58:33 +0200 Subject: [PATCH] Added a right-margin propert Overflow-X check function now takes left and right margin into account --- lib/config.py | 3 ++- lib/dataStructures.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/config.py b/lib/config.py index e5e079c..241a566 100644 --- a/lib/config.py +++ b/lib/config.py @@ -42,7 +42,8 @@ def initConfig(): 'fontColour': '0,0,0', 'metadataColour': '128,128,128', 'topMargin': 10, - 'leftMargin': 25 + 'leftMargin': 25, + 'rightMargin': 25 } # (if CMD arguments: load CMD arguments to override specific settings) with open('config.ini', 'w') as configfile: diff --git a/lib/dataStructures.py b/lib/dataStructures.py index ebb3a89..98f3e10 100644 --- a/lib/dataStructures.py +++ b/lib/dataStructures.py @@ -199,6 +199,7 @@ class Song: self.imageWidth = int(configObj['imageWidth']) self.imageHeight = int(configObj['imageHeight']) self.leftMargin = int(configObj['leftMargin']) + self.rightMargin = int(configObj['rightMargin']) self.fontMetadata = ImageFont.truetype(configObj['metafontfamily'], int(configObj['metaFontWeight'])) self.fontSize = int(configObj['songFontWeight']) self.fontLyrics = ImageFont.truetype(configObj['lyricfontfamily'], self.fontSize) @@ -258,7 +259,7 @@ class Song: """ def checkOverflowX(self): for section in self.sections: - if section.expectedWidth > self.imageWidth: + if section.expectedWidth > self.imageWidth - self.leftMargin - self.rightMargin: return False return True