Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/cardtable.py
diff options
context:
space:
mode:
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