[pitivi] ruler: Fix frame colors
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] ruler: Fix frame colors
- Date: Wed, 20 Jan 2016 18:56:35 +0000 (UTC)
commit a098307ec988be4c5a3601ed4c0bc5265f077c0e
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Fri Jan 15 01:21:12 2016 +0100
ruler: Fix frame colors
Reviewed-by: Thibault Saunier <tsaunier gnome org>
Differential Revision: https://phabricator.freedesktop.org/D673
pitivi/timeline/ruler.py | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 837905a..eff5740 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -170,6 +170,9 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
(color_normal.green, color_insensitive.green),
(color_normal.blue, color_insensitive.blue))])
+ # Two colors with high contrast.
+ self._color_frame = style.get_color(Gtk.StateFlags.LINK)
+
return False
def do_draw(self, context):
@@ -359,11 +362,6 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
offset = self.pixbuf_offset % frame_width
height = context.get_target().get_height()
y = int(height - FRAME_HEIGHT_PIXELS)
- # INSENSITIVE is a dark shade of gray, but lacks contrast
- # SELECTED will be bright blue and more visible to represent frames
- style = self.get_style_context()
- states = [style.get_background_color(Gtk.StateFlags.ACTIVE),
- style.get_background_color(Gtk.StateFlags.SELECTED)]
frame_num = int(
self.pixelToNs(self.pixbuf_offset) * float(self.frame_rate) / Gst.SECOND)
@@ -372,10 +370,11 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
while paintpos < max_pos:
paintpos = self.nsToPixel(
1 / float(self.frame_rate) * Gst.SECOND * frame_num)
- set_cairo_color(context, states[(frame_num + 1) % 2])
- context.rectangle(
- 0.5 + paintpos - self.pixbuf_offset, y, frame_width, height)
- context.fill()
+ if frame_num % 2:
+ set_cairo_color(context, self._color_frame)
+ context.rectangle(
+ 0.5 + paintpos - self.pixbuf_offset, y, frame_width, height)
+ context.fill()
frame_num += 1
def drawPosition(self, context):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]