pitivi r1393 - trunk/pitivi/ui
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1393 - trunk/pitivi/ui
- Date: Fri, 28 Nov 2008 17:34:51 +0000 (UTC)
Author: edwardrv
Date: Fri Nov 28 17:34:51 2008
New Revision: 1393
URL: http://svn.gnome.org/viewvc/pitivi?rev=1393&view=rev
Log:
better bounds calculation...fixed height calculation bug, but at some point will need to write a custom container
Modified:
trunk/pitivi/ui/point.py
trunk/pitivi/ui/timeline.py
trunk/pitivi/ui/timelinecanvas.py
trunk/pitivi/ui/track.py
Modified: trunk/pitivi/ui/point.py
==============================================================================
--- trunk/pitivi/ui/point.py (original)
+++ trunk/pitivi/ui/point.py Fri Nov 28 17:34:51 2008
@@ -31,3 +31,12 @@
"""Returns the 2-dvector difference p1 - p2"""
return Point(*(a - b for a, b in izip(p1, p2)))
+ @classmethod
+ def from_item_bounds(self, item):
+ bounds = item.get_bounds()
+ return Point(bounds.x1, bounds.y1), Point(bounds.x2, bounds.y2)
+
+ @classmethod
+ def from_widget_bounds(self, widget):
+ x1, y1, x2, y2 = widget.get_bounds()
+ return Point(x1, y1), Point(x2, y2)
Modified: trunk/pitivi/ui/timeline.py
==============================================================================
--- trunk/pitivi/ui/timeline.py (original)
+++ trunk/pitivi/ui/timeline.py Fri Nov 28 17:34:51 2008
@@ -144,7 +144,6 @@
self.connect("drag-leave", self._dragLeaveCb)
self.connect("drag-motion", self._dragMotionCb)
-
# toolbar actions
actions = (
("ZoomIn", gtk.STOCK_ZOOM_IN, None, None, ZOOM_IN,
@@ -158,7 +157,7 @@
)
self.actiongroup = gtk.ActionGroup("complextimeline")
self.actiongroup.add_actions(actions)
- self.actiongroup.set_visible(False)
+ #self.actiongroup.set_visible(False)
uiman = instance.PiTiVi.gui.uimanager
uiman.insert_action_group(self.actiongroup, 0)
uiman.add_ui_from_string(ui)
Modified: trunk/pitivi/ui/timelinecanvas.py
==============================================================================
--- trunk/pitivi/ui/timelinecanvas.py (original)
+++ trunk/pitivi/ui/timelinecanvas.py Fri Nov 28 17:34:51 2008
@@ -1,5 +1,5 @@
from track import Track
-from pitivi.utils import closest_item
+from point import Point
import goocanvas
from complexinterface import Zoomable
import pitivi.instance as instance
@@ -30,13 +30,10 @@
goocanvas.Canvas.__init__(self)
self._selected_sources = []
self.__layers = []
- self.__last_row = 0
self._block_size_request = False
self.props.integer_layout = True
- # FIXME: don't forget to change me back
- #self.props.automatic_bounds = False
-
+ self.props.automatic_bounds = False
self.layerInfoList = layerinfolist
self._createUI()
@@ -60,26 +57,20 @@
fill_color_rgba=0x33CCFF66)
self._razor.props.visibility = goocanvas.ITEM_INVISIBLE
root.add_child(self._razor)
- self.set_bounds(0, 0, 800, 120)
## methods for dealing with updating the canvas size
def block_size_request(self, status):
self._block_size_request = status
- def _request_size(self, unused_item, unused_prop):
- # we only update the bounds of the canvas by chunks of 100 pixels
- # in width, otherwise we would always be redrawing the whole canvas.
- # Make sure canvas is at least 800 pixels wide, and at least 100 pixels
- # wider than it actually needs to be.
- w = max(800, ((int(self.tracks.width + 100) / 100) + 1 ) * 100)
- h = int(self.tracks.height)
- x1, y1, x2, y2 = self.get_bounds()
- pw = abs(x2 - x1)
- ph = abs(y2 - y1)
- if not (w == pw and h == ph):
- self.set_bounds(0, 0, w, h)
- return True
+ @handler(layerInfoList, "start-duration-changed")
+ def _request_size(self, unused_item):
+ tl, br = Point.from_widget_bounds(self)
+ pw, ph = br - tl
+ tl, br = Point.from_item_bounds(self.tracks)
+ w, h = br - tl
+ if (w > pw) or (h > ph):
+ self.set_bounds(0, 0, w + 200, h)
## mouse callbacks
@@ -232,6 +223,8 @@
def _regroup_tracks(self):
for i, track in enumerate(self.__layers):
- b = track.get_bounds()
- height = b.y2 - b.y1
+ height = Point.__sub__(*Point.from_item_bounds(track))[1]
+ # FIXME: hard-coding track height, because goocanvas is kinda
+ # ghetto
+ height = 50
track.set_simple_transform(0, i * (height + 10), 1, 0)
Modified: trunk/pitivi/ui/track.py
==============================================================================
--- trunk/pitivi/ui/track.py (original)
+++ trunk/pitivi/ui/track.py Fri Nov 28 17:34:51 2008
@@ -14,12 +14,6 @@
def __init__(self, comp=None):
goocanvas.Group.__init__(self)
- self.bg = goocanvas.Rect(
- line_width=0,
- width=800,
- height=50,
- fill_color="gray")
- self.add_child(self.bg)
self.widgets = {}
self.comp = comp
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]