[pitivi] ruler: Empty rhombus for the playhead top
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] ruler: Empty rhombus for the playhead top
- Date: Tue, 19 Apr 2016 20:02:07 +0000 (UTC)
commit 4a648a6de47d5f791f07998d7aca77ca1a12ac80
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Apr 19 21:49:34 2016 +0200
ruler: Empty rhombus for the playhead top
Differential Revision: https://phabricator.freedesktop.org/D915
data/pixmaps/Makefile.am | 1 -
data/pixmaps/pitivi-playhead.svg | 4132 --------------------------------------
pitivi/timeline/ruler.py | 36 +-
3 files changed, 21 insertions(+), 4148 deletions(-)
---
diff --git a/data/pixmaps/Makefile.am b/data/pixmaps/Makefile.am
index e2ee623..0c6df36 100644
--- a/data/pixmaps/Makefile.am
+++ b/data/pixmaps/Makefile.am
@@ -11,7 +11,6 @@ pixmap_DATA = \
pitivi-advanced-16.png \
pitivi-advanced-22.png \
pitivi-advanced-24.png \
- pitivi-playhead.svg \
pitivi-render-16.png \
pitivi-render-22.png \
pitivi-render-24.png \
diff --git a/pitivi/timeline/ruler.py b/pitivi/timeline/ruler.py
index 246c42e..7f3cb2b 100644
--- a/pitivi/timeline/ruler.py
+++ b/pitivi/timeline/ruler.py
@@ -20,16 +20,13 @@
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
-import os
from gettext import gettext as _
import cairo
from gi.repository import Gdk
-from gi.repository import GdkPixbuf
from gi.repository import Gst
from gi.repository import Gtk
-from pitivi import configure
from pitivi.utils.loggable import Loggable
from pitivi.utils.timeline import Zoomable
from pitivi.utils.ui import beautify_length
@@ -124,9 +121,6 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
self.frame_rate = Gst.Fraction(1 / 1)
self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND
- self.playhead_pixbuf = GdkPixbuf.Pixbuf.new_from_file(
- os.path.join(configure.get_pixmap_dir(), "pitivi-playhead.svg"))
-
self.scales = SCALES
def _hadjValueChangedCb(self, unused_arg):
@@ -382,20 +376,32 @@ class ScaleRuler(Gtk.DrawingArea, Zoomable, Loggable):
frame_num += 1
def drawPosition(self, context):
+ """
+ Draw the top part of the playhead.
+
+ This should be in sync with the playhead drawn by the timeline.
+ See Timeline.__draw_playhead().
+ """
height = self.pixbuf.get_height()
+
+ semi_width = 4
+ semi_height = int(semi_width * 1.61803)
+ y = int(3 * height / 4)
+
# Add 0.5 so that the line center is at the middle of the pixel,
# without this the line appears blurry.
xpos = self.nsToPixel(self.position) - self.pixbuf_offset + 0.5
- context.set_line_width(PLAYHEAD_WIDTH)
set_cairo_color(context, PLAYHEAD_COLOR)
- context.move_to(xpos, height / 2)
+
+ context.set_line_width(PLAYHEAD_WIDTH)
+ context.move_to(xpos, y)
context.line_to(xpos, height)
context.stroke()
- playhead_width = self.playhead_pixbuf.props.width
- playhead_height = self.playhead_pixbuf.props.height
- xpos -= playhead_width / 2
- ypos = (height - playhead_height) / 2
- Gdk.cairo_set_source_pixbuf(context, self.playhead_pixbuf, xpos, ypos)
- context.rectangle(xpos, ypos, playhead_width, playhead_height)
- context.fill()
+ context.set_line_width(PLAYHEAD_WIDTH * 2)
+ context.move_to(xpos, y)
+ context.line_to(xpos + semi_width, y - semi_height)
+ context.line_to(xpos, y - semi_height * 2)
+ context.line_to(xpos - semi_width, y - semi_height)
+ context.close_path()
+ context.stroke()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]