Fix beim Migrieren. Logs werden in Log Ordner geschoben. Notpad geht im Fehlerfall auf
This commit is contained in:
@@ -16,6 +16,7 @@ class Environment:
|
|||||||
self.data_dir = os.environ.get('CREMIG_DATA')
|
self.data_dir = os.environ.get('CREMIG_DATA')
|
||||||
self.out_dir = os.environ.get('CREMIG_WORK')
|
self.out_dir = os.environ.get('CREMIG_WORK')
|
||||||
self.cfg_dir = os.environ.get('CREMIG_CFG')
|
self.cfg_dir = os.environ.get('CREMIG_CFG')
|
||||||
|
self.log_dir = os.environ.get('CREMIG_LOG')
|
||||||
self.ruledesigner_csv_filename = os.environ.get('RD_DATABASE_NAME')
|
self.ruledesigner_csv_filename = os.environ.get('RD_DATABASE_NAME')
|
||||||
|
|
||||||
def build_gui(model, configs, env, sivasid=None, uselocal=True):
|
def build_gui(model, configs, env, sivasid=None, uselocal=True):
|
||||||
|
|||||||
+20
-13
@@ -4,6 +4,7 @@ import os
|
|||||||
import glob
|
import glob
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import shutil
|
||||||
|
|
||||||
class DataModel:
|
class DataModel:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -342,6 +343,9 @@ class CadItem(DataModel):
|
|||||||
return None
|
return None
|
||||||
def get_all_gui_data(self):
|
def get_all_gui_data(self):
|
||||||
return self._gui_data
|
return self._gui_data
|
||||||
|
|
||||||
|
def get_halbzeug_laenge_of_asm_id(self):
|
||||||
|
self.get_asm_id()
|
||||||
|
|
||||||
def _transform_content_from_csv(self, translated_data, author=None):
|
def _transform_content_from_csv(self, translated_data, author=None):
|
||||||
""""baut die Texte aus der csv Datei nach dem Einladen um"""
|
""""baut die Texte aus der csv Datei nach dem Einladen um"""
|
||||||
@@ -856,23 +860,28 @@ class CadItem(DataModel):
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
path = all_logs[0]
|
path = all_logs[0]
|
||||||
|
content = ''
|
||||||
try:
|
try:
|
||||||
with open(path, 'r', encoding='utf-16le') as f:
|
with open(path, 'r', encoding='utf-16le') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
if re.findall(r'1 out of 1', content):
|
|
||||||
os.remove(path)
|
|
||||||
self.message_info('Preparation sucessful', 'preparation_sucessful', {'path':impf_pfad})
|
|
||||||
return True
|
|
||||||
elif re.findall(r'Error', content):
|
|
||||||
self.message_error('Something went wrong', 'some_error_in_log')
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
self.message_error('Something went wrong', 'some_error_in_log')
|
|
||||||
return False
|
|
||||||
except Exception:
|
except Exception:
|
||||||
raise Exception("log file could not be opened")
|
raise Exception("log file could not be opened")
|
||||||
|
|
||||||
|
ret = False
|
||||||
|
if re.findall(r'1 out of 1', content):
|
||||||
|
os.remove(path)
|
||||||
|
self.message_info('Preparation sucessful', 'preparation_sucessful', {'path':impf_pfad})
|
||||||
|
ret = True
|
||||||
|
elif re.findall(r'Error', content):
|
||||||
|
self.message_error('Something went wrong', 'some_error_in_log')
|
||||||
|
else:
|
||||||
|
self.message_error('Something went wrong', 'some_error_in_log')
|
||||||
|
if not ret:
|
||||||
|
log_editor = os.environ.get(r'LOG_EDITOR')
|
||||||
|
subprocess.run(f"{log_editor} {path}")
|
||||||
|
shutil.move(path, self.get_env('log'))
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def create_migration_file(self, data):
|
def create_migration_file(self, data):
|
||||||
@@ -1233,7 +1242,6 @@ class CadItem(DataModel):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CadItemRepository:
|
class CadItemRepository:
|
||||||
"""
|
"""
|
||||||
container class for all CadItems in the local folder
|
container class for all CadItems in the local folder
|
||||||
@@ -1266,7 +1274,6 @@ class CadItemRepository:
|
|||||||
raise Exception("CadItem not found")
|
raise Exception("CadItem not found")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GuiLogic():
|
class GuiLogic():
|
||||||
"""
|
"""
|
||||||
Class for business logic. implementing the dependencies between different user inputs
|
Class for business logic. implementing the dependencies between different user inputs
|
||||||
|
|||||||
+3
-1
@@ -42,7 +42,7 @@ messages = {
|
|||||||
"blacklist_not_exist": 'Bitte Blacklist vom Server holen',
|
"blacklist_not_exist": 'Bitte Blacklist vom Server holen',
|
||||||
"wrong_impftool_path": 'Pfad zur DataPrepUtility.exe nicht gefunden. Bitte setenv.bat prüfen.' ,
|
"wrong_impftool_path": 'Pfad zur DataPrepUtility.exe nicht gefunden. Bitte setenv.bat prüfen.' ,
|
||||||
"too_many_logfiles":'Keine eindeutige Logdatei zum aktuellen DataPrep Prozess gefunden. Bitte löschen Sie die überflüssigen .log files',
|
"too_many_logfiles":'Keine eindeutige Logdatei zum aktuellen DataPrep Prozess gefunden. Bitte löschen Sie die überflüssigen .log files',
|
||||||
"some_error_in_log":'Log Datei enthlt einben Fehler. Bitte prüfen.',
|
"some_error_in_log":'Log Datei enthält einen Fehler. Bitte prüfen.',
|
||||||
"preparation_sucessful":'Preparation mit der Datei {path} erfolgreich'
|
"preparation_sucessful":'Preparation mit der Datei {path} erfolgreich'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,6 +254,8 @@ class Controller(Observer):
|
|||||||
text = text.format(Labels=values['Labels'])
|
text = text.format(Labels=values['Labels'])
|
||||||
if 'Zeichentyp' in values:
|
if 'Zeichentyp' in values:
|
||||||
text = text.format(Zeichentyp=values['Zeichentyp'], Feldname=values['Feldname'] )
|
text = text.format(Zeichentyp=values['Zeichentyp'], Feldname=values['Feldname'] )
|
||||||
|
if 'path' in values:
|
||||||
|
text = text.format(path=values['path'])
|
||||||
return messagebox.showerror(title, text)
|
return messagebox.showerror(title, text)
|
||||||
|
|
||||||
def callback(self, key, value):
|
def callback(self, key, value):
|
||||||
|
|||||||
Reference in New Issue
Block a user