[pitivi] cleanup



commit cee7251a485ff583c76cc43688092e08cd1e3986
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun Jan 12 12:34:51 2014 +0100

    cleanup

 pitivi/timeline/elements.py |    2 +-
 pitivi/timeline/ruler.py    |    8 +++-----
 pitivi/timeline/timeline.py |   26 +++++++++++---------------
 pitivi/utils/ui.py          |    2 +-
 4 files changed, 16 insertions(+), 22 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 14cb614..e0b4a13 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -33,7 +33,7 @@ from datetime import datetime
 
 import weakref
 
-from gi.repository import Clutter, Gtk, GtkClutter, Cogl, GES, Gdk, Gst, GstController, GLib
+from gi.repository import Clutter, Gtk, GtkClutter, Cogl, GES, Gdk, Gst, GstController
 from pitivi.utils.timeline import Zoomable, EditingContext, SELECT, UNSELECT, SELECT_ADD, Selected
 from previewers import AudioPreviewer, VideoPreviewer
 
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 9d3e999..d1e9d8a 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -34,7 +34,7 @@ from gettext import gettext as _
 from pitivi.utils.pipeline import Seeker
 from pitivi.utils.timeline import Zoomable
 from pitivi.utils.loggable import Loggable
-from pitivi.utils.ui import NORMAL_FONT, time_to_string, beautify_length
+from pitivi.utils.ui import NORMAL_FONT, PLAYHEAD_WIDTH, time_to_string, beautify_length
 
 # Color #393f3f stolen from the dark variant of Adwaita.
 # There's *no way* to get the GTK3 theme's bg color there (it's always black)
@@ -145,7 +145,7 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
         self.log("Ruler has lost focus")
         self.timeline.setActionsSensitivity(False)
 
-    def _hadjValueChangedCb(self, hadj):
+    def _hadjValueChangedCb(self, unused_arg):
         self.pixbuf_offset = self.hadj.get_value()
         if self.callback_id_scroll is not None:
             GLib.source_remove(self.callback_id_scroll)
@@ -394,10 +394,8 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
     def drawPosition(self, context):
         # a simple RED line will do for now
         xpos = self.nsToPixel(self.position) - self.pixbuf_offset
-        context.save()
-        context.set_line_width(1.5)
+        context.set_line_width(PLAYHEAD_WIDTH)
         context.set_source_rgb(1.0, 0, 0)
         context.move_to(xpos, 0)
         context.line_to(xpos, context.get_target().get_height())
         context.stroke()
-        context.restore()
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index f9dc324..682dc1f 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -468,9 +468,9 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
     def _updateSize(self, ghostclip=None):
         self.save_easing_state()
         self.set_easing_duration(0)
-        self.props.width = self.nsToPixel(self.bTimeline.get_duration()) + 250
+        self.props.width = self.nsToPixel(self.bTimeline.get_duration()) + CONTROL_WIDTH
         if ghostclip is not None:
-            ghostEnd = ghostclip.props.x + ghostclip.props.width + 250
+            ghostEnd = ghostclip.props.x + ghostclip.props.width + CONTROL_WIDTH
             self.props.width = max(ghostEnd, self.props.width)
         self.props.height = (len(self.bTimeline.get_layers()) + 1) * (EXPANDED_SIZE + SPACING) * 2 + SPACING
         self.restore_easing_state()
@@ -736,23 +736,20 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
         Recalculate the horizontal scrollbar depending on the timeline duration.
         """
         timeline_ui_width = self.embed.get_allocation().width
-        controls_width = 0
-        scrollbar_width = 0
         if self.bTimeline is None:
             contents_size = 0
         else:
             contents_size = Zoomable.nsToPixel(self.bTimeline.props.duration)
 
-        widgets_width = controls_width + scrollbar_width
-        end_padding = CONTROL_WIDTH + 250  # Provide some space for clip insertion at the end
+        end_padding = CONTROL_WIDTH * 2  # Provide some space for clip insertion at the end
 
         self.hadj.props.lower = 0
-        self.hadj.props.upper = contents_size + widgets_width + end_padding
+        self.hadj.props.upper = contents_size + end_padding
         self.hadj.props.page_size = timeline_ui_width
         self.hadj.props.page_increment = contents_size * 0.9
         self.hadj.props.step_increment = contents_size * 0.1
 
-        if contents_size + widgets_width <= timeline_ui_width:
+        if contents_size <= timeline_ui_width:
             # We're zoomed out completely, re-enable automatic zoom fitting
             # when adding new clips.
             self.log("Setting 'zoomed_fitted' to True")
@@ -892,7 +889,8 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
 
         min_height = (self.ruler.get_size_request()[1] +
                       (EXPANDED_SIZE + SPACING) * 2 +
-                      SPACING * 3)
+                      # Some more.
+                      EXPANDED_SIZE)
         self.set_size_request(-1, min_height)
 
     def enableKeyboardAndMouseEvents(self):
@@ -999,10 +997,10 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
             "space", _("Start Playback"), self._playPauseCb),
 
             ("Split", "pitivi-split", _("Split"),
-            "S", SPLIT, self._split),
+            "S", SPLIT, self._splitCb),
 
             ("Keyframe", "pitivi-keyframe", _("Add a Keyframe"),
-            "K", KEYFRAME, self._keyframe),
+            "K", KEYFRAME, self._keyframeCb),
 
             ("Prevkeyframe", None, _("_Previous Keyframe"),
             "comma", PREVKEYFRAME, self._previousKeyframeCb),
@@ -1195,7 +1193,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
             self.error("Could not start the autoaligner: %s" % e)
             progress_dialog.window.destroy()
 
-    def _split(self, action):
+    def _splitCb(self, action):
         """
         If clips are selected, split them at the current playhead position.
         Otherwise, split all clips at the playhead position.
@@ -1219,11 +1217,9 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
                 clip = element.get_parent()
                 clip.split(position)
 
-    def _keyframe(self, action):
+    def _keyframeCb(self, action):
         """
         Add or remove a keyframe at the current position of the selected clip.
-
-        FIXME GES: this method is currently not used anywhere
         """
         selected = self.timeline.selection.getSelectedTrackElements()
 
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index f9d83bf..0c8fb45 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -57,7 +57,7 @@ CONTROL_WIDTH = 250
 PADDING = 6
 SPACING = 10
 
-PLAYHEAD_WIDTH = 2
+PLAYHEAD_WIDTH = 1
 CANVAS_SPACING = 21
 KEYFRAME_SIZE = 8
 


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