コード例 #1
0
 def resumeGame(self):
     selected = self.savedlist.selectedIndexes()
     if len(selected)>0:
         idMatch = self.matches[selected[0].row()]
         gameengine = self.engine.resume(idMatch)
         matchTab = GameWidgetFactory.resumeGameWidget(self.game,gameengine,self.parent)
         if matchTab:
             matchTab.closeRequested.connect(self.parent.removeTab)
             self.parent.newTab(matchTab,self.game)
コード例 #2
0
ファイル: newgame.py プロジェクト: trawl/gamelog
 def restartGame(self, gamewidget):
     players = gamewidget.players
     game = gamewidget.game
     self.parent.removeTab(gamewidget)
     matchTab = GameWidgetFactory.createGameWidget(
         game, players, self.parent)
     if matchTab:
         matchTab.closeRequested.connect(self.parent.removeTab)
         matchTab.restartRequested.connect(self.restartGame)
         self.parent.newTab(matchTab, game)
     else:
         QMessageBox.warning(self, tit,
                             i18n("NewGameWidget",
                                  "Widget not implemented"))
         return
コード例 #3
0
 def createNewGame(self):
     game = str(self.gameComboBox.currentText())
     maxPlayers = self.games[game]['maxPlayers']
     players = self.playersInGameList.model().retrievePlayers()
     if len(players)<2:
         QtGui.QMessageBox.warning(self,QtGui.QApplication.translate("NewGameWidget","New Match"),QtGui.QApplication.translate("NewGameWidget","At least 2 players are needed to play"))
     elif len(players)>maxPlayers:
         QtGui.QMessageBox.warning(self,QtGui.QApplication.translate("NewGameWidget","New Match"),"{} {}".format(QtGui.QApplication.translate("NewGameWidget",'The maximum number of players is'), maxPlayers))
     else:
         matchTab = GameWidgetFactory.createGameWidget(game,players,self.parent)
         if matchTab:
             matchTab.closeRequested.connect(self.parent.removeTab)
             self.parent.newTab(matchTab,game)
         else:
             QtGui.QMessageBox.warning(self,QtGui.QApplication.translate("NewGameWidget","New Match"),QtGui.QApplication.translate("NewGameWidget","Widget not implemented"))
             return
コード例 #4
0
ファイル: newgame.py プロジェクト: trawl/gamelog
 def createNewGame(self):
     game = str(self.gameComboBox.currentText())
     maxPlayers = self.games[game]['maxPlayers']
     players = self.playersInGameList.model().retrievePlayers()
     tit = i18n("NewGameWidget", "New Match")
     if len(players) < 2:
         msg = i18n(
             "NewGameWidget", "At least 2 players are needed to play")
         QMessageBox.warning(self, tit, msg)
     elif len(players) > maxPlayers:
         msg = i18n("NewGameWidget", 'The maximum number of players is')
         QMessageBox.warning(self, tit, "{} {}".format(msg, maxPlayers))
     else:
         matchTab = GameWidgetFactory.createGameWidget(
             game, players, self.parent)
         if matchTab:
             matchTab.closeRequested.connect(self.parent.removeTab)
             matchTab.restartRequested.connect(self.restartGame)
             self.parent.newTab(matchTab, game)
         else:
             QMessageBox.warning(self, tit,
                                 i18n("NewGameWidget",
                                      "Widget not implemented"))
             return