Converted hscommon.jobprogress.qt to Qt5

This commit is contained in:
Virgil Dupras 2014-10-12 10:52:21 -04:00
parent 91be1c7336
commit 7c3728ca47
1 changed files with 10 additions and 10 deletions

View File

@ -1,19 +1,19 @@
# Created By: Virgil Dupras # Created By: Virgil Dupras
# Created On: 2009-09-14 # Created On: 2009-09-14
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net) # Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
# #
# This software is licensed under the "BSD" License as described in the "LICENSE" file, # This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at # which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license # http://www.hardcoded.net/licenses/bsd_license
from PyQt4.QtCore import pyqtSignal, Qt, QTimer from PyQt5.QtCore import pyqtSignal, Qt, QTimer
from PyQt4.QtGui import QProgressDialog from PyQt5.QtWidgets import QProgressDialog
from . import job, performer from . import performer
class Progress(QProgressDialog, performer.ThreadedJobPerformer): class Progress(QProgressDialog, performer.ThreadedJobPerformer):
finished = pyqtSignal(['QString']) finished = pyqtSignal(['QString'])
def __init__(self, parent): def __init__(self, parent):
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
QProgressDialog.__init__(self, '', "Cancel", 0, 100, parent, flags) QProgressDialog.__init__(self, '', "Cancel", 0, 100, parent, flags)
@ -23,7 +23,7 @@ class Progress(QProgressDialog, performer.ThreadedJobPerformer):
self._timer = QTimer() self._timer = QTimer()
self._jobid = '' self._jobid = ''
self._timer.timeout.connect(self.updateProgress) self._timer.timeout.connect(self.updateProgress)
def updateProgress(self): def updateProgress(self):
# the values might change before setValue happens # the values might change before setValue happens
last_progress = self.last_progress last_progress = self.last_progress
@ -40,7 +40,7 @@ class Progress(QProgressDialog, performer.ThreadedJobPerformer):
if last_desc: if last_desc:
self.setLabelText(last_desc) self.setLabelText(last_desc)
self.setValue(last_progress) self.setValue(last_progress)
def run(self, jobid, title, target, args=()): def run(self, jobid, title, target, args=()):
self._jobid = jobid self._jobid = jobid
self.reset() self.reset()
@ -49,4 +49,4 @@ class Progress(QProgressDialog, performer.ThreadedJobPerformer):
self.setWindowTitle(title) self.setWindowTitle(title)
self.show() self.show()
self._timer.start(500) self._timer.start(500)