def showScreen(self): screen_name, screen_class = self._dictButtons[self.sender()] state = TSO_State() setattr(self, screen_name, screen_class(self.state)) _screen = getattr(self, screen_name, None) _screen.show() self.close()
self.pushButton_8.setText(_translate("MainWindow", "MEGAFON")) self.label_4.setText(_translate("MainWindow", "TextLabel")) self.pushButton_9.setText(_translate("MainWindow", "EWALLET")) self.pushButton.setText(_translate("MainWindow", "PushButton1")) def showScreen(self): otherType = 'EWALLET' #otherType = 'MTS' sender = self.sender() if sender == self.pushButton: screen_name, screen_class = self._dictButtons[sender] else: if sender.text() == 'EWALLET': screen_name, screen_class = self._dictButtons['other'][1] else: screen_name, screen_class = self._dictButtons['other'][0] setattr(self, screen_name, screen_class(self.state)) _screen = getattr(self, screen_name, None) _screen.show() self.close() if __name__ == '__main__': import sys app = QtWidgets.QApplication(sys.argv) state = TSO_State(currencydetector=False) ui = OrderOtherScreen(state) ui.show() sys.exit(app.exec_())
self.label_5.setText(_translate("MainWindow", "TextLabel")) self.label.setText(_translate("MainWindow", "TextLabel")) self.pushButton.setText(_translate("MainWindow", "Заправка")) self.pushButton_2.setText(_translate("MainWindow", "Печать чека\nПеревод сдачи")) self.pushButton_3.setText(_translate("MainWindow", "Другие услуги")) self.pushButton_4.setText(_translate("MainWindow", "Информация")) self.label_4.setText(_translate("MainWindow", "TextLabel")) self.label_3.setText(_translate("MainWindow", "TextLabel")) self.label_2.setText(_translate("MainWindow", "TextLabel")) def showScreen(self): sender = self.sender() screen_name, screen_class = self._dictButtons[self.sender()] if sender == self.pushButton: self.update_data() setattr(self, screen_name, screen_class(self.state, self.data)) else: setattr(self, screen_name, screen_class(self.state)) _screen = getattr(self, screen_name, None) _screen.show() self.close() if __name__ == '__main__': import sys app = QtWidgets.QApplication(sys.argv) state = TSO_State(pos=True) ui = MainScreen(state) ui.show() sys.exit(app.exec_())