[pitivi] ruler: Rename variable and reuse value



commit 0c4eb6d81fd89f473e2ddc2178f8a927ff25d8d0
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Jan 2 19:17:11 2014 +0100

    ruler: Rename variable and reuse value
    
    'seconds' is confusing because it actually holds nanos.
    Reuse the width value of the widget.

 pitivi/timeline/ruler.py |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index a52bb49..cd3582f 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -312,10 +312,10 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
     def drawTimes(self, context, offset, spacing, scale):
         # figure out what the optimal offset is
         interval = long(Gst.SECOND * scale)
-        seconds = self.pixelToNs(self.pixbuf_offset)
+        current_time = self.pixelToNs(self.pixbuf_offset)
         paintpos = TIMES_LEFT_MARGIN_PIXELS
         if offset > 0:
-            seconds = seconds - (seconds % interval) + interval
+            current_time = current_time - (current_time % interval) + interval
             paintpos += spacing - offset
 
         state = Gtk.StateFlags.NORMAL
@@ -329,14 +329,15 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
             # can have a variable length.
             return x[:-10], x[-10], x[-9:-7], x[-7], x[-6:-4], x[-4], x[-3:]
 
-        previous_time = split(time_to_string(max(0, seconds - interval)))
-        while paintpos < context.get_target().get_width():
+        previous = split(time_to_string(max(0, current_time - interval)))
+        width = context.get_target().get_width()
+        while paintpos < width:
             context.move_to(int(paintpos), 1 - y_bearing)
-            current_time = split(time_to_string(long(seconds)))
-            self._drawTime(context, current_time, previous_time)
-            previous_time = current_time
+            current = split(time_to_string(long(current_time)))
+            self._drawTime(context, current, previous)
+            previous = current
             paintpos += spacing
-            seconds += interval
+            current_time += interval
 
     def _drawTime(self, context, current, previous):
         for element, previous_element in zip(current, previous):


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