diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2013-05-13 13:20:06 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2013-05-13 13:20:06 (GMT) |
commit | 3a6939a4b36f7418e3a818abe3730d47ac7a9ed1 (patch) | |
tree | c2eacb6d36731dd7d63aae3d5c1a4554e89f8242 | |
parent | fb0ddf5e27d684e4105adfcfde23a4d611590e18 (diff) |
fix max size
-rwxr-xr-x | activity.py | 30 | ||||
-rwxr-xr-x | main.py | 4 |
2 files changed, 22 insertions, 12 deletions
diff --git a/activity.py b/activity.py index 0a2b24f..aebe626 100755 --- a/activity.py +++ b/activity.py @@ -68,12 +68,12 @@ class Activity(activity.Activity): toolbar_box.toolbar.insert(item1, -1) item2 = gtk.ToolItem() - h_spin = gtk.SpinButton() - h_spin.set_range(2, 30) - h_spin.set_increments(1, 2) - h_spin.props.value = self.game_size[0] - h_spin.connect('notify::value', self.h_spin_change) - item2.add(h_spin) + self.h_spin = gtk.SpinButton() + self.h_spin.set_range(2, 30) + self.h_spin.set_increments(1, 2) + self.h_spin.props.value = self.game_size[0] + self.h_spin.connect('notify::value', self.h_spin_change) + item2.add(self.h_spin) toolbar_box.toolbar.insert(item2, -1) #Vertical @@ -84,12 +84,12 @@ class Activity(activity.Activity): toolbar_box.toolbar.insert(item3, -1) item4 = gtk.ToolItem() - v_spin = gtk.SpinButton() - v_spin.set_range(2, 20) - v_spin.set_increments(1, 2) - v_spin.props.value = self.game_size[1] - v_spin.connect('notify::value', self.v_spin_change) - item4.add(v_spin) + self.v_spin = gtk.SpinButton() + self.v_spin.set_range(2, 20) + self.v_spin.set_increments(1, 2) + self.v_spin.props.value = self.game_size[1] + self.v_spin.connect('notify::value', self.v_spin_change) + item4.add(self.v_spin) toolbar_box.toolbar.insert(item4, -1) separator = gtk.SeparatorToolItem() @@ -112,6 +112,12 @@ class Activity(activity.Activity): self.game_size = (self.game_size[0], int(spin.props.value) + 1) self.game.set_board_size(self.game_size) + def h_spin_set_max(self, value): + self.h_spin.set_range(2, value) + + def v_spin_set_max(self, value): + self.v_spin.set_range(2, value) + def read_file(self, file_path): pass @@ -66,6 +66,8 @@ class Game: if s_w < (w * (self.box_size[0] + 1)): print 'pasa x' + value = int(s_w / (self.box_size[0] + 1.0)) - 1 + self.parent.h_spin_set_max(value) return else: xx = w * (self.box_size[0] - 1) @@ -73,6 +75,8 @@ class Game: if s_h < (h * (self.box_size[1] + 1)): print 'pasa y' + value = int(s_h / (self.box_size[1] + 1.0)) - 1 + self.parent.v_spin_set_max(value) return else: yy = h * (self.box_size[1] - 1) |