Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/cardtable.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-05-27 13:00:59 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-05-27 13:44:00 (GMT)
commit22b52898b5f972f22fa1ae749d6d842f1a108a1e (patch)
treef4d53090d551ec2b09815fbbc486abfa071e5ed9 /cardtable.py
parent7a50b120e60a0dd38273e683833b9ed1f0bfaff2 (diff)
Rearrange widgets in the play screen to use rotated
Signed-off-by: Walter Bender <walter@sugarlabs.org> Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'cardtable.py')
-rw-r--r--cardtable.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/cardtable.py b/cardtable.py
index 97428cc..1c7d957 100644
--- a/cardtable.py
+++ b/cardtable.py
@@ -67,8 +67,23 @@ class CardTable(gtk.EventBox):
self.dict = None
self.show_all()
+ def resize(self, size, change=True):
+ _logger.debug('set size request %dx%d' % (size, size))
+ self.set_size_request(size, size)
+ self._workspace_size = size
+ if self.data:
+ if change:
+ self.change_game(None, self.data, self.cards_data)
+ else:
+ self.load_game(None, self.data, self.cards_data)
+
def _allocate_cb(self, widget, allocation):
- size = allocation.height
+ width = gtk.gdk.screen_width()
+ height = gtk.gdk.screen_height()
+ if width < height:
+ size = allocation.width
+ else:
+ size = allocation.height
if size == 100:
# skip first time sizing
@@ -78,12 +93,7 @@ class CardTable(gtk.EventBox):
if self._workspace_size:
return
- _logger.debug('Use %s allocation' % str(self.allocation))
-
- self.set_size_request(size, size)
- self._workspace_size = size
- if self.data:
- self.load_game(None, self.data, self.cards_data)
+ self.resize(size, change=False)
def load_game(self, widget, data, grid):
self.data = data