コード例 #1
0
ファイル: syncwin.py プロジェクト: pasterzppp/subsync
    def updateStatus(self, status, finished=False):
        elapsed = self.runTime.Time() / 1000
        self.m_textElapsedTime.SetLabel(utils.timeStampFmt(elapsed))

        if status:
            self.m_textSync.SetLabel(
                _('Synchronization: {} points').format(status.points))
            self.m_textCorrelation.SetLabel('{:.2f} %'.format(100 *
                                                              status.factor))
            self.m_textFormula.SetLabel(str(status.formula))
            self.m_textMaxChange.SetLabel(
                utils.timeStampFractionFmt(status.maxChange))
            if finished:
                self.m_gaugeProgress.SetValue(100)
            else:
                self.m_gaugeProgress.SetValue(100 * status.progress)

            if status.subReady and not self.m_bitmapTick.IsShown():
                self.m_bitmapCross.Hide()
                self.m_bitmapTick.Show()
                self.m_buttonSave.Enable()
                if status.running:
                    self.m_textInitialSyncInfo.Show()
                self.Fit()
                self.Layout()

        self.updateStatusErrors()
コード例 #2
0
    def onUpdateTimerTick(self, event):
        if self.isRunning:
            stats = self.sync.getStats()
            elapsed = time.time() - self.startTime
            maxChange = self.sync.getMaxChange()

            self.m_textSync.SetLabel(_('Synchronization: {} points').format(stats.points))
            self.m_textElapsedTime.SetLabel(utils.timeStampFmt(elapsed))
            self.m_textCorrelation.SetLabel('{:.2f} %'.format(100.0 * stats.factor))
            self.m_textFormula.SetLabel(str(stats.formula))
            self.m_textMaxChange.SetLabel(utils.timeStampFractionFmt(maxChange))

            if not self.isCorrelated and stats.correlated:
                self.isCorrelated = stats.correlated
                self.m_bitmapCross.Hide()
                self.m_bitmapTick.Show()

                if self.isSubReady:
                    self.onSubReady()

                self.Layout()

                if self.listener:
                    self.listener.onSynchronized(self, stats)

            if self.sync.isRunning():
                self.setProgress(self.sync.getProgress())
            else:
                self.stop(finished=True)
                self.setProgress(1.0)
                if self.listener:
                    self.listener.onSynchronizationDone(self, stats)
コード例 #3
0
    def updateTimer(self, progress=None):
        elapsed = self.runTime.Time() / 1000
        msg = '{}: {}'.format(_('Elapsed'), utils.timeStampFmt(elapsed))

        if elapsed > 60 and progress:
            eta = elapsed / progress - elapsed
            msg += ', {}: {}'.format(_('ETA'), utils.timeStampApproxFmt(eta))
        self.m_textEta.SetLabel(msg)
コード例 #4
0
ファイル: batchwin.py プロジェクト: Maxsteffens/subsync
    def updateProgressText(self, no, progress):
        total = self.m_items.GetItemCount()
        elapsed = self.synchro.runTime.Time() / 1000

        msg = [_('Task:'), '{} / {}'.format(no + 1, total)]
        if elapsed > 1:
            msg += [_('Elapsed:'), utils.timeStampFmt(elapsed)]
        if elapsed > 60 and progress:
            totalProgress = (no + progress) / total
            eta = elapsed / totalProgress - elapsed
            msg += [_('ETA:'), utils.timeStampApproxFmt(eta)]

        self.m_textStatusVal.SetLabel(' '.join(msg))
コード例 #5
0
    def printStats(self, status, finished=False):
        if pr.verbosity >= 1:
            if finished:
                progress = 1.0
            else:
                progress = status.progress
                effort = settings().minEffort
                if effort:
                    progress = min(max(progress, status.effort / effort, 0), 1)

            msg = '[+] {}: progress {:3.0f}%, {} points'.format(
                utils.timeStampFmt(time.monotonic() - self.startTime),
                100 * progress, status.points)
            if pr.verbosity >= 2:
                msg += ', correlation={:.2f}, formula={}, maxChange={}'.format(
                    100 * status.factor, str(status.formula),
                    utils.timeStampFractionFmt(status.maxChange))

            if pr.verbosity >= 3:
                pr.println(1, msg)
            else:
                pr.reprint(1, msg)
コード例 #6
0
ファイル: syncwin.py プロジェクト: back8/github_sc0ty_subsync
    def onJobUpdate(self, task, status, finished=False):
        elapsed = time.monotonic() - self.startTime
        self.m_textElapsedTime.SetLabel(utils.timeStampFmt(elapsed))

        self.m_textSync.SetLabel(_('Synchronization: {} points').format(status.points))
        self.m_textCorrelation.SetLabel('{:.2f} %'.format(100 * status.factor))
        self.m_textFormula.SetLabel(str(status.formula))
        self.m_textMaxChange.SetLabel(utils.timeStampFractionFmt(status.maxChange))
        if finished:
            self.m_gaugeProgress.SetValue(100)
        else:
            self.m_gaugeProgress.SetValue(100 * status.progress)

        if status.correlated and not self.m_bitmapTick.IsShown():
            self.m_bitmapCross.Hide()
            self.m_bitmapTick.Show()
            self.m_buttonSave.Enable()
            if self.sync.isRunning():
                self.m_textInitialSyncInfo.Show()
            self.Fit()
            self.Layout()

        self.updateStatusErrors()