from modules import progressbar
Progressbarprogressbar.ProgressBar("TITULO AQUI")
from PyQt4 import QtCore
from PyQt4 import QtGui
import time
import sys
import qdarkstyle
class MyCustomWidgetProgressBar(QtGui.QWidget):
def __init__(self,title):
super(MyCustomWidgetProgressBar, self).__init__()
layout = QtGui.QGridLayout(self)
self.title = title
label = QtGui.QLabel()
label.setText(self.title)
label.setAlignment(QtCore.Qt.AlignCenter)
layout.addWidget(label)
# Create a progress bar and a button and add them to the main layout
self.progressBar = QtGui.QProgressBar(self)
self.progressBar.setRange(0,1)
layout.addWidget(self.progressBar)
self.myLongTask = TaskThread()
self.myLongTask.taskFinished.connect(self.onFinished)
self.onStart()
def onStart(self):
self.progressBar.setRange(0,0)
self.myLongTask.start()
def onFinished(self):
# Stop the pulsation
self.progressBar.setRange(0,1)
class TaskThread(QtCore.QThread):
taskFinished = QtCore.pyqtSignal()
def run(self):
time.sleep(30)
self.taskFinished.emit()
# -*- coding: utf-8 -*-
import sys, time
from PyQt4.QtGui import QMessageBox, QMainWindow, QApplication
from PyQt4.uic import loadUi
import qdarkstyle
from .modules import tricks
from .modules import progressbar
class PyAuto(QMainWindow):
def __init__(self):
super(PyAuto, self).__init__()
# instances
self.ui = loadUi('Pyauto/views/menu.ui', self)
self.ui.test.clicked.connect(self.test_progressbar)
self.ui.show()
def test_progressbar(self):
window = progressbar.MyCustomWidgetProgressBar("Test")
window.show()
app.exec_()
if __name__ == '__main__':
app = QApplication(sys.argv)
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False)) # set stylesheet dark
myWindow = PyAuto()
app.exec_()