From 46c0a6ba12de70fbfa1b2139089c205e35d2b04c Mon Sep 17 00:00:00 2001
From: "benjamin.jakimow" <benjamin.jakimow@geo.hu-berlin.de>
Date: Tue, 23 Feb 2016 21:16:06 +0100
Subject: [PATCH] improved scrolling

---
 sensecarbon_tsv.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/sensecarbon_tsv.py b/sensecarbon_tsv.py
index a8dc4f28..b7904b35 100644
--- a/sensecarbon_tsv.py
+++ b/sensecarbon_tsv.py
@@ -1673,9 +1673,10 @@ class SenseCarbon_TSV:
         else:
             i_doi = date_of_interest
 
-        scrollValue = int(float(i_doi+1) / len(TSDs) * HBar.maximum())
-
-        HBar.setValue(scrollValue)
+        step = int(float(HBar.maximum()) / (len(TSDs)+1))
+        HBar.setSingleStep(step)
+        HBar.setPageStep(step*5)
+        HBar.setValue(i_doi * step)
 
 
     def ua_showPxCoordinate_start(self):
@@ -1712,12 +1713,12 @@ class SenseCarbon_TSV:
 
         #get the dates of interes
         dates_of_interest = list()
-        centerTSD = D.cb_doi.itemData(D.cb_doi.currentIndex())
-        if centerTSD is None:
+        doiTSD = D.cb_doi.itemData(D.cb_doi.currentIndex())
+        if doiTSD is None:
             idx = int(len(self.TS)/2)
-            centerTSD = D.cb_doi.itemData(idx)
+            doiTSD = D.cb_doi.itemData(idx)
             D.cb_doi.setCurrentIndex(idx)
-        centerDate = centerTSD.getDate()
+        centerDate = doiTSD.getDate()
         allDates = self.TS.getObservationDates()
         i_doi = allDates.index(centerDate)
 
@@ -1782,6 +1783,8 @@ class SenseCarbon_TSV:
 
                 cnt_chips += 1
 
+        self.dlg.scrollArea_imageChip_content.update()
+
         self.scrollToDate(centerDate)
 
         s = ""
-- 
GitLab