Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from PySide6 import QtCore as qtc
- from PySide6 import QtWidgets as qtw
- from PySide6 import QtGui as qtg
- from SplashScreen.UI.splash_screen import Ui_SplashScreen
- COUNTER = 0
- class SplashScreen(qtw.QMainWindow, Ui_SplashScreen):
- load_success = qtc.Signal()
- def __init__(self):
- super().__init__()
- self.setupUi(self)
- self.setWindowFlag(qtc.Qt.FramelessWindowHint)
- self.setAttribute(qtc.Qt.WA_TranslucentBackground)
- pixmap = qtg.QPixmap("../Icons/app_logo.png")
- self.lb_LogoImage.setPixmap(pixmap)
- self.lb_LogoImage.setScaledContents(True)
- self.timer = qtc.QTimer()
- self.timer.timeout.connect(self.progress)
- self.timer.start(35)
- self.loading_text = [
- "Starting Application...",
- "Playing With Ducks...",
- "Who Knows? ..."
- ]
- self.index = 0
- self.message = self.loading_text[self.index]
- def progress(self):
- global COUNTER
- self.progressBar.setValue(COUNTER)
- self.lb_Percentage.setText(f"{self.message}")
- if COUNTER > 100:
- self.timer.stop()
- self.load_success.emit()
- COUNTER += 0.5
- self.index += 1
- if self.index == len(self.loading_text):
- self.index = 0
- # uncomment this for testing
- # if __name__ == "__main__":
- # app = qtw.QApplication(sys.argv)
- # window = SplashScreen()
- # window.show()
- # sys.exit(app.exec())
Advertisement
Add Comment
Please, Sign In to add comment