def _readSettings(self): settings = QtCore.QSettings(Path.getTempPath().join('ui_settings', apiUtils.getClassName(self) + '.ini'), QtCore.QSettings.IniFormat) settings.beginGroup(apiUtils.getClassName(self)) self.readSettings(settings) settings.endGroup()
def _readSettings(self): settings = QtCore.QSettings( Path.getTempPath().join('ui_settings', apiUtils.getClassName(self) + '.ini'), QtCore.QSettings.IniFormat) settings.beginGroup(apiUtils.getClassName(self)) self.readSettings(settings) settings.endGroup()
def __init__(self, parent=None, overrideStdOut=False, overrideStdErr=False): super(LoggingWidget, self).__init__(parent) # set standard properties self.setReadOnly(True) self.setLineWrapMode(LoggingWidget.NoWrap) # setup the sys.stdout iterceptor handler = LoggingWidgetHandler(self) logger = logging.getLogger(apiUtils.getClassName(self)) logger.setLevel(logging.DEBUG) logger.addHandler(handler) if overrideStdOut : loggerStdOut = SysStreamLogger(logger, logging.INFO) sys.stdout = loggerStdOut apiUtils.synthesize(self, 'loggerStdOut', loggerStdOut) if overrideStdErr : loggerStdErr = SysStreamLogger(logger, logging.ERROR) sys.stderr = loggerStdErr apiUtils.synthesize(self, 'loggerStdErr', loggerStdErr) # define custom properties apiUtils.synthesize(self, 'logger', logger) apiUtils.synthesize(self, 'clearOnClose', True) apiUtils.synthesize(self, 'handler', handler) apiUtils.synthesize(self, 'currentMode', 'standard') apiUtils.synthesize(self, 'blankCache', '') apiUtils.synthesize(self, 'mutex', QtCore.QMutex()) # determine whether or not to use the light or dark configuration palette = self.palette() base = palette.color(palette.Base) avg = (base.red() + base.green() + base.blue()) / 3.0 if ( avg < 160 ): colorSet = LoggingColorSet.darkScheme() else: colorSet = LoggingColorSet.lightScheme() apiUtils.synthesize(self, 'colorSet', colorSet) palette.setColor(palette.Text, colorSet.color('Standard')) palette.setColor(palette.Base, colorSet.color('Background')) self.setPalette(palette) # setup the levels self._loggingEnabled = { 'debug': True, 'info': True, 'warning': True, 'error': True, 'critical': True, 'fatal': True, } # create connections self.pythonMessageLogged.connect(self.log)