Skip to content

Commit

Permalink
fixed scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Gretzke committed Sep 8, 2019
1 parent 6b43ebf commit 2b768c6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions plug_py/plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from json import JSONDecodeError
import credentials

DEBUG = True
DEBUG = False

# credentials
nodeAddr = credentials.nodeAddr
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2b768c6

Please sign in to comment.