From 2b768c666ef8378c130103a4a85121ab8f0d71e6 Mon Sep 17 00:00:00 2001 From: Daniel Gretzke Date: Sun, 8 Sep 2019 20:56:30 +0200 Subject: [PATCH] fixed scrolling --- plug_py/plug.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plug_py/plug.py b/plug_py/plug.py index 9da7f2b..807568d 100644 --- a/plug_py/plug.py +++ b/plug_py/plug.py @@ -24,7 +24,7 @@ from json import JSONDecodeError import credentials -DEBUG = True +DEBUG = False # credentials nodeAddr = credentials.nodeAddr @@ -103,8 +103,6 @@ def __init__(self, parent=None): item.setFlags(item.flags() & Qt.NoItemFlags) self.ui.hourList.addItem(item) - print('__________\nHeight: ' + str(self.ui.hourList.height()) + '\n\n') - # set list selection handler self.ui.hourList.setCurrentRow(2) self.hourTrigger = self.ui.hourList.verticalScrollBar( @@ -140,12 +138,11 @@ def __init__(self, parent=None): self.ui.hourList.viewport(), QScroller.LeftMouseButtonGesture) def updateHourList(self, position): - print(position) numItems = 23 - max = 645 + max = 646 position = round(position*numItems/max) - # self.ui.hourList.setCurrentRow(position+2) - # self.ui.hourList.verticalScrollBar().setValue(position*max/numItems) + self.ui.hourList.setCurrentRow(position+2) + self.ui.hourList.verticalScrollBar().setValue(position*max/numItems) if position == 0: self.ui.hourLabel.setText("hour") else: