From 9b44635e3cc29f18c9bb42751ee63a023b0408cc Mon Sep 17 00:00:00 2001 From: ThomasV <thomasv@electrum.org> Date: Sun, 13 Dec 2015 17:36:23 +0100 Subject: [PATCH] kivy: make tabs one third of screen width and fix tabs scrolling --- gui/kivy/main.kv | 2 ++ gui/kivy/uix/screens.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv index 4caeaaa22..3bcc56f55 100644 --- a/gui/kivy/main.kv +++ b/gui/kivy/main.kv @@ -244,6 +244,7 @@ <TabbedPanelStrip>: on_parent: if self.parent: self.parent.bar_width = 0 + if self.parent: self.parent.scroll_x = 0.5 <TabbedCarousel> @@ -297,6 +298,7 @@ TabbedCarousel: id: panel tab_height: '48dp' + tab_width: panel.width/3 default_tab: history_tab strip_border: 0, 0, 0, 0 InvoicesScreen: diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py index 9f11b557d..89707589a 100644 --- a/gui/kivy/uix/screens.py +++ b/gui/kivy/uix/screens.py @@ -471,14 +471,18 @@ class TabbedCarousel(Factory.TabbedPanel): return idx = self.tab_list.index(value) n = len(self.tab_list) - scroll_x = 1. * (n - idx - 1) / (n - 1) + if idx in [0, 1]: + scroll_x = 1 + elif idx in [n-1, n-2]: + scroll_x = 0 + else: + scroll_x = 1. * (n - idx - 1) / (n - 1) + mation = Factory.Animation(scroll_x=scroll_x, d=.25) mation.cancel_all(scrlv) mation.start(scrlv) def on_current_tab(self, instance, value): - if value.text == 'default_tab': - return self.animate_tab_to_center(value) def on_index(self, instance, value):