5 LOG_LEVEL = 1 # 0 means all, 1 means all but DEBUG, 2 means all but INFO and DEBUG, 3 only FATAL
10 Prints an information message to the standard output.
12 :param msg: str -- The message to be printed.
15 if cls.LOG_LEVEL <= 0:
16 cls.__log("[DEBUG]", msg)
22 Prints an information message to the standard output.
24 :param msg: str -- The message to be printed.
27 if cls.LOG_LEVEL <= 1:
28 cls.__log("[INFO]", msg)
32 def Warning(cls, msg):
34 Prints a warning message to the standard output.
36 :param msg: str -- The message to be printed.
39 if cls.LOG_LEVEL <= 2:
40 cls.__log("[WARNING]", msg)
44 def FatalError(cls, msg):
46 Prints an error message to the standard output.
48 :param msg: str -- The message to be printed.
52 if cls.LOG_LEVEL <= 3:
53 cls.__log("[FATAL]", msg)
57 def __log(cls, typ, msg):
58 print("%s: %s" % (typ, msg))
60 def trQ(tag, context="CURVEPLOT"):
61 """ @return a QString read from the translation file """
62 from pyqtside.QtGui import QApplication
63 return QApplication.translate(context, tag)
65 def trU(tag, context="CURVEPLOT"):
66 """ @return same as above, but returns a Python unicode string. """
67 qs = trQ(tag, context)
68 return unicode(qs, 'utf-8')
70 def toUnicodeWithWarning(s, method_name):
74 Logger.Warning("%s - warning, passing non-unicode, non-ASCII string '%s'! Trying to convert myself to UTF-8 ..." % (method_name, s))
75 s = unicode(s, 'utf-8')
78 def completeResPath(fileName):
80 subPath = "@SALOME_CURVEPLOT_INSTALL_PYTHON@"
81 rd = os.environ.get("CURVEPLOT_ROOT_DIR", None)
83 raise Exception("CURVEPLOT_ROOT_DIR is not defined!")
84 filePath = os.path.join(rd, subPath, fileName)