Skip to content
Snippets Groups Projects
Commit 6ef97b10 authored by Anders H. Rebner's avatar Anders H. Rebner
Browse files

#101 Flyttet sjekk til superklasse

parent e766d00e
No related branches found
No related tags found
1 merge request!67#101 & #121 kodetabell-innstillings-popup og db/DB->database i GUI
Pipeline #82525 failed
......@@ -29,13 +29,16 @@ class CodeTableBase(ModuleBase, QTableWidget, metaclass=Meta):
"""
def __init__(self, size, data):
if self.type not in [
AUTHENTICATIONBOARD_MODULE,
SUBTRACTORCODES_MODULE,
]:
# Disabling pylint-error 'Access to member before its definition line'
# because the variable is defined in subclass.
# pylint: disable=E0203
if self.start_no_of_codes > self.maximum_no_of_codes:
raise ValueError(
"Invalid value for class-variable type: "
"'{}'".format(self.type)
"The value of module-constant 'START_NO_OF_CODES' is larger "
"than module-constant 'MAXIMUM_NO_OF_CODES': "
"{} > {}".format(
self.start_no_of_codes, self.maximum_no_of_codes
)
)
QTableWidget.__init__(self)
ModuleBase.__init__(self)
......
......@@ -23,7 +23,6 @@ CODE_CHARACTER_TYPE = "ascii"
# Font for authentication codes, should be a monospaced font
CODE_FONT = QtGui.QFont("Consolas", 10, 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
SPACE_INTERVAL = 5
......@@ -60,12 +59,6 @@ class AuthenticationBoardModule(CodeTableBase):
def __init__(self, size=None, data=None):
self.type = "AuthenticationBoardModule"
if START_NO_OF_CODES > MAXIMUM_NO_OF_CODES:
raise ValueError(
"Invalid value for CONSTANT 'START_NO_OF_CODES': "
"'{}'".format(START_NO_OF_CODES)
)
if CODE_CHARACTER_TYPE == "ascii":
self.code_characters = string.ascii_uppercase
elif CODE_CHARACTER_TYPE == "digits":
......
......@@ -50,11 +50,6 @@ class SubtractorcodesModule(CodeTableBase):
def __init__(self, size=None, data=None):
self.type = "SubtractorcodesModule"
if START_NO_OF_CODES > MAXIMUM_NO_OF_CODES:
raise ValueError(
"Invalid value for CONSTANT 'START_NO_OF_CODES': "
"'{}'".format(START_NO_OF_CODES)
)
self.code_character_type = "digits"
self.code_font = CODE_FONT
self.maximum_no_of_codes = MAXIMUM_NO_OF_CODES
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment