def __init__(self): """Inicializador de la clase Estadistica.""" QtGui.QMainWindow.__init__(self) self.ui=Ui_Estadistica() self.ui.setupUi(self) """Coneccion de senales.""" self.ui.pushButton_7.clicked.connect(self.onBtnInicioClicked) self.lienzo=QtGui.QGraphicsScene() self.ui.graphicsView.setScene(self.lienzo) hs = HighScore.loadFromFile() if len(hs) >= 5: self.graficar(hs)
def endGame(self): self.stopTimer() userName = str(self.ui.btnJugador.text()) seconds = int(self.s) + int(self.m) * 60 + int(self.h) * 60 * 60 difficulty = ['Easy', 'Medium', 'Hard'][self.difficulty - 1] # Check if current score is a high scores highscores = HighScore.loadFromFile() highscores.reverse() if seconds < highscores[0].seconds: msj = QMessageBox() msj.setText( "Puntaje alto" ) msj.exec_() # Put score in highscore highscores.append( HighScore(userName, seconds, difficulty) ) highscores.sort() highscores.pop() HighScore.saveToFile(highscores)