[pitivi] ruler: Remove hadj parameter



commit 287cc4bb8e92b9e303e8e852ba6ad4f842bfcfdb
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Wed Oct 12 12:38:44 2016 +0200

    ruler: Remove hadj parameter
    
    Take hadj directly from the timeline which is passed to the constructor.
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D1380

 pitivi/timeline/ruler.py    |   11 ++++++-----
 pitivi/timeline/timeline.py |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 38054f5..6729bb4 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -94,7 +94,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
         _pipeline (Pipeline): The pipeline of the project.
     """
 
-    def __init__(self, timeline, hadj):
+    def __init__(self, timeline):
         Gtk.DrawingArea.__init__(self)
         Zoomable.__init__(self)
         Loggable.__init__(self)
@@ -102,8 +102,8 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
 
         self.timeline = timeline
         self._pipeline = None
-        self.hadj = hadj
-        hadj.connect("value-changed", self._hadjValueChangedCb)
+        hadj = timeline.timeline.hadj
+        hadj.connect("value-changed", self._hadj_value_changed_cb)
         self.add_events(Gdk.EventMask.POINTER_MOTION_MASK |
                         Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK |
                         Gdk.EventMask.SCROLL_MASK)
@@ -120,8 +120,9 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
 
         self.scales = SCALES
 
-    def _hadjValueChangedCb(self, unused_arg):
-        self.pixbuf_offset = self.hadj.get_value()
+    def _hadj_value_changed_cb(self, hadj):
+        """Handles the adjustment value change."""
+        self.pixbuf_offset = hadj.get_value()
         self.queue_draw()
 
 # Zoomable interface override
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 025f095..96a3714 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1313,7 +1313,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
         hscrollbar = Gtk.HScrollbar(adjustment=self.hadj)
         hscrollbar.get_style_context().add_class("background")
 
-        self.ruler = ScaleRuler(self, self.hadj)
+        self.ruler = ScaleRuler(self)
         self.ruler.props.hexpand = True
         self.ruler.setProjectFrameRate(24.)
 


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