예제 #1
0
파일: logger.py 프로젝트: utajum/backintime
def debug(msg, parent=None, traceDepth=0):
    if DEBUG:
        msg = '%s %s' % (_debugHeader(parent, traceDepth), msg)
        print('%sDEBUG%s: %s' % (bcolors.OKBLUE, bcolors.ENDC, msg),
              file=sys.stdout)
        for line in tools.wrap_line(msg):
            syslog.syslog(syslog.LOG_DEBUG, 'DEBUG: %s' % line)
예제 #2
0
    def update_info( self ):
        if not tools.is_process_alive( self.ppid ):
            self.prepare_exit()
            self.qapp.exit(0)
            return

        message = self.snapshots.get_take_snapshot_message()
        if message is None and self.last_message is None:
            message = ( 0, _('Working...') )

        if not message is None:
            if message != self.last_message:
                self.last_message = message
                self.menuStatusMessage.setText('\n'.join(tools.wrap_line(self.last_message[1],\
                                                                         size = 80,\
                                                                         delimiters = '',\
                                                                         new_line_indicator = '') \
                                                                        ))
                self.status_icon.setToolTip( self.last_message[1] )

        pg = progress.ProgressFile(self.config)
        if pg.isFileReadable():
            pg.load()
            percent = pg.get_int_value('percent')
            if percent != self.progressBar.value():
                self.progressBar.setValue(percent)
                self.progressBar.render(self.pixmap, sourceRegion = QRegion(0, -14, 24, 6), flags = QWidget.RenderFlags(QWidget.DrawChildren))
                self.status_icon.setIcon(QIcon(self.pixmap))

            self.menuProgress.setText(' | '.join(self.getMenuProgress(pg)) )
            self.menuProgress.setVisible(True)
        else:
            self.status_icon.setIcon(self.icon.BIT_LOGO)
            self.menuProgress.setVisible(False)
예제 #3
0
파일: logger.py 프로젝트: utajum/backintime
def warning(msg, parent=None, traceDepth=0):
    if DEBUG:
        msg = '%s %s' % (_debugHeader(parent, traceDepth), msg)
    print('%sWARNING%s: %s' % (bcolors.WARNING, bcolors.ENDC, msg),
          file=sys.stderr)
    for line in tools.wrap_line(msg):
        syslog.syslog(syslog.LOG_WARNING, 'WARNING: ' + line)
예제 #4
0
파일: logger.py 프로젝트: utajum/backintime
def info(msg, parent=None, traceDepth=0):
    if DEBUG:
        msg = '%s %s' % (_debugHeader(parent, traceDepth), msg)
    print('%sINFO%s: %s' % (bcolors.OKGREEN, bcolors.ENDC, msg),
          file=sys.stdout)
    for line in tools.wrap_line(msg):
        syslog.syslog(syslog.LOG_INFO, 'INFO: ' + line)
예제 #5
0
    def update_info(self):
        if not tools.is_process_alive(self.ppid):
            self.prepare_exit()
            self.qapp.exit(0)
            return

        message = self.snapshots.get_take_snapshot_message()
        if message is None and self.last_message is None:
            message = (0, _('Working...'))

        if not message is None:
            if message != self.last_message:
                self.last_message = message
                self.menuStatusMessage.setText('\n'.join(tools.wrap_line(self.last_message[1],\
                                                                         size = 80,\
                                                                         delimiters = '',\
                                                                         new_line_indicator = '') \
                                                                        ))
                self.status_icon.setToolTip(self.last_message[1])

        pg = progress.ProgressFile(self.config)
        if pg.isFileReadable():
            pg.load()
            percent = pg.get_int_value('percent')
            if percent != self.progressBar.value():
                self.progressBar.setValue(percent)
                self.progressBar.render(self.pixmap,
                                        sourceRegion=QRegion(0, -14, 24, 6),
                                        flags=QWidget.RenderFlags(
                                            QWidget.DrawChildren))
                self.status_icon.setIcon(QIcon(self.pixmap))

            self.menuProgress.setText(' | '.join(self.getMenuProgress(pg)))
            self.menuProgress.setVisible(True)
        else:
            self.status_icon.setIcon(self.icon.BIT_LOGO)
            self.menuProgress.setVisible(False)
예제 #6
0
파일: logger.py 프로젝트: utajum/backintime
def error(msg, parent=None, traceDepth=0):
    if DEBUG:
        msg = '%s %s' % (_debugHeader(parent, traceDepth), msg)
    print('%sERROR%s: %s' % (bcolors.FAIL, bcolors.ENDC, msg), file=sys.stderr)
    for line in tools.wrap_line(msg):
        syslog.syslog(syslog.LOG_ERR, 'ERROR: ' + line)
예제 #7
0
def debug(msg, parent = None, traceDepth = 0):
    if DEBUG:
        msg = '%s %s' %(_debugHeader(parent, traceDepth), msg)
        print('%sDEBUG%s: %s' %(bcolors.OKBLUE, bcolors.ENDC, msg), file = sys.stdout)
        for line in tools.wrap_line(msg):
            syslog.syslog(syslog.LOG_DEBUG, 'DEBUG: %s' %line)
예제 #8
0
def info(msg , parent = None, traceDepth = 0):
    if DEBUG:
        msg = '%s %s' %(_debugHeader(parent, traceDepth), msg)
    print('%sINFO%s: %s' %(bcolors.OKGREEN, bcolors.ENDC, msg), file=sys.stdout)
    for line in tools.wrap_line(msg):
        syslog.syslog( syslog.LOG_INFO, 'INFO: ' + line )
예제 #9
0
def warning(msg , parent = None, traceDepth = 0):
    if DEBUG:
        msg = '%s %s' %(_debugHeader(parent, traceDepth), msg)
    print('%sWARNING%s: %s' %(bcolors.WARNING, bcolors.ENDC, msg), file=sys.stderr)
    for line in tools.wrap_line(msg):
        syslog.syslog( syslog.LOG_WARNING, 'WARNING: ' + line )
예제 #10
0
def error(msg , parent = None, traceDepth = 0):
    if DEBUG:
        msg = '%s %s' %(_debugHeader(parent, traceDepth), msg)
    print('%sERROR%s: %s' %(bcolors.FAIL, bcolors.ENDC, msg), file=sys.stderr)
    for line in tools.wrap_line(msg):
        syslog.syslog( syslog.LOG_ERR, 'ERROR: ' + line )