[pitivi] timeline: Show vertical scrollbar only when needed
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Show vertical scrollbar only when needed
- Date: Tue, 18 Dec 2018 22:22:24 +0000 (UTC)
commit beb3cce31305f3a66d2ae1fe6031fb6f4d4cf871
Author: Harish Fulara <harish14143 iiitd ac in>
Date: Sun Mar 18 03:05:01 2018 +0530
timeline: Show vertical scrollbar only when needed
Fixes #1811
pitivi/timeline/timeline.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index c92ce538..1ef1fbfa 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1353,6 +1353,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.app.project_manager.connect("new-project-loaded",
self._projectLoadedCb)
+ self.timeline.connect("size-allocate", self.__timeline_size_allocate_cb)
# Public API
@@ -1499,9 +1500,11 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.timeline = Timeline(self.app, left_size_group)
- vscrollbar = Gtk.Scrollbar(orientation=Gtk.Orientation.VERTICAL,
- adjustment=self.timeline.vadj)
- vscrollbar.get_style_context().add_class("background")
+ # Vertical Scrollbar. It will be displayed only when needed.
+ self.vscrollbar = Gtk.Scrollbar(orientation=Gtk.Orientation.VERTICAL,
+ adjustment=self.timeline.vadj)
+ self.vscrollbar.get_style_context().add_class("background")
+
hscrollbar = Gtk.Scrollbar(orientation=Gtk.Orientation.HORIZONTAL,
adjustment=self.timeline.hadj)
hscrollbar.get_style_context().add_class("background")
@@ -1522,7 +1525,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.attach(zoom_box, 0, 0, 1, 1)
self.attach(self.ruler, 1, 0, 1, 1)
self.attach(self.timeline, 0, 1, 2, 1)
- self.attach(vscrollbar, 2, 1, 1, 1)
+ self.attach(self.vscrollbar, 2, 1, 1, 1)
self.attach(hscrollbar, 1, 2, 1, 1)
self.attach(self.toolbar, 3, 1, 1, 1)
@@ -1946,6 +1949,10 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self._framerate = videorate
self.ruler.setProjectFrameRate(self._framerate)
+ def __timeline_size_allocate_cb(self, unused_widget, allocation):
+ fits = self.timeline.layout.props.height <= allocation.height
+ self.vscrollbar.set_opacity(0 if fits else 1)
+
def _projectLoadedCb(self, unused_project_manager, project):
"""Connects to the project's timeline and pipeline."""
if self._project:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]