4.0 Beta (Build 20244)

This commit is contained in:
2020-08-31 23:46:14 +02:00
Unverified
parent 1655e17bbe
commit 9316073148
2 changed files with 73 additions and 20 deletions

View File

@@ -122,3 +122,10 @@
- Ukończenie instrukcji - Ukończenie instrukcji
- Ukończenie sekcji strony "O programie" - Ukończenie sekcji strony "O programie"
- Ukończenie sekcji strony "Opis" - Ukończenie sekcji strony "Opis"
4.0 Beta (Build 20244)
- Wsparcie dla kodowania ANSI
- Wyeliminowanie błędu wyrzucającego wyjątek po naciśnięciu przycisku START bez wprowadzenia danych powyżej
- Poprawki w pliku wyjściowym office (usunięcie dwóch przecinków pomiedzy stanowiskiem a klasą)
- Wyeliminowanie błędu pokazującego w komunikacie o błędnych danych, przy zapisie format presetu, wpisanej wartości zamiast recordu
- Wyeliminowanie błędu pozwalającego na zapisanie wprowadzonego w spinboxie tekstu

View File

@@ -23,7 +23,7 @@ class VAR:
programToW = ['styczeń', '2019', 'wrzesień', '2020'] programToW = ['styczeń', '2019', 'wrzesień', '2020']
# Dozwolone kodowanie plików # Dozwolone kodowanie plików
allowedCoding = ['utf-8'] allowedCoding = ['utf-8', 'ANSI']
# Dozwolone znaki # Dozwolone znaki
allowedCharactersInSeparator = ['`', '~', '!', '@', '#', '$', '%', '^', '&', '(', ')', '-', '_', '=', '+', '[', ']', ' ', '?', '/', '>', '.', '<', ',', '"', "'", ':', ';', '|'] allowedCharactersInSeparator = ['`', '~', '!', '@', '#', '$', '%', '^', '&', '(', ')', '-', '_', '=', '+', '[', ']', ' ', '?', '/', '>', '.', '<', ',', '"', "'", ':', ';', '|']
@@ -199,6 +199,10 @@ class CFG:
# Funkcje sprawdzające poprawność recordu # Funkcje sprawdzające poprawność recordu
def __checkI(self, write, record, var): def __checkI(self, write, record, var):
if write: if write:
try:
var = int(var)
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
var = str(var) var = str(var)
else: else:
try: try:
@@ -213,6 +217,12 @@ class CFG:
if var['D'] == None: if var['D'] == None:
varX += '*' varX += '*'
else: else:
try:
var['D'] = int(var['D'])
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
if int(var['s']) > 31 or int(var['s']) < 1:
return (False, 'Niepoprawne dane - klucz: %s' % record)
day = str(var['D']) day = str(var['D'])
if len(day) == 1: if len(day) == 1:
day = '0' + day day = '0' + day
@@ -221,6 +231,12 @@ class CFG:
if var['M'] == None: if var['M'] == None:
varX += '*' varX += '*'
else: else:
try:
var['M'] = int(var['M'])
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
if int(var['s']) > 12 or int(var['s']) < 1:
return (False, 'Niepoprawne dane - klucz: %s' % record)
month = str(var['M']) month = str(var['M'])
if len(month) == 1: if len(month) == 1:
month = '0' + month month = '0' + month
@@ -229,11 +245,23 @@ class CFG:
if var['Y'] == None: if var['Y'] == None:
varX += '*' varX += '*'
else: else:
try:
var['Y'] = int(var['Y'])
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
if int(var['Y']) == 0:
return (False, 'Niepoprawne dane - klucz: %s' % record)
varX += str(var['Y']) varX += str(var['Y'])
varX += ' ' varX += ' '
if var['h'] == None: if var['h'] == None:
varX += '*' varX += '*'
else: else:
try:
var['h'] = int(var['h'])
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
if int(var['h']) > 23 or int(var['h']) < 1:
return (False, 'Niepoprawne dane - klucz: %s' % record)
hour = str(var['h']) hour = str(var['h'])
if len(hour) == 1: if len(hour) == 1:
hour = '0' + hour hour = '0' + hour
@@ -242,6 +270,12 @@ class CFG:
if var['m'] == None: if var['m'] == None:
varX += '*' varX += '*'
else: else:
try:
var['m'] = int(var['m'])
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
if int(var['m']) > 59 or int(var['m']) < 0:
return (False, 'Niepoprawne dane - klucz: %s' % record)
minute = str(var['m']) minute = str(var['m'])
if len(minute) == 1: if len(minute) == 1:
minute = '0' + minute minute = '0' + minute
@@ -250,6 +284,12 @@ class CFG:
if var['s'] == None: if var['s'] == None:
varX += '*' varX += '*'
else: else:
try:
var['s'] = int(var['s'])
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
if int(var['s']) > 59 or int(var['s']) < 0:
return (False, 'Niepoprawne dane - klucz: %s' % record)
seconds = str(var['s']) seconds = str(var['s'])
if len(seconds) == 1: if len(seconds) == 1:
seconds = '0' + seconds seconds = '0' + seconds
@@ -268,6 +308,10 @@ class CFG:
index = 0 index = 0
for x in var: for x in var:
if x != '*': if x != '*':
try:
x = int(x)
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
varToReturn[dateLabels[index]] = int(x) varToReturn[dateLabels[index]] = int(x)
else: else:
varToReturn[dateLabels[index]] = None varToReturn[dateLabels[index]] = None
@@ -636,7 +680,7 @@ class FMT:
check = check.strip('<enter>') check = check.strip('<enter>')
for x in check: for x in check:
if x not in VAR.allowedCharactersInSeparator: if x not in VAR.allowedCharactersInSeparator:
return [False, 'Niepoprawne dane - klucz: %s' % var] return [False, 'Niepoprawne dane - klucz: %s' % record]
return [True, var] return [True, var]
def __checkAs(self, write, record, var): def __checkAs(self, write, record, var):
@@ -646,7 +690,7 @@ class FMT:
x = x.strip('<enter>') x = x.strip('<enter>')
for y in x: for y in x:
if y not in VAR.allowedCharactersInSeparator: if y not in VAR.allowedCharactersInSeparator:
return [False, 'Niepoprawne dane - klucz: %s' % var] return [False, 'Niepoprawne dane - klucz: %s' % record]
var = str(var) var = str(var)
else: else:
new_contentVar = (var)[2:-2].split("', '") new_contentVar = (var)[2:-2].split("', '")
@@ -655,12 +699,16 @@ class FMT:
x = x.strip('<enter>') x = x.strip('<enter>')
for y in x: for y in x:
if y not in VAR.allowedCharactersInSeparator: if y not in VAR.allowedCharactersInSeparator:
return [False, 'Niepoprawne dane - klucz: %s' % var] return [False, 'Niepoprawne dane - klucz: %s' % record]
var = new_contentVar var = new_contentVar
return [True, var] return [True, var]
def __checkI(self, write, record, var): def __checkI(self, write, record, var):
if write: if write:
try:
var = int(var)
except:
return (False, 'Niepoprawne dane - klucz: %s' % record)
var = str(var) var = str(var)
else: else:
try: try:
@@ -671,7 +719,7 @@ class FMT:
def __checkSc(self, record, var): def __checkSc(self, record, var):
if var not in VAR.allowedCoding: if var not in VAR.allowedCoding:
return [False, 'Niepoprawne dane - klucz: %s' % var] return [False, 'Niepoprawne dane - klucz: %s' % record]
return [True, var] return [True, var]
@@ -869,9 +917,9 @@ class dataProcess:
filledFiles.append(index) filledFiles.append(index)
index += 1 index += 1
if len(filledFiles) != 0: if len(filledFiles) != 0:
return (True, filledFiles) return [True, filledFiles]
else: else:
return (False) return [False]
def __checkIfInputFilesIsReadable(self, files, filledFiles): def __checkIfInputFilesIsReadable(self, files, filledFiles):
for x in filledFiles: for x in filledFiles:
@@ -1029,8 +1077,6 @@ class dataProcess:
else: else:
office += 'nauczyciel' office += 'nauczyciel'
office += ',' office += ','
office += ','
office += ','
if x[0]: if x[0]:
office += str(yearOfGraduation) office += str(yearOfGraduation)
if (schoolData[x[4]])[1]: if (schoolData[x[4]])[1]:
@@ -2843,16 +2889,16 @@ class mainWindow:
"personSeparator" : self.EPOSPersonSeparatorEntry.get(), "personSeparator" : self.EPOSPersonSeparatorEntry.get(),
"rowSeparator" : self.EPOSRowSeparatorEntry.get(), "rowSeparator" : self.EPOSRowSeparatorEntry.get(),
"dataSeparators" : (self.EPOSDataSeparatorText.get("1.0", TK.END)).split('\n')[:-1], "dataSeparators" : (self.EPOSDataSeparatorText.get("1.0", TK.END)).split('\n')[:-1],
"loginRow" : int(self.EPDLLoginRowSpinbox.get()), "loginRow" : self.EPDLLoginRowSpinbox.get(),
"loginPositionInRow" : int(self.EPDLLoginPosInRowSpinbox.get()), "loginPositionInRow" : self.EPDLLoginPosInRowSpinbox.get(),
"fnameRow" : int(self.EPDLFnameRowSpinbox.get()), "fnameRow" : self.EPDLFnameRowSpinbox.get(),
"fnamePositionInRow" : int(self.EPDLFnamePosInRowSpinbox.get()), "fnamePositionInRow" : self.EPDLFnamePosInRowSpinbox.get(),
"lnameRow" : int(self.EPDLLnameRowSpinbox.get()), "lnameRow" : self.EPDLLnameRowSpinbox.get(),
"lnamePositionInRow" : int(self.EPDLLnamePosInRowSpinbox.get()), "lnamePositionInRow" : self.EPDLLnamePosInRowSpinbox.get(),
"schoolRow" : int(self.EPDLSchoolRowSpinbox.get()), "schoolRow" : self.EPDLSchoolRowSpinbox.get(),
"schoolPositionInRow" : int(self.EPDLSchoolPosInRowSpinbox.get()), "schoolPositionInRow" : self.EPDLSchoolPosInRowSpinbox.get(),
"classRow" : int(self.EPDLClassRowSpinbox.get()), "classRow" : self.EPDLClassRowSpinbox.get(),
"classPositionInRow" : int(self.EPDLClassPosInRowSpinbox.get()), "classPositionInRow" : self.EPDLClassPosInRowSpinbox.get(),
"inputCoding" : self.formatInputCodingCombobox.get() "inputCoding" : self.formatInputCodingCombobox.get()
} }
if not FMT.W(self.loadingList.get(), formatFileContentToSave): if not FMT.W(self.loadingList.get(), formatFileContentToSave):