diff --git a/soitool/inline_editable_soi_view.py b/soitool/inline_editable_soi_view.py index 564e7f11d1f96fd459b6b06684c0fe4b1a77c558..54189b333dce39c0bc47ccd12192419ae8053c2f 100644 --- a/soitool/inline_editable_soi_view.py +++ b/soitool/inline_editable_soi_view.py @@ -436,7 +436,9 @@ class InlineEditableSOIView(QScrollArea): creation_date = soi_date_string_to_user_friendly_string(self.soi.date) label_creation_date = QLabel("Opprettet: {}".format(creation_date)) label_creation_date.setStyleSheet("background-color: rgba(0,0,0,0%)") - label_creation_date.setFont(qfont_with_pixel_size("Times New Roman", 25)) + label_creation_date.setFont( + qfont_with_pixel_size("Times New Roman", 25) + ) # Source: https://stackoverflow.com/a/8638114/3545896 # CAUTION: does not work if font is set through stylesheet label_width = ( @@ -494,7 +496,9 @@ class InlineEditableSOIView(QScrollArea): label_copy_number_header.setStyleSheet( "background-color: rgba(0,0,0,0%)" ) - label_copy_number_header.setFont(qfont_with_pixel_size("Times New Roman", 25)) + label_copy_number_header.setFont( + qfont_with_pixel_size("Times New Roman", 25) + ) # Source: https://stackoverflow.com/a/8638114/3545896 # CAUTION: does not work if font is set through stylesheet label_width = ( diff --git a/soitool/modules/module_authentication_board.py b/soitool/modules/module_authentication_board.py index e1f59126a50306e44e06bb14c6d2f8b8c7ed91ce..06ba84f67f0fee4b0a46b072c50bde45af22b0ea 100644 --- a/soitool/modules/module_authentication_board.py +++ b/soitool/modules/module_authentication_board.py @@ -4,7 +4,11 @@ from secrets import choice from PySide2.QtWidgets import QTableWidgetItem from PySide2 import QtGui from PySide2.QtCore import Qt -from soitool.modules.module_base import resize_table, qfont_with_pixel_size, TABLE_CELL_DEFAULT_FONT +from soitool.modules.module_base import ( + resize_table, + qfont_with_pixel_size, + TABLE_CELL_DEFAULT_FONT, +) from soitool.modules.code_table_base import CodeTableBase # Characters for first column, @@ -21,7 +25,9 @@ CODE_LENGTH = 25 CODE_CHARACTER_TYPE = "ascii" # Font for authentication codes, should be a monospaced font -CODE_FONT = qfont_with_pixel_size("Consolas", TABLE_CELL_DEFAULT_FONT.pixelSize(), QtGui.QFont.SansSerif) +CODE_FONT = qfont_with_pixel_size( + "Consolas", TABLE_CELL_DEFAULT_FONT.pixelSize(), QtGui.QFont.SansSerif +) # Adds space between sets of characters, 0 => no spaces # If code is 123456 and interval is 2, code will be 12 34 56 diff --git a/soitool/modules/module_base.py b/soitool/modules/module_base.py index 4a6e1e17b1cb398de62da8b9afd5bbd7a9c3ae1e..c260df7968227ce33ed44c5b2c36e0a741fc04a9 100644 --- a/soitool/modules/module_base.py +++ b/soitool/modules/module_base.py @@ -2,6 +2,7 @@ from abc import ABC from PySide2 import QtGui + def qfont_with_pixel_size(font_family, pixel_size, weight=None): """Provide a QFont with given family and pixel size. @@ -24,11 +25,13 @@ def qfont_with_pixel_size(font_family, pixel_size, weight=None): font.setPixelSize(pixel_size) return font + # Font for module headline HEADLINE_FONT = qfont_with_pixel_size("Arial", 24, 100) TABLE_CELL_DEFAULT_FONT = qfont_with_pixel_size("Arial", 16) + class ModuleBase(ABC): """Interface for SOI-modules.""" diff --git a/soitool/modules/module_freetext.py b/soitool/modules/module_freetext.py index 1d1f47dc02d8491428a716977e6e60403198410d..14ede836bcd46425bc8d10a1a198121b566759af 100644 --- a/soitool/modules/module_freetext.py +++ b/soitool/modules/module_freetext.py @@ -13,7 +13,11 @@ from PySide2.QtWidgets import ( ) from PySide2.QtCore import QSize, Qt from PySide2.QtGui import QIcon, QFontMetricsF -from soitool.modules.module_base import ModuleBase, HEADLINE_FONT, qfont_with_pixel_size +from soitool.modules.module_base import ( + ModuleBase, + HEADLINE_FONT, + qfont_with_pixel_size, +) class TextEditWithSizeOfContent(QTextEdit): @@ -113,7 +117,9 @@ class FreeTextModule(ModuleBase, QWidget, metaclass=Meta): self.line_edit_header = LineEditWithSizeOfContent() self.line_edit_header.setFont(HEADLINE_FONT) self.text_edit_body = TextEditWithSizeOfContent() - self.text_edit_body.setFont(qfont_with_pixel_size("Arial", HEADLINE_FONT.pixelSize())) + self.text_edit_body.setFont( + qfont_with_pixel_size("Arial", HEADLINE_FONT.pixelSize()) + ) # When the contents of these widgets change we need to manually trigger # adjust of size, even on self. Without adjust of size on self the diff --git a/soitool/modules/module_subtractorcodes.py b/soitool/modules/module_subtractorcodes.py index 9ded65cd2c8aa4ec625285be3fab2a26f1ede908..89d3f5c479e4f153489101b426450849a5a3db59 100644 --- a/soitool/modules/module_subtractorcodes.py +++ b/soitool/modules/module_subtractorcodes.py @@ -3,7 +3,11 @@ import string from PySide2.QtWidgets import QTableWidgetItem from PySide2 import QtGui from PySide2.QtCore import Qt -from soitool.modules.module_base import resize_table, qfont_with_pixel_size, TABLE_CELL_DEFAULT_FONT +from soitool.modules.module_base import ( + resize_table, + qfont_with_pixel_size, + TABLE_CELL_DEFAULT_FONT, +) from soitool.modules.code_table_base import CodeTableBase # Characters for first and second column @@ -21,7 +25,9 @@ SPACE_INTERVAL = 4 SPACE_AMOUNT = 3 # Font for subtractorcodes -CODE_FONT = qfont_with_pixel_size("Arial", TABLE_CELL_DEFAULT_FONT.pixelSize(), QtGui.QFont.SansSerif) +CODE_FONT = qfont_with_pixel_size( + "Arial", TABLE_CELL_DEFAULT_FONT.pixelSize(), QtGui.QFont.SansSerif +) HEADLINE_TEXT = "Subtraktorkoder"