pitivi r1392 - trunk/pitivi/ui
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1392 - trunk/pitivi/ui
- Date: Fri, 28 Nov 2008 17:28:14 +0000 (UTC)
Author: edwardrv
Date: Fri Nov 28 17:28:14 2008
New Revision: 1392
URL: http://svn.gnome.org/viewvc/pitivi?rev=1392&view=rev
Log:
added cursor handling code to controller, TrimHandle objects now set appropraite cursors
Modified:
trunk/pitivi/ui/controller.py
trunk/pitivi/ui/timelineobject.py
Modified: trunk/pitivi/ui/controller.py
==============================================================================
--- trunk/pitivi/ui/controller.py (original)
+++ trunk/pitivi/ui/controller.py Fri Nov 28 17:28:14 2008
@@ -1,5 +1,6 @@
from pitivi.receiver import receiver, handler
from point import Point
+import gtk
# Controllers are reusable and implement specific behaviors. Currently this
# Includes only click, and drag. Multiple controllers could be attached to a
@@ -8,7 +9,7 @@
# that explictly combines the functionality of both when custom behavior is
# desired.
-#TODO: refactor to handle cursors
+#TODO: refactor to handle modifier keys
class Controller(object):
@@ -20,6 +21,7 @@
_dragging = None
_canvas = None
+ _cursor = None
_ptr_within = False
_last_click = None
_mousedown = None
@@ -46,6 +48,8 @@
@handler(_view, "enter_notify_event")
def enter_notify_event(self, item, target, event):
+ if self._cursor:
+ event.window.set_cursor(self._cursor)
self.enter(item, target)
self._ptr_within = True
return True
Modified: trunk/pitivi/ui/timelineobject.py
==============================================================================
--- trunk/pitivi/ui/timelineobject.py (original)
+++ trunk/pitivi/ui/timelineobject.py Fri Nov 28 17:28:14 2008
@@ -12,6 +12,21 @@
LEFT_SIDE = gtk.gdk.Cursor(gtk.gdk.LEFT_SIDE)
RIGHT_SIDE = gtk.gdk.Cursor(gtk.gdk.RIGHT_SIDE)
+ARROW = gtk.gdk.Cursor(gtk.gdk.ARROW)
+
+class TimelineController(controller.Controller):
+
+ _cursor = ARROW
+
+ def drag_start(self):
+ instance.PiTiVi.current.timeline.disableEdgeUpdates()
+
+ def drag_end(self):
+ instance.PiTiVi.current.timeline.enableEdgeUpdates()
+
+ def set_pos(self, item, pos):
+ self._view.element.snapStartDurationTime(max(
+ self._view.pixelToNs(pos[0]), 0))
class TrimHandle(View, goocanvas.Rect, Zoomable):
@@ -34,7 +49,9 @@
"""Subclass of TrimHandle wich sets the object's start time"""
- class Controller(controller.Controller):
+ class Controller(TimelineController):
+
+ _cursor = LEFT_SIDE
def set_pos(self, obj, pos):
self._view.element.snapInTime(
@@ -44,7 +61,9 @@
"""Subclass of TrimHandle which sets the objects's end time"""
- class Controller(controller.Controller):
+ class Controller(TimelineController):
+
+ _cursor = RIGHT_SIDE
def set_pos(self, obj, pos):
self._view.element.snapOutTime(
@@ -58,17 +77,7 @@
__NORMAL__ = 0x709fb899
__SELECTED__ = 0xa6cee3AA
- class Controller(controller.Controller):
-
- def drag_start(self):
- instance.PiTiVi.current.timeline.disableEdgeUpdates()
-
- def drag_end(self):
- instance.PiTiVi.current.timeline.enableEdgeUpdates()
-
- def set_pos(self, item, pos):
- self._view.element.snapStartDurationTime(max(
- self._view.pixelToNs(pos[0]), 0))
+ Controller = TimelineController
def __init__(self, element, composition):
goocanvas.Group.__init__(self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]