[pitivi] timeline: Fix the scrollbars alignment by using Gtk.Grid
- From: Mathieu Duponchelle <mathieudu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Fix the scrollbars alignment by using Gtk.Grid
- Date: Tue, 4 Feb 2014 21:52:07 +0000 (UTC)
commit cb89963b7f4c98e41947410690f44c2c7931d821
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Jan 7 17:32:17 2014 +0100
timeline: Fix the scrollbars alignment by using Gtk.Grid
pitivi/timeline/timeline.py | 57 ++++++++++++++---------------------
tests/dogtail_scripts/test_base.py | 5 ++-
2 files changed, 26 insertions(+), 36 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index c2b37c0..d7f6c33 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -692,14 +692,13 @@ def quit2_(*args, **kwargs):
Gtk.main_quit()
-class Timeline(Gtk.VBox, Zoomable, Loggable):
+class Timeline(Gtk.Grid, Zoomable, Loggable):
"""
- This is the main timeline widget, which will contain the timeline stage
- and the layer controls, the scrollbars and the ruler.
+ Container for zoom box, ruler, the actual timeline layers and scrollbars.
"""
def __init__(self, gui, instance, ui_manager):
Zoomable.__init__(self)
- Gtk.VBox.__init__(self)
+ Gtk.Grid.__init__(self)
Loggable.__init__(self)
if not at_least_version(gi.version_info, (3, 11, 0)):
GObject.threads_init()
@@ -911,12 +910,30 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
self.zoomed_fitted = True
self.pressed = False
- self._packScrollbars(self)
+ self.hadj = Gtk.Adjustment()
+ self.vadj = Gtk.Adjustment()
+ self.hadj.connect("value-changed", self._updateScrollPosition)
+ self.vadj.connect("value-changed", self._updateScrollPosition)
+ self.vadj.props.lower = 0
+ self.vadj.props.page_size = 250
+ self._vscrollbar = Gtk.VScrollbar(adjustment=self.vadj)
+ self._hscrollBar = Gtk.HScrollbar(adjustment=self.hadj)
+
+ self.ruler = ScaleRuler(self, self.hadj)
+ self.ruler.props.hexpand = True
+ self.ruler.setProjectFrameRate(24.)
+ self.ruler.hide()
+
+ self.attach(self.zoomBox, 0, 0, 1, 1)
+ self.attach(self.ruler, 1, 0, 1, 1)
+ self.attach(self.embed, 0, 1, 2, 1)
+ self.attach(self._vscrollbar, 2, 1, 1, 1)
+ self.attach(self._hscrollBar, 1, 2, 1, 1)
+
min_height = (self.ruler.get_size_request()[1] +
(EXPANDED_SIZE + SPACING) * 2 +
SPACING * 3)
self.set_size_request(-1, min_height)
- self.stage.show()
def enableKeyboardAndMouseEvents(self):
self.info("Unblocking timeline mouse and keyboard signals")
@@ -1051,34 +1068,6 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
self.ui_manager.add_ui_from_string(ui)
- def _packScrollbars(self, vbox):
- self.hadj = Gtk.Adjustment()
- self.vadj = Gtk.Adjustment()
- self._vscrollbar = Gtk.VScrollbar(adjustment=self.vadj)
- self._hscrollBar = Gtk.HScrollbar(adjustment=self.hadj)
- self.ruler = ScaleRuler(self, self.hadj)
-
- self.hadj.connect("value-changed", self._updateScrollPosition)
- self.vadj.connect("value-changed", self._updateScrollPosition)
-
- vbox.pack_end(self._hscrollBar, False, True, False)
-
- self.ruler.setProjectFrameRate(24.)
- self.ruler.hide()
-
- self.vadj.props.lower = 0
- self.vadj.props.page_size = 250
-
- hbox = Gtk.HBox()
- hbox.pack_start(self.embed, True, True, True)
- hbox.pack_start(self._vscrollbar, False, True, False)
- vbox.pack_end(hbox, True, True, True)
-
- hbox = Gtk.HBox()
- hbox.pack_start(self.zoomBox, False, True, False)
- hbox.pack_start(self.ruler, True, True, True)
- vbox.pack_end(hbox, False, True, False)
-
def _updateScrollPosition(self, adjustment):
self._scroll_pos_ns = Zoomable.pixelToNs(self.hadj.get_value())
point = Clutter.Point()
diff --git a/tests/dogtail_scripts/test_base.py b/tests/dogtail_scripts/test_base.py
index 4dc1836..c0ac312 100644
--- a/tests/dogtail_scripts/test_base.py
+++ b/tests/dogtail_scripts/test_base.py
@@ -49,8 +49,9 @@ class BaseDogTail(unittest.TestCase):
self.transitions = secondary_tabs.children[0]
self.titles = secondary_tabs.children[0]
self.viewer = mainwindow_upper.child(name="viewer", recursive=False)
- self.zoom_best_fit_button = mainwindow_lower.children[0].children[0].button("Zoom")
- self.timeline = mainwindow_lower.children[0].children[1].child(name="timeline canvas",
recursive=False)
+ self.timeline_ui = mainwindow_lower.child(name="timeline ui", recursive=False)
+ self.zoom_best_fit_button = self.timeline_ui.child(name="Zoom", recursive=True)
+ self.timeline = self.timeline_ui.child(name="timeline canvas", recursive=False)
self.timeline_toolbar = mainwindow_lower.child(name="timeline toolbar", recursive=False)
# Used to speed up helper_functions in particular:
self.import_button = self.medialibrary.child(name="media_import_button")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]