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.out_dir = os.environ.get('CREMIG_WORK')
|
||||
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')
|
||||
|
||||
def build_gui(model, configs, env, sivasid=None, uselocal=True):
|
||||
|
||||
+20
-13
@@ -4,6 +4,7 @@ import os
|
||||
import glob
|
||||
import re
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
class DataModel:
|
||||
def __init__(self):
|
||||
@@ -342,6 +343,9 @@ class CadItem(DataModel):
|
||||
return None
|
||||
def get_all_gui_data(self):
|
||||
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):
|
||||
""""baut die Texte aus der csv Datei nach dem Einladen um"""
|
||||
@@ -856,23 +860,28 @@ class CadItem(DataModel):
|
||||
return False
|
||||
else:
|
||||
path = all_logs[0]
|
||||
content = ''
|
||||
try:
|
||||
with open(path, 'r', encoding='utf-16le') as f:
|
||||
content = f.read()
|
||||
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:
|
||||
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):
|
||||
@@ -1233,7 +1242,6 @@ class CadItem(DataModel):
|
||||
return data
|
||||
|
||||
|
||||
|
||||
class CadItemRepository:
|
||||
"""
|
||||
container class for all CadItems in the local folder
|
||||
@@ -1266,7 +1274,6 @@ class CadItemRepository:
|
||||
raise Exception("CadItem not found")
|
||||
|
||||
|
||||
|
||||
class GuiLogic():
|
||||
"""
|
||||
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',
|
||||
"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',
|
||||
"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'
|
||||
}
|
||||
|
||||
@@ -254,6 +254,8 @@ class Controller(Observer):
|
||||
text = text.format(Labels=values['Labels'])
|
||||
if 'Zeichentyp' in values:
|
||||
text = text.format(Zeichentyp=values['Zeichentyp'], Feldname=values['Feldname'] )
|
||||
if 'path' in values:
|
||||
text = text.format(path=values['path'])
|
||||
return messagebox.showerror(title, text)
|
||||
|
||||
def callback(self, key, value):
|
||||
|
||||
Reference in New Issue
Block a user