Fully implemented loading SGF files, although we can only look at the main sequence for now
This commit is contained in:
27
pygo.py
27
pygo.py
@ -68,15 +68,32 @@ class Pygo():
|
||||
|
||||
def on_local_new(self, widget):
|
||||
game = gogame.GoGame(goban.Goban())
|
||||
self.games.append_page(game, gtk.Label('Local Game'))
|
||||
self.games.set_tab_reorderable(game, True)
|
||||
game.show_all()
|
||||
game.winner_box.hide()
|
||||
self._add_game(game, 'Local Game')
|
||||
|
||||
|
||||
def on_local_load_sgf(self, widget):
|
||||
print 'stub: Pygo.on_local_load_sgf()'
|
||||
dialog = gtk.FileChooserDialog(title='Choose SGF File', action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
|
||||
|
||||
dialog.set_default_response(gtk.RESPONSE_OK)
|
||||
|
||||
# fixme - add filters and such?
|
||||
|
||||
resp = dialog.run()
|
||||
|
||||
if resp == gtk.RESPONSE_OK:
|
||||
game = gogame.GoGame(goban.Goban(file_name=dialog.get_filename()))
|
||||
self._add_game(game, 'Loaded SGF') # fixme - put something more interesting in the label
|
||||
|
||||
dialog.destroy()
|
||||
|
||||
|
||||
def _add_game(self, game, label):
|
||||
self.games.append_page(game, gtk.Label(label))
|
||||
self.games.set_tab_reorderable(game, True)
|
||||
game.show_all()
|
||||
game.winner_box.hide()
|
||||
|
||||
|
||||
def on_net_direct(self, widget):
|
||||
print 'stub: Pygo.on_net_direct()'
|
||||
|
Reference in New Issue
Block a user