def new_file(self): dialog=Dialog(self) result=dialog.exec_() if result==1: self.reset() if(str(dialog.name_home.text())==''): text_home='HOME' else: text_home=dialog.name_home.text() if(str(dialog.name_away.text())==''): text_away='AWAY' else: text_away=dialog.name_away.text() if dialog.b1.isChecked(): self.point_change_ball=1 elif dialog.b2.isChecked(): self.point_change_ball=2 elif dialog.b3.isChecked(): self.point_change_ball=3 elif dialog.b4.isChecked(): self.point_change_ball=4 elif dialog.b5.isChecked(): self.point_change_ball=5 if dialog.dialog_position.isChecked(): n= np.random.randint(2) #0 or 1 if n==0: text_home_towrite=text_away text_away_towrite=text_home else: text_home_towrite=text_home text_away_towrite=text_away else: text_home_towrite=text_home text_away_towrite=text_away if dialog.dialog_ball.isChecked(): n= np.random.randint(2) if n==0: self.start_home() else: self.start_away() self.textEdit.setHtml(design._translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'.SF NS Text\'; font-size:65pt; font-weight:400; font-style:normal;\">\n" "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:65pt;\">%s</span></p></body></html>"%text_home_towrite, None)) self.textEdit_2.setHtml(design._translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'.SF NS Text\'; font-size:65pt; font-weight:400; font-style:normal;\">\n" "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:65pt;\">%s</span></p></body></html>"%text_away_towrite, None))
def start_away(self): self.ball_home.setText(design._translate("MainWindow", "FIRST BALL - LOSE!!! :(", None)) self.ball_away.setText(design._translate("MainWindow", "FIRST BALL - WIN!!! :)", None)) self.enable_ini(True) self.enable_ball(False) #away ha la palla self.score_away.setPalette(self.palette_ball) #away no self.score_home.setPalette(self.palette_noball) self.check_ball=0
def reset(self): self.ball_home.setText(design._translate("MainWindow", "FIRST BALL", None)) self.ball_away.setText(design._translate("MainWindow", "FIRST BALL", None)) self.score_home.setPalette(self.palette_noball) self.score_home.setPalette(self.palette_noball) self.reset_score_home() self.reset_score_away() self.enable_ball(True) self.enable_ini(False) self.counter=0 self.check_ball=0