From 62e694366d09cdbd591bf2818b00315dcbee62a1 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Mon, 21 Jul 2014 15:42:43 +0000 Subject: When the game reset due to screen rotate, reset scoreboad --- diff --git a/scoreboard.py b/scoreboard.py index f381378..9882ad2 100644 --- a/scoreboard.py +++ b/scoreboard.py @@ -25,6 +25,8 @@ class Scoreboard(Gtk.EventBox): def __init__(self): Gtk.EventBox.__init__(self) self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#666666')) + self.connect('size-allocate', self._allocate_cb) + self._width = self.get_allocation().width self.players = {} self.current_buddy = None self.hbox = Gtk.HBox(False) @@ -33,6 +35,12 @@ class Scoreboard(Gtk.EventBox): self.add(self.hbox) self.show_all() + def _allocate_cb(self, widget, allocation): + # check if the width changes (when the screen rotates + if allocation.width != self._width: + self._width = allocation.width + self.reset(widget) + def change_game(self, widget, data, grid): for buddy in self.players.keys(): self.players[buddy].change_game(len(grid)) -- cgit v0.9.1