segfaulthunter / pypentago-mainline
pypentago is an open source effort to recreate the board-game Pentago using Python.
Clone this repository (size: 1.1 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/segfaulthunter/pypentago-mainline/
| commit 414: | 8abe24cd9bef |
| parent 413: | 5398bdcdd00a |
| branch: | default |
Bind buttons to functions.
Changed (Δ789 bytes):
raw changeset »
src/pypentago/client/interface/server.py (29 lines added, 2 lines removed)
Up to file-list src/pypentago/client/interface/server.py:
| … | … | @@ -329,7 +329,7 @@ class ServerBrowser(QtGui.QWidget): |
329 |
329 |
self.reset = QtGui.QPushButton('Reset') |
330 |
330 |
self.add = QtGui.QPushButton('Add') |
331 |
331 |
self.remove = QtGui.QPushButton('Remove') |
332 |
self.connect |
|
332 |
self.connect_ = QtGui.QPushButton('Connect') |
|
333 |
333 |
|
334 |
334 |
inputlayout.addWidget(QtGui.QLabel('Name: '), 0, 0) |
335 |
335 |
inputlayout.addWidget(self.name, 0, 1) |
| … | … | @@ -345,13 +345,26 @@ class ServerBrowser(QtGui.QWidget): |
345 |
345 |
buttonlayout.addWidget(self.reset) |
346 |
346 |
buttonlayout.addWidget(self.add) |
347 |
347 |
buttonlayout.addWidget(self.remove) |
348 |
buttonlayout.addWidget(self.connect |
|
348 |
buttonlayout.addWidget(self.connect_) |
|
349 |
349 |
|
350 |
350 |
layout.addLayout(inputlayout, 0) |
351 |
351 |
layout.addWidget(self.serverlist, 1) |
352 |
352 |
layout.addLayout(buttonlayout, 0) |
353 |
353 |
|
354 |
354 |
self.setLayout(layout) |
355 |
||
356 |
QtCore.QObject.connect( |
|
357 |
self.reset, QtCore.SIGNAL('clicked()'), self.reset_clicked |
|
358 |
) |
|
359 |
QtCore.QObject.connect( |
|
360 |
self.add, QtCore.SIGNAL('clicked()'), self.add_clicked |
|
361 |
) |
|
362 |
QtCore.QObject.connect( |
|
363 |
self.remove, QtCore.SIGNAL('clicked()'), self.remove_clicked |
|
364 |
) |
|
365 |
QtCore.QObject.connect( |
|
366 |
self.connect_, QtCore.SIGNAL('clicked()'), self.connect_clicked |
|
367 |
) |
|
355 |
368 |
|
356 |
369 |
def set_servers(self, servers): |
357 |
370 |
for server in servers: |
| … | … | @@ -360,6 +373,20 @@ class ServerBrowser(QtGui.QWidget): |
360 |
373 |
server.user or '', server.description or ''] |
361 |
374 |
) |
362 |
375 |
self.serverlist.addTopLevelItem(item) |
376 |
||
377 |
def reset_clicked(self): |
|
378 |
for widget in [self.name, self.address, self.user, self.password, |
|
379 |
self.description]: |
|
380 |
widget.setText('') |
|
381 |
||
382 |
def add_clicked(self): |
|
383 |
pass |
|
384 |
||
385 |
def remove_clicked(self): |
|
386 |
pass |
|
387 |
||
388 |
def connect_clicked(self): |
|
389 |
pass |
|
363 |
390 |
|
364 |
391 |
if __name__ == '__main__': |
365 |
392 |
app = QtGui.QApplication(sys.argv) |
