Exemple #1
0
    def initUI(self):
        super(RatukiWidget, self).initUI()

        self.gameInput = RatukiInputWidget(self.engine, self)
        self.gameInput.enterPressed.connect(self.commitRound)
        self.roundLayout.addWidget(self.gameInput)

        self.configLayout = QGridLayout()
        self.matchGroupLayout.addLayout(self.configLayout)
        self.topPointsLineEdit = QLineEdit(self.matchGroup)
        self.topPointsLineEdit.setText(str(self.engine.getTop()))
        self.topPointsLineEdit.setValidator(
            QtGui.QIntValidator(1, 10000, self.topPointsLineEdit))
        self.topPointsLineEdit.setFixedWidth(50)
        sp = QSizePolicy(
            QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.topPointsLineEdit.setSizePolicy(sp)
        self.topPointsLineEdit.textChanged.connect(self.changeTop)
        self.topPointsLineEdit.setDisabled(self.engine.getNumRound() > 1)
        self.configLayout.addWidget(self.topPointsLineEdit, 0, 0)

        self.topPointsLabel = QLabel(self.matchGroup)
        self.topPointsLabel.setStyleSheet("QLabel {font-weight: bold; }")
        self.configLayout.addWidget(self.topPointsLabel, 0, 1)

        self.detailGroup = RatukiRoundsDetail(self.engine, self)
        self.detailGroup.edited.connect(self.updatePanel)
        self.widgetLayout.addWidget(self.detailGroup, 1, 0)

        self.playerGroup = QGroupBox(self)
        self.widgetLayout.addWidget(self.playerGroup, 1, 1)

        self.playerGroup.setStyleSheet(
            "QGroupBox { font-size: 18px; font-weight: bold; }")
        self.playersLayout = QVBoxLayout(self.playerGroup)
        self.playersLayout.addStretch()
        self.playerGroupBox = {}
        for i, player in enumerate(self.players):
            pw = GamePlayerWidget(player, PlayerColours[i], self.playerGroup)
            pw.updateDisplay(self.engine.getScoreFromPlayer(player))
            if player == self.engine.getDealer():
                pw.setDealer()
            self.playersLayout.addWidget(pw)
            self.playerGroupBox[player] = pw

        self.playersLayout.addStretch()

        self.retranslateUI()
Exemple #2
0
    def initUI(self):
        super(PochaWidget, self).initUI()

        self.gameInput = PochaInputWidget(self.engine, self)
        self.gameInput.enterPressed.connect(self.commitRound)
        self.roundLayout.addWidget(self.gameInput)

        self.configLayout = QGridLayout()
        self.matchGroupLayout.addLayout(self.configLayout)
        self.suitTypeGroup = QButtonGroup(self)
        self.spanishSuitRadio = QRadioButton(self)
        self.spanishSuitRadio.setChecked(
            self.engine.getSuitType() == 'spanish')
        self.spanishSuitRadio.toggled.connect(self.changeSuit)
        self.suitTypeGroup.addButton(self.spanishSuitRadio)
        self.configLayout.addWidget(self.spanishSuitRadio)
        self.frenchSuitRadio = QRadioButton(self)
        self.suitTypeGroup.addButton(self.frenchSuitRadio)
        self.configLayout.addWidget(self.frenchSuitRadio)
        self.frenchSuitRadio.toggled.connect(self.changeSuit)
        self.frenchSuitRadio.setChecked(self.engine.getSuitType() == 'french')

        self.dealerPolicyCheckBox.hide()

        self.detailGroup = PochaRoundsDetail(self.engine, self)
        self.detailGroup.edited.connect(self.updatePanel)
        self.widgetLayout.addWidget(self.detailGroup, 1, 0)

        self.playerGroup = QGroupBox(self)
        self.widgetLayout.addWidget(self.playerGroup, 1, 1)

        self.playerGroup.setStyleSheet(
            "QGroupBox { font-size: 18px; font-weight: bold; }")
        self.playersLayout = QVBoxLayout(self.playerGroup)
        self.playersLayout.addStretch()
        self.playerGroupBox = {}
        for i, player in enumerate(self.players):
            pw = GamePlayerWidget(player, PlayerColours[i], self.playerGroup)
            pw.updateDisplay(self.engine.getScoreFromPlayer(player))
            if player == self.engine.getDealer():
                pw.setDealer()
            self.playersLayout.addWidget(pw)
            self.playerGroupBox[player] = pw

        self.playersLayout.addStretch()

        self.retranslateUI()
Exemple #3
0
    def initUI(self):
        super(CarcassonneWidget, self).initUI()

        self.finishButton = QPushButton(self.roundGroup)
        self.buttonGroupLayout.addWidget(self.finishButton)
        self.finishButton.clicked.connect(self.finish)

        self.gameInput = CarcassonneInputWidget(
            self.engine, self.bgcolors, self)
        self.gameInput.enterPressed.connect(self.commitRound)
        self.focussc = QShortcut(
            QtGui.QKeySequence("Ctrl+A"), self, self.gameInput.setFocus)
        self.roundLayout.addWidget(self.gameInput)

        self.gameInput.placeCommitButton(self.commitRoundButton)

        self.detailGroup = CarcassonneEntriesDetail(
            self.engine, self.bgcolors, self)
        self.widgetLayout.addWidget(self.detailGroup, 1, 0)
        self.detailGroup.edited.connect(self.updatePanel)

        self.playerGroup = QGroupBox(self)
        self.widgetLayout.addWidget(self.playerGroup, 1, 1)

        self.playerGroup.setStyleSheet(
            "QGroupBox { font-size: 18px; font-weight: bold; }")
        self.playersLayout = QVBoxLayout(self.playerGroup)
        self.playersLayout.addStretch()
        self.playerGroupBox = {}
        dealer = self.engine.getDealer()
        for i, player in enumerate(self.engine.getListPlayers()):
            pw = GamePlayerWidget(player, PlayerColours[i], self.playerGroup)

            if self.engine.getNumRound() == 1 and player == dealer:
                pw.setDealer()
            pw.updateDisplay(self.engine.getScoreFromPlayer(player))
            self.playersLayout.addWidget(pw)
            self.playerGroupBox[player] = pw

        self.playersLayout.addStretch()
        self.retranslateUI()
        QtCore.QTimer.singleShot(1000, self.gameInput.setFocus)