[pitivi/ges] Slight code style cleanup in ruler, mainwindow and timeline



commit 9700203037e3ea3e6220c02c9ad61c6dd14df8f3
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Sat Apr 28 12:31:26 2012 -0400

    Slight code style cleanup in ruler, mainwindow and timeline

 pitivi/mainwindow.py        |    6 +++---
 pitivi/timeline/ruler.py    |   30 ++++++++++++------------------
 pitivi/timeline/timeline.py |    4 +---
 3 files changed, 16 insertions(+), 24 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 942200e..dbf6355 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -491,9 +491,9 @@ class PitiviMainWindow(gtk.Window, Loggable):
         """
         Grab (or release) keyboard letter keys focus/sensitivity
         for operations such as typing text in an entry.
-        @param action_names: The name of actions we
-                             want to set to sensitive or not, if set to "default"
-                             we use the default actions.
+
+        @param action_names: The name of actions we want to set to (in)sensitive
+                             If set to "default", we use the default actions.
         @type action_names: A {list} of action names
         @param sensitive: %True if actions must be sensitive False otherwise
         @type action_names: C{Bool}
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 61a61b6..f8d0188 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -55,11 +55,13 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
         gtk.DrawingArea.__init__(self)
         Zoomable.__init__(self)
         Loggable.__init__(self)
-        self.log("Creating new ScaleRule")
-        self.add_events(gtk.gdk.POINTER_MOTION_MASK |
-            gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK)
+        self.log("Creating new ScaleRuler")
+        self.app = instance
+        self._seeker = Seeker()
         self.hadj = hadj
         hadj.connect("value-changed", self._hadjValueChangedCb)
+        self.add_events(gtk.gdk.POINTER_MOTION_MASK |
+            gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK)
 
         # double-buffering properties
         self.pixmap = None
@@ -71,16 +73,12 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
         # This is the number of visible_width we allocate for the pixmap
         self.pixmap_multiples = 2
 
-        # position is in nanoseconds
-        self.position = 0
+        self.position = 0  # In nanoseconds
         self.pressed = False
+        self.need_update = True
         self.min_frame_spacing = 5.0
         self.frame_height = 5.0
         self.frame_rate = gst.Fraction(1 / 1)
-        self.app = instance
-        self.need_update = True
-
-        self._seeker = Seeker()
 
     def _hadjValueChangedCb(self, hadj):
         self.pixmap_offset = self.hadj.get_value()
@@ -197,17 +195,17 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
         if (allocation.width != self.pixmap_old_allocated_width):
             if self.pixmap:
                 del self.pixmap
-            self.pixmap = gtk.gdk.Pixmap(self.window, allocation.width,
-                                         allocation.height)
+            self.pixmap = gtk.gdk.Pixmap(self.window, allocation.width, allocation.height)
             self.pixmap_old_allocated_width = allocation.width
 
         self.drawBackground(allocation)
         self.drawRuler(allocation)
 
     def setProjectFrameRate(self, rate):
+        """
+        Set the lowest scale based on project framerate
+        """
         self.frame_rate = rate
-
-        # set the lowest scale based on project framerate
         self.scale[0] = float(2 / rate)
         self.scale[1] = float(5 / rate)
         self.scale[2] = float(10 / rate)
@@ -237,7 +235,6 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
                 break
 
         offset = self.pixmap_offset % spacing
-
         zoomRatio = self.zoomratio
         self.drawFrameBoundaries(allocation)
         self.drawTicks(allocation, offset, spacing, scale)
@@ -306,14 +303,11 @@ class ScaleRuler(gtk.DrawingArea, Zoomable, Loggable):
 
     def drawPosition(self, context, allocation):
         # a simple RED line will do for now
-        xpos = self.nsToPixel(self.position) + self.border -\
-            self.pixmap_offset
+        xpos = self.nsToPixel(self.position) + self.border - self.pixmap_offset
         context.save()
         context.set_line_width(1.5)
         context.set_source_rgb(1.0, 0, 0)
-
         context.move_to(xpos, 0)
         context.line_to(xpos, allocation.height)
         context.stroke()
-
         context.restore()
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 8f06393..d5c6d22 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -213,8 +213,7 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable, Loggable):
         root.connect("button-press-event", self._selectionStart)
         root.connect("button-release-event", self._selectionEnd)
         self.connect("button-release-event", self._snapEndedCb)
-        self.height = (LAYER_HEIGHT_EXPANDED + TRACK_SPACING +
-                LAYER_SPACING) * 2
+        self.height = (LAYER_HEIGHT_EXPANDED + TRACK_SPACING + LAYER_SPACING) * 2
         # add some padding for the horizontal scrollbar
         self.height += 21
         self.set_size_request(-1, self.height)
@@ -761,7 +760,6 @@ class Timeline(gtk.Table, Loggable, Zoomable):
         self.nextframe_action = actiongroup.get_action("Nextframe")
 
         self.ui_manager.insert_action_group(actiongroup, -1)
-
         self.ui_manager.add_ui_from_string(ui)
 
         # drag and drop



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