[pitivi] ruler: Use the same color for the entire playhead



commit b54e840dcfecdd332973603114deb9908056fb72
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun Jan 12 23:32:13 2014 +0100

    ruler: Use the same color for the entire playhead

 pitivi/timeline/ruler.py    |    8 ++++++--
 pitivi/timeline/timeline.py |    3 +--
 pitivi/utils/ui.py          |    3 +++
 3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 69210e0..af164f6 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -23,6 +23,7 @@
 
 import cairo
 
+from gi.repository import Clutter
 from gi.repository import Gtk
 from gi.repository import Gdk
 from gi.repository import Gst
@@ -34,7 +35,7 @@ from gettext import gettext as _
 from pitivi.utils.pipeline import Seeker
 from pitivi.utils.timeline import Zoomable
 from pitivi.utils.loggable import Loggable
-from pitivi.utils.ui import NORMAL_FONT, PLAYHEAD_WIDTH, time_to_string, beautify_length
+from pitivi.utils.ui import NORMAL_FONT, PLAYHEAD_COLOR, PLAYHEAD_WIDTH, time_to_string, beautify_length
 
 # Color #393f3f stolen from the dark variant of Adwaita.
 # There's *no way* to get the GTK3 theme's bg color there (it's always black)
@@ -61,6 +62,9 @@ SMALL_FONT_SIZE = 11
 
 
 def setCairoColor(context, color):
+    if type(color) is Clutter.Color:
+        color = (color.red, color.green, color.blue)
+
     if type(color) is Gdk.RGBA:
         cairo_color = (float(color.red), float(color.green), float(color.blue))
     elif type(color) is tuple:
@@ -399,7 +403,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
         # without this the line appears blurry.
         xpos = self.nsToPixel(self.position) - self.pixbuf_offset + 0.5
         context.set_line_width(PLAYHEAD_WIDTH + 2)
-        context.set_source_rgb(1.0, 0, 0)
+        setCairoColor(context, PLAYHEAD_COLOR)
         context.move_to(xpos, 0)
         context.line_to(xpos, context.get_target().get_height())
         context.stroke()
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 6b15cff..e4c5d94 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -36,7 +36,7 @@ from pitivi.dialogs.prefs import PreferencesDialog
 from pitivi.settings import GlobalSettings
 from pitivi.utils.loggable import Loggable
 from pitivi.utils.timeline import Zoomable, Selection, SELECT, TimelineError
-from pitivi.utils.ui import alter_style_class, EXPANDED_SIZE, SPACING, PLAYHEAD_WIDTH, CONTROL_WIDTH
+from pitivi.utils.ui import alter_style_class, EXPANDED_SIZE, SPACING, PLAYHEAD_COLOR, PLAYHEAD_WIDTH, 
CONTROL_WIDTH
 from pitivi.utils.widgets import ZoomBox
 
 from ruler import ScaleRuler
@@ -90,7 +90,6 @@ SELECT_AFTER = ("Select all after selected")
 # Colors
 TIMELINE_BACKGROUND_COLOR = Clutter.Color.new(31, 30, 33, 255)
 SELECTION_MARQUEE_COLOR = Clutter.Color.new(100, 100, 100, 200)
-PLAYHEAD_COLOR = Clutter.Color.new(200, 0, 0, 255)
 SNAPPING_INDICATOR_COLOR = Clutter.Color.new(50, 150, 200, 200)
 
 
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index 0c8fb45..c1baa9a 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -29,6 +29,7 @@ classes that help with UI drawing around the application
 
 from decimal import Decimal
 from gettext import ngettext, gettext as _
+from gi.repository import Clutter
 from gi.repository import Cogl
 from gi.repository import GLib
 from gi.repository import GES
@@ -61,6 +62,8 @@ PLAYHEAD_WIDTH = 1
 CANVAS_SPACING = 21
 KEYFRAME_SIZE = 8
 
+PLAYHEAD_COLOR = Clutter.Color.new(200, 0, 0, 255)
+
 # Layer creation blocking time in s
 LAYER_CREATION_BLOCK_TIME = 0.2
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]