Changed res font / added aspect ratio
This commit is contained in:
parent
c81ccd0979
commit
aada337e05
1 changed files with 23 additions and 2 deletions
|
@ -3395,8 +3395,10 @@ class ScreenPage(Page):
|
|||
base_image = QPixmap(template_path)
|
||||
if 'Resolution' in resolution_text:
|
||||
base_image = base_image.scaled(195, 50)
|
||||
font_size = 10
|
||||
else:
|
||||
base_image = base_image.scaled(187, 75)
|
||||
font_size = 13
|
||||
else:
|
||||
base_image = QPixmap(185, 75)
|
||||
base_image.fill(QColor(44, 62, 80))
|
||||
|
@ -3405,7 +3407,7 @@ class ScreenPage(Page):
|
|||
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
|
||||
font = QFont()
|
||||
font.setPointSize(10)
|
||||
font.setPointSize(font_size)
|
||||
font.setBold(True)
|
||||
painter.setFont(font)
|
||||
|
||||
|
@ -3582,20 +3584,39 @@ class ScreenPage(Page):
|
|||
painter = QPainter(base_image)
|
||||
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
|
||||
try:
|
||||
width, height = map(int, resolution_text.split('x'))
|
||||
gcd = self._gcd(width, height)
|
||||
aspect_ratio = f"{width//gcd}:{height//gcd}"
|
||||
except:
|
||||
aspect_ratio = ""
|
||||
|
||||
font = QFont()
|
||||
font.setPointSize(24)
|
||||
font.setBold(True)
|
||||
painter.setFont(font)
|
||||
|
||||
painter.setPen(QColor(0, 255, 255))
|
||||
|
||||
text_rect = base_image.rect()
|
||||
painter.drawText(text_rect, Qt.AlignmentFlag.AlignCenter, resolution_text)
|
||||
|
||||
if aspect_ratio:
|
||||
font.setPointSize(16)
|
||||
painter.setFont(font)
|
||||
painter.setPen(QColor(200, 200, 200))
|
||||
|
||||
aspect_rect = QRect(text_rect.x(), text_rect.y() + 80, text_rect.width(), 40)
|
||||
painter.drawText(aspect_rect, Qt.AlignmentFlag.AlignCenter, f"({aspect_ratio})")
|
||||
|
||||
painter.end()
|
||||
|
||||
self.display.setPixmap(base_image)
|
||||
|
||||
def _gcd(self, a, b):
|
||||
while b:
|
||||
a, b = b, a % b
|
||||
return a
|
||||
|
||||
class ResumePage(Page):
|
||||
def __init__(self, page_stack, main_window=None, parent=None):
|
||||
super().__init__("Resume", page_stack, main_window, parent)
|
||||
|
|
Loading…
Reference in a new issue