Исправлен вывод Qt элеменов

legacy27 3.6.0.2
Mike Hiretsky 6 years ago
parent 9a67f0410b
commit 4bfbcd718c

@ -21,17 +21,18 @@ from os import environ
from multiprocessing import Process, Queue
try:
from PySide import QtCore, QtGui, QtNetwork
from PySide.QtGui import QProgressBar
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtWidgets
class ControlledProgressDialog(QtGui.QProgressDialog):
class ControlledProgressDialog(QtWidgets.QProgressDialog):
"""
QProgressDialog controlled by pipe
"""
def __init__(self, inQueue, outQueue, *args, **kwargs):
QtGui.QProgressDialog.__init__(self, *args, **kwargs)
self.progress = QProgressBar(self)
QtWidgets.QProgressDialog.__init__(self, *args, **kwargs)
self.progress = QtWidgets.QProgressBar(self)
self.progress.setFormat("%p%")
self.setBar(self.progress)
self.inQueue = inQueue
@ -47,12 +48,12 @@ try:
self.progress.setTextVisible(visible)
def center(self):
screen = QtGui.QDesktopWidget().screenGeometry()
screen = QtWidgets.QDesktopWidget().screenGeometry()
size = self.geometry()
self.move((screen.width() - size.width()) / 2,
(screen.height() - size.height()) / 2)
@QtCore.Slot()
@QtCore.pyqtSlot()
def dispatcher(self):
"""
Dispatcher called by 50ms
@ -79,11 +80,12 @@ try:
def runProgress(self, message, typemes="warning"):
signal.signal(signal.SIGINT, sigint_handler)
QtGui.QApplication(sys.argv)
getattr(QtGui.QMessageBox, typemes)(
app = QtWidgets.QApplication(sys.argv)
getattr(QtWidgets.QMessageBox, typemes)(
None, "", message,
QtGui.QMessageBox.StandardButton.Close,
QtGui.QMessageBox.StandardButton.Close)
QtWidgets.QMessageBox.Close,
QtWidgets.QMessageBox.Close)
app.quit()
def critical(self, message):
self.proc = Process(target=self.runProgress,
@ -106,9 +108,10 @@ try:
def runProgress(self, inQueue, outQueue):
signal.signal(signal.SIGINT, sigint_handler)
environ['HOME'] = self.homeDir
QtGui.QApplication(sys.argv)
app = QtWidgets.QApplication(sys.argv)
progressDialog = ControlledProgressDialog(inQueue, outQueue)
progressDialog.exec_()
app.quit()
setMaximum = None
setTextVisible = None

Loading…
Cancel
Save