def createWidgets(self, window): self.widget = QWidget() layout = QVBoxLayout() self.widget.setLayout(layout) grid = QGridLayout() grid.addWidget(QLabel(tr("Label:")), 0, 0) self.label = QLineEdit(u"label") grid.addWidget(self.label, 0, 1) grid.addWidget(QLabel(tr("Type:")), 1, 0) self.game_types = QComboBox() grid.addWidget(self.game_types, 1, 1) layout.addLayout(grid) spacer = createVerticalSpacer() layout.addItem(spacer) button_box = QHBoxLayout() layout.addLayout(button_box) refresh = QPushButton('&Create') button_box.addWidget(refresh) window.connect(refresh, SIGNAL('clicked()'), self.create) leave = QPushButton('&Leave') button_box.addWidget(leave) window.connect(leave, SIGNAL('clicked()'), self.abort)
def createWidgets(self, window): self.widget = QWidget() layout = QVBoxLayout() self.widget.setLayout(layout) self.turn_label = QLabel() layout.addWidget(self.turn_label) grid = QGridLayout() layout.addLayout(grid) def createSow(home): def clicked(): self.sow(home) return clicked self.buttons = [None for home in xrange(12)] for row in xrange(2): for col in xrange(6): if row == 0: home = 11 - col else: home = col button = QPushButton("#%s" % home) grid.addWidget(button, row, col) self.buttons[home] = button if row == 1: window.connect(button, SIGNAL("clicked()"), createSow(1 + col)) else: button.setEnabled(False) spacer = createVerticalSpacer() layout.addItem(spacer) button_layout = QHBoxLayout() layout.addLayout(button_layout) refresh = QPushButton("&Refresh") button_layout.addWidget(refresh) window.connect(refresh, SIGNAL("clicked()"), self.refresh) leave = QPushButton("&Leave") button_layout.addWidget(leave) window.connect(leave, SIGNAL("clicked()"), self.leave)
def createWidgets(self, window): self.widget = QWidget() layout = QHBoxLayout() self.widget.setLayout(layout) left_layout = QVBoxLayout() layout.addLayout(left_layout) pick_button = QPushButton("Pick a card") left_layout.addWidget(pick_button) window.connect(pick_button, SIGNAL("clicked()"), self.pick) def createPlay(card_index): def clicked(): self.play(card_index) return clicked def createDiscard(button, card_index): def mouseReleaseEvent(event): QPushButton.mouseReleaseEvent(button, event) if event.button() == Qt.RightButton: self.discard(card_index) return mouseReleaseEvent self.hand_buttons = [] for card_index in xrange(6): button = QPushButton("#") self.hand_buttons.append(button) window.connect(button, SIGNAL('clicked()'), createPlay(card_index)) button.mouseReleaseEvent = createDiscard(button, card_index) left_layout.addWidget(button) spacer = createVerticalSpacer() left_layout.addItem(spacer) leave = QPushButton('&Leave') left_layout.addWidget(leave) window.connect(leave, SIGNAL('clicked()'), self.leave) right_layout = QVBoxLayout() layout.addLayout(right_layout) self.player_views = [] for player_index in xrange(4): view = PlayerView() right_layout.addWidget(view.frame) self.player_views.append(view)
def createWidgets(self, window): self.widget = QWidget() layout = QVBoxLayout() self.widget.setLayout(layout) if self.window.options.debug: self.id_label = QLabel() layout.addWidget(self.id_label) self.type_label = QLabel() layout.addWidget(self.type_label) self.players_label = QLabel() layout.addWidget(self.players_label) self.state_label = QLabel() layout.addWidget(self.state_label) self.autostart_checkbox = QCheckBox(tr("Autostart")) window.connect(self.autostart_checkbox, SIGNAL("stateChanged(int)"), self.autostartChanged) layout.addWidget(self.autostart_checkbox) spacer = createVerticalSpacer() layout.addItem(spacer) button_layout = QHBoxLayout() layout.addLayout(button_layout) self.start_button = QPushButton('&Start') button_layout.addWidget(self.start_button) window.connect(self.start_button, SIGNAL('clicked()'), self.start) refresh = QPushButton('&Refresh') button_layout.addWidget(refresh) window.connect(refresh, SIGNAL('clicked()'), self.refresh) leave = QPushButton('&Leave') button_layout.addWidget(leave) window.connect(leave, SIGNAL('clicked()'), self.leave)