From b1aba3030ea7ee52fce95f46ca0b250d2d813cda Mon Sep 17 00:00:00 2001 From: "Anders H. Rebner" <anderhre@stud.ntnu.no> Date: Tue, 31 Mar 2020 11:15:52 +0200 Subject: [PATCH] Flyttet HEADLINE_FONT til module_base --- soitool/modules/module_authentification_board.py | 5 +---- soitool/modules/module_base.py | 7 +++++++ soitool/modules/module_table.py | 8 ++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/soitool/modules/module_authentification_board.py b/soitool/modules/module_authentification_board.py index 09c975e..a25512c 100644 --- a/soitool/modules/module_authentification_board.py +++ b/soitool/modules/module_authentification_board.py @@ -8,6 +8,7 @@ from soitool.modules.module_base import ( ModuleBase, get_table_size, resize_table, + HEADLINE_FONT, ) START_NO_OF_AUTHENTICATION_CODES = 10 @@ -20,10 +21,6 @@ SEPARATE_INTERVAL = 5 # Adds space between sets of characters, 0 => no spaces # If code is 1234567 and interval is 2, code will be 123 45 67 HEADLINE_TEXT = "Autentifiseringstavle" -HEADLINE_FONT = QtGui.QFont() -HEADLINE_FONT.setFamily("Arial") -HEADLINE_FONT.setPointSize(12) -HEADLINE_FONT.setWeight(100) class Meta(type(ModuleBase), type(QTableWidget)): diff --git a/soitool/modules/module_base.py b/soitool/modules/module_base.py index dcbd1b1..5e4535d 100644 --- a/soitool/modules/module_base.py +++ b/soitool/modules/module_base.py @@ -1,5 +1,12 @@ """Base/interface of each module.""" from abc import ABC +from PySide2 import QtGui + +# Font for module headline +HEADLINE_FONT = QtGui.QFont() +HEADLINE_FONT.setFamily("Arial") +HEADLINE_FONT.setPointSize(12) +HEADLINE_FONT.setWeight(100) class ModuleBase(ABC): diff --git a/soitool/modules/module_table.py b/soitool/modules/module_table.py index 8cf7119..66c5d09 100644 --- a/soitool/modules/module_table.py +++ b/soitool/modules/module_table.py @@ -5,13 +5,9 @@ from soitool.modules.module_base import ( ModuleBase, resize_table, get_table_size, + HEADLINE_FONT, ) -HEADER_FONT = QtGui.QFont() -HEADER_FONT.setFamily("Arial") -HEADER_FONT.setPointSize(12) -HEADER_FONT.setWeight(100) - START_ROWS = 2 START_COLUMNS = 2 @@ -126,7 +122,7 @@ class TableModule(ModuleBase, QTableWidget, metaclass=Meta): """ item = QTableWidgetItem(text) item.setBackground(QtGui.QBrush(QtGui.QColor(220, 220, 220))) - item.setFont(HEADER_FONT) + item.setFont(HEADLINE_FONT) self.setItem(0, column, item) def add_column(self): -- GitLab