def newMyWidget(parent=None): randomNumber = QtCore.QRandomGenerator.global_().bounded(0, 100) + 1 if (randomNumber < 50): if (randomNumber < 33): return MyWidget1(parent) else: return MyWidget3(parent) else: return MyWidget2(parent)
def __init__(self): super(NaplatnoMestoWindow, self).__init__() self.resize(800, 600) user = QApplication.instance().currentUser if user.role == "Radnik na naplatnom mestu": widget = MyWidget1() elif user.role == "Admin": widget = MyWidget2() elif user.role == "Radnik u centrali": widget = MyWidget3() elif user.role == "Sef stanice": widget = MyWidget4() self.setCentralWidget(widget)