[pitivi] timeline: Make the timeline toolbar and scrollbars background transparent



commit 25107dc898d1e250b91e264367120c88b6e96e61
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun Jan 12 02:50:42 2014 +0100

    timeline: Make the timeline toolbar and scrollbars background transparent

 pitivi/timeline/timeline.py |    6 +++++-
 pitivi/utils/ui.py          |    9 +++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 1d01757..cb71e8a 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 EXPANDED_SIZE, SPACING, PLAYHEAD_WIDTH, CONTROL_WIDTH, TYPE_PITIVI_EFFECT
+from pitivi.utils.ui import alter_style_class, EXPANDED_SIZE, SPACING, PLAYHEAD_WIDTH, CONTROL_WIDTH
 from pitivi.utils.widgets import ZoomBox
 
 from ruler import ScaleRuler
@@ -867,6 +867,10 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
         toolbar.set_style(Gtk.ToolbarStyle.ICONS)
         toolbar.get_accessible().set_name("timeline toolbar")
 
+        alter_style_class(".inline-toolbar", toolbar, "padding-left: %dpx; border-width: 0px; background: 
alpha (@base_color, 0.0);" % (SPACING / 2))
+        alter_style_class(".scrollbar.trough", self._vscrollbar, "border: alpha (@base_color, 0.0); 
background: alpha (@base_color, 0.0);")
+        alter_style_class(".scrollbar.trough", self._hscrollBar, "border: alpha (@base_color, 0.0); 
background: alpha (@base_color, 0.0);")
+
         # Toggle/pushbuttons like the "gapless mode" ones are special, it seems
         # you can't insert them as normal "actions", so we create them here:
         gapless_mode_button = Gtk.ToggleToolButton()
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index 26b80f7..f9d83bf 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -397,6 +397,15 @@ def get_value_from_model(model, key):
         return "%.3f" % Decimal(float(key.num) / key.denom)
     return str(key)
 
+
+def alter_style_class(style_class, target_widget, css_style):
+    css_provider = Gtk.CssProvider()
+    toolbar_css = "%s { %s }" % (style_class, css_style)
+    css_provider.load_from_data(toolbar_css.encode('UTF-8'))
+    style_context = target_widget.get_style_context()
+    style_context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
+
+
 #------------------------ encoding datas ----------------------------------------#
 # FIXME This should into a special file
 frame_rates = model((str, object), (


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