[pitivi] ruler: Fix colors on white themes
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] ruler: Fix colors on white themes
- Date: Thu, 17 Dec 2015 10:03:28 +0000 (UTC)
commit d691b3bf846acfa4e3b4a1fc79ddd1ef9bb25ec1
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Wed Oct 28 00:44:06 2015 +0100
ruler: Fix colors on white themes
Fixes https://phabricator.freedesktop.org/T3476
Reviewed-by: Thibault Saunier <tsaunier gnome org>
Differential Revision: https://phabricator.freedesktop.org/D506
pitivi/timeline/ruler.py | 39 +++++++++++++--------------------------
1 files changed, 13 insertions(+), 26 deletions(-)
---
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 4d0997b..41369c3 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -73,8 +73,6 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
self.log("Creating new ScaleRuler")
self.timeline = timeline
- self._background_color = timeline.get_style_context().lookup_color(
- 'theme_bg_color')[1]
self._seeker = Seeker()
self.hadj = hadj
hadj.connect("value-changed", self._hadjValueChangedCb)
@@ -96,16 +94,6 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
self.callback_id = None
self.set_size_request(0, HEIGHT)
- style = self.get_style_context()
- color_normal = style.get_color(Gtk.StateFlags.NORMAL)
- color_insensitive = style.get_color(Gtk.StateFlags.INSENSITIVE)
- self._color_normal = color_normal
- self._color_dimmed = Gdk.RGBA(
- *[(x * 3 + y * 2) / 5
- for x, y in ((color_normal.red, color_insensitive.red),
- (color_normal.green, color_insensitive.green),
- (color_normal.blue, color_insensitive.blue))])
-
self.scales = SCALES
def _hadjValueChangedCb(self, unused_arg):
@@ -140,6 +128,16 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
# Create a new buffer
self.pixbuf = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ style = self.app.gui.get_style_context()
+ color_normal = style.get_color(Gtk.StateFlags.NORMAL)
+ color_insensitive = style.get_color(Gtk.StateFlags.INSENSITIVE)
+ self._color_normal = color_normal
+ self._color_dimmed = Gdk.RGBA(
+ *[(x * 3 + y * 2) / 5
+ for x, y in ((color_normal.red, color_insensitive.red),
+ (color_normal.green, color_insensitive.green),
+ (color_normal.blue, color_insensitive.blue))])
+
return False
def drawCb(self, unused_widget, context):
@@ -213,19 +211,10 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
# Drawing methods
def drawBackground(self, context):
- style = self.get_style_context()
- set_cairo_color(context, self._background_color)
width = context.get_target().get_width()
height = context.get_target().get_height()
- context.rectangle(0, 0, width, height)
- context.fill()
- offset = int(self.nsToPixel(Gst.CLOCK_TIME_NONE)) - self.pixbuf_offset
- if offset > 0:
- set_cairo_color(
- context, style.get_background_color(Gtk.StateFlags.ACTIVE))
- context.rectangle(
- 0, 0, int(offset), height)
- context.fill()
+ style_context = self.app.gui.get_style_context()
+ Gtk.render_background(style_context, context, 0, 0, width, height)
def drawRuler(self, context):
context.set_font_face(NORMAL_FONT)
@@ -279,9 +268,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
current_time = current_time - (current_time % interval) + interval
paintpos += spacing - offset
- state = Gtk.StateFlags.NORMAL
- style = self.get_style_context()
- set_cairo_color(context, style.get_color(state))
+ set_cairo_color(context, self._color_normal)
y_bearing = context.text_extents("0")[1]
millis = scale < 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]