Use nicer symbols, allow multiple games at once
|
@ -299,14 +299,15 @@ class Goban:
|
|||
code = self.def_draw_codes[pos]
|
||||
elif point == Goban.BLACK:
|
||||
code = 'b'
|
||||
if pos == self.last_move:
|
||||
code += 'Cw'
|
||||
elif point == Goban.WHITE:
|
||||
code = 'w'
|
||||
if pos == self.last_move:
|
||||
code += 'Cb'
|
||||
|
||||
if pos == self.last_move:
|
||||
code += 'C'
|
||||
|
||||
if pos == self.ko:
|
||||
code += 'C'
|
||||
code += 'S'
|
||||
|
||||
return code
|
||||
|
||||
|
|
18
pygo.py
|
@ -29,28 +29,22 @@ class Pygo():
|
|||
self.tree.signal_autoconnect(self)
|
||||
self.window = self.tree.get_widget('window')
|
||||
self.contents = self.tree.get_widget('main_box')
|
||||
self.games = self.tree.get_widget('games')
|
||||
|
||||
|
||||
def init_widgets(self):
|
||||
self.window.resize(1000,800)
|
||||
self.gogame = None
|
||||
self.window.resize(800,600)
|
||||
# gobject.timeout_add(1000, self.update)
|
||||
|
||||
|
||||
def on_game_close(self, widget):
|
||||
if self.gogame:
|
||||
self.contents.remove(self.gogame)
|
||||
self.gogame = None
|
||||
self.games.remove_page(self.games.get_current_page())
|
||||
|
||||
|
||||
def on_local_new(self, widget):
|
||||
# Remove any existing game
|
||||
# fixme - we'll remove this later and add a new concurrent game instead
|
||||
self.on_game_close(None)
|
||||
|
||||
self.gogame = gogame.GoGame(goban.Goban())
|
||||
self.contents.pack_start(self.gogame)
|
||||
self.gogame.show_all()
|
||||
game = gogame.GoGame(goban.Goban())
|
||||
self.games.append_page(game, gtk.Label('Local Game'))
|
||||
game.show_all()
|
||||
|
||||
|
||||
def on_net_direct(self, widget):
|
||||
|
|
|
@ -115,7 +115,47 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
<widget class="GtkNotebook" id="games">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
<property name="show_border">True</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">False</property>
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">label1</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
|
BIN
ui/res/go_circle_black.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
BIN
ui/res/go_circle_white.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
ui/res/go_square.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
@ -59,7 +59,7 @@ class GoGame(gtk.HBox):
|
|||
info_box.pack_start(self.resign_button, expand=False, padding=10)
|
||||
|
||||
self.board_area = gtk.DrawingArea()
|
||||
self.board_area.set_size_request(800, 800)
|
||||
self.board_area.set_size_request(750,750)
|
||||
self.board_area.set_events(gtk.gdk.POINTER_MOTION_MASK |
|
||||
gtk.gdk.POINTER_MOTION_HINT_MASK |
|
||||
gtk.gdk.BUTTON_PRESS_MASK |
|
||||
|
@ -205,8 +205,11 @@ def _magnitude(vector):
|
|||
def _build_img_res():
|
||||
ret = {}
|
||||
|
||||
triangle = _load_png('go_t.png')
|
||||
circle = _load_png('go_c.png')
|
||||
triangle = _load_png('go_triangle.png')
|
||||
circle_red = _load_png('go_circle_red.png')
|
||||
circle_black = _load_png('go_circle_black.png')
|
||||
circle_white = _load_png('go_circle_white.png')
|
||||
square = _load_png('go_square.png')
|
||||
|
||||
ret['wH'] = _load_png('go_wH.png')
|
||||
ret['bH'] = _load_png('go_bH.png')
|
||||
|
@ -237,10 +240,26 @@ def _build_img_res():
|
|||
ret[d] = _load_png('go_' + d + '.png')
|
||||
|
||||
for d in ('u', 'd', 'l', 'r', 'm', 'dl', 'dr', 'ul', 'ur', 'h', 'w', 'b'):
|
||||
ret[d + 'C'] = ret[d].copy()
|
||||
width = ret[d + 'C'].get_width()
|
||||
height = ret[d + 'C'].get_height()
|
||||
circle.composite(ret[d + 'C'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
||||
ret[d + 'Cr'] = ret[d].copy()
|
||||
width = ret[d + 'Cr'].get_width()
|
||||
height = ret[d + 'Cr'].get_height()
|
||||
circle_red.composite(ret[d + 'Cr'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
||||
|
||||
ret[d + 'Cw'] = ret[d].copy()
|
||||
width = ret[d + 'Cw'].get_width()
|
||||
height = ret[d + 'Cw'].get_height()
|
||||
circle_white.composite(ret[d + 'Cw'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
||||
|
||||
ret[d + 'Cb'] = ret[d].copy()
|
||||
width = ret[d + 'Cb'].get_width()
|
||||
height = ret[d + 'Cb'].get_height()
|
||||
circle_black.composite(ret[d + 'Cb'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
||||
|
||||
ret[d + 'S'] = ret[d].copy()
|
||||
width = ret[d + 'S'].get_width()
|
||||
height = ret[d + 'S'].get_height()
|
||||
square.composite(ret[d + 'S'], 0, 0, width, height, 0, 0, 1, 1, gtk.gdk.INTERP_NEAREST, 255)
|
||||
|
||||
|
||||
return ret
|
||||
|
||||
|
|