Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-12-31 00:14:14 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-12-31 00:14:14 (GMT)
commit9d682ef322770739399aaa82905a63da13d6d0c9 (patch)
treeeaa9a8eb2bd0000e6eff47f97857f52044f6ef71
parent6d40741e9f797f606f059a6fa800af9dbd217e27 (diff)
Use less steps to position montage widget
-rw-r--r--montage.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/montage.py b/montage.py
index 9f5fdbc..cd68b0d 100644
--- a/montage.py
+++ b/montage.py
@@ -23,7 +23,7 @@ import gobject
import logging
from gobject import SIGNAL_RUN_FIRST, TYPE_PYOBJECT
-from widgets.scrolledbox import VScrolledBox
+from toolkit.scrolledbox import VScrolledBox
import theme
import char
@@ -157,6 +157,7 @@ class View(gtk.EventBox):
self._frames = []
self._prev_combo_selected = {}
self._emission = True
+ self._screen_size_id = None
# frames table
@@ -233,7 +234,7 @@ class View(gtk.EventBox):
tape.pack_start(frame_box, False, False)
# left control box
-
+
self.controlbox = gtk.VBox()
self.controlbox.props.border_width = theme.BORDER_WIDTH
self.controlbox.props.spacing = theme.BORDER_WIDTH
@@ -244,16 +245,20 @@ class View(gtk.EventBox):
leftbox.set_size_request(logo.props.pixbuf.get_width(), -1)
leftbox.pack_start(logo, False, False)
leftbox.pack_start(self.controlbox, True, True)
-
+
# screen box
screen_alignment = gtk.Alignment(0.5, 0.5, 0, 0)
screen_alignment.add(screen_pink)
- screen_alignment.connect('size-allocate', self._screen_size_cb)
+
+ box = gtk.EventBox()
+ box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BACKGROUND))
+ box.connect('size-allocate', self._screen_size_cb, screen_pink)
+ box.add(screen_alignment)
cetralbox = gtk.HBox()
- cetralbox.pack_start(screen_alignment, True, True)
- cetralbox.pack_start(frames_box, True, False)
+ cetralbox.pack_start(box, expand=True, fill=True)
+ cetralbox.pack_start(frames_box, expand=False, fill=True)
hdesktop = gtk.HBox()
hdesktop.pack_start(leftbox,False,True,0)
@@ -422,6 +427,13 @@ class View(gtk.EventBox):
if self._emission:
self.emit('sound-changed', choice)
- def _screen_size_cb(self, widget, aloc):
- size = min(aloc.width, aloc.height)
- widget.child.set_size_request(size, size)
+ def _screen_size_cb(self, sender, aloc, widget):
+ def set_size():
+ size = min(aloc.width, aloc.height)
+ widget.set_size_request(size, size)
+ self._screen_size_id = None
+ return False
+
+ if self._screen_size_id is not None:
+ gobject.source_remove(self._screen_size_id)
+ self._screen_size_id = gobject.timeout_add(500, set_size)