Model, View: Some switch to logging.

results
Pierre-Antoine Rouby 2023-07-05 16:49:26 +02:00
parent bc78542d2c
commit e925a95987
5 changed files with 20 additions and 7 deletions

View File

@ -1,10 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import logging
from tools import timer from tools import timer
from Model.Geometry.Point import Point from Model.Geometry.Point import Point
from Model.Except import NotImplementedMethodeError from Model.Except import NotImplementedMethodeError
logger = logging.getLogger()
class Profile(object): class Profile(object):
_id_cnt = 0 _id_cnt = 0
@ -241,7 +245,7 @@ class Profile(object):
@timer @timer
def sort_with_indexes(self, indexes: list): def sort_with_indexes(self, indexes: list):
if len(self._points) != len(indexes): if len(self._points) != len(indexes):
print("TODO: CRITICAL ERROR!") logger.critical("Indexes list do not correspond to point list")
self._points = list( self._points = list(
map( map(

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import logging
import numpy as np import numpy as np
from time import time from time import time
@ -17,6 +18,8 @@ from Model.Geometry.ProfileXYZ import ProfileXYZ
from Model.Except import FileFormatError, exception_message_box from Model.Except import FileFormatError, exception_message_box
logger = logging.getLogger()
class Reach(SQLSubModel): class Reach(SQLSubModel):
_sub_classes = [ _sub_classes = [
ProfileXYZ, ProfileXYZ,
@ -377,7 +380,7 @@ class Reach(SQLSubModel):
@timer @timer
def sort_with_indexes(self, indexes: list): def sort_with_indexes(self, indexes: list):
if len(self._profiles) != len(indexes): if len(self._profiles) != len(indexes):
print("TODO: CRITICAL ERROR!") logger.critical("Indexes list do not correspond to profile list")
self._profiles = list( self._profiles = list(
map( map(
@ -424,10 +427,10 @@ class Reach(SQLSubModel):
self._status.modified() self._status.modified()
except FileNotFoundError as e: except FileNotFoundError as e:
print(e) logger.error(e)
exception_message_box(e) exception_message_box(e)
except FileFormatError as e: except FileFormatError as e:
print(e) logger.error(e)
e.alert() e.alert()
@timer @timer

View File

@ -2,6 +2,7 @@
import os import os
import csv import csv
import logging
from io import StringIO from io import StringIO
from datetime import datetime from datetime import datetime
@ -26,6 +27,8 @@ from PyQt5.uic import loadUi
from Model.Except import ClipboardFormatError from Model.Except import ClipboardFormatError
logger = logging.getLogger()
class WindowToolKit(object): class WindowToolKit(object):
def __init__(self, parent=None): def __init__(self, parent=None):
super(WindowToolKit, self).__init__() super(WindowToolKit, self).__init__()
@ -140,7 +143,7 @@ class ASubWindowFeatures(object):
try: try:
self.find(QLineEdit, name).setText(text) self.find(QLineEdit, name).setText(text)
except AttributeError as e: except AttributeError as e:
print(e) logger.error(e)
def get_line_edit_text(self, name:str): def get_line_edit_text(self, name:str):
"""Get text of line edit component """Get text of line edit component

View File

@ -169,7 +169,6 @@ class CheckListWindow(ASubMainWindow, ListedSubWindow):
self.close() self.close()
def reject(self): def reject(self):
print("cancel")
self.end() self.end()
def accept(self): def accept(self):

View File

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import logging
from tools import trace, timer from tools import trace, timer
from View.ASubWindow import ASubMainWindow from View.ASubWindow import ASubMainWindow
@ -23,6 +25,8 @@ from PyQt5.QtWidgets import (
QProgressBar, QLabel, QTextEdit, QProgressBar, QLabel, QTextEdit,
) )
logger = logging.getLogger()
_translate = QCoreApplication.translate _translate = QCoreApplication.translate
class ReplWindow(ASubMainWindow, ListedSubWindow): class ReplWindow(ASubMainWindow, ListedSubWindow):
@ -71,7 +75,7 @@ class ReplWindow(ASubMainWindow, ListedSubWindow):
self._history_ind = 0 self._history_ind = 0
rich_code = "self.__debug_exec_result__ = " + code rich_code = "self.__debug_exec_result__ = " + code
print(f"[DEBUG] ! {code}") logger.debug(f"{code}")
try: try:
value = exec(rich_code) value = exec(rich_code)
value = self.__debug_exec_result__ value = self.__debug_exec_result__