Beispiel #1
0
    def populateGamesGroupBox(self):

        self.gameGroupBoxLayout = QtGui.QVBoxLayout(self.gameGroupBox)
        self.gameComboBox = QtGui.QComboBox(self.gameGroupBox)
        self.gameGroupBoxLayout.addWidget(self.gameComboBox)
        self.gameDescriptionLabel = QtGui.QLabel(self.gameGroupBox)
        self.resumeGroup = ResumeBox(self.parent)
#        self.gameRulesBrowser = QtGui.QTextBrowser(self.gameGroupBox)
        self.gameGroupBoxLayout.addWidget(self.gameDescriptionLabel)
        self.gameGroupBoxLayout.addWidget(self.resumeGroup)
#        self.gameGroupBoxLayout.addWidget(self.gameRulesBrowser)

#        self.gameGroupBoxLayout.addStretch()

        self.games = db.getAvailableGames()
        for game in sorted(self.games.keys()):
            self.gameComboBox.addItem(game)
        lastgame = db.getLastGame()
        if lastgame:    
            self.gameComboBox.setCurrentIndex(self.gameComboBox.findText(lastgame))
            
        self.gameStatsBox = QSBoxFactory.createQSBox(self.gameComboBox.currentText(),self)
        self.gameGroupBoxLayout.addWidget(self.gameStatsBox)            
            
        self.updateGameInfo()
        
        self.gameComboBox.currentIndexChanged.connect(self.updateGameInfo)
Beispiel #2
0
    def updateGameInfo(self,foo=0):
        game = str(self.gameComboBox.currentText())
        description = "2 - {} {}\n\n{}".format(self.games[game]['maxPlayers'],QtGui.QApplication.translate("NewGameWidget",'players'),self.games[game]['description'])
        self.gameDescriptionLabel.setText(description)
#        self.gameRulesBrowser.setText("{}".format(self.games[game]['rules']))
#         self.gameStatsBox.update(game)
        self.gameGroupBoxLayout.removeWidget(self.gameStatsBox)
        self.gameStatsBox.deleteLater()
        
        self.gameStatsBox = QSBoxFactory.createQSBox(game,self)
        self.gameGroupBoxLayout.addWidget(self.gameStatsBox)  
        self.gameStatsBox.update(game)
        self.resumeGroup.changeGame(game)