Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for waterfall bug that was encountered #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions qspectrumanalyzer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ def update_progress(self, value):
elif value > value_max:
value = value_max
else:
self.progressbar.setRange(0, value_max)
self.progressbar.setRange(0, int(value_max))

self.progressbar.setValue(value)
self.progressbar.setValue(int(value))

def on_power_thread_started(self):
"""Update buttons state when power thread is started"""
Expand All @@ -300,7 +300,7 @@ def start(self, single_shot=False):
self.start_timestamp = self.prev_data_timestamp

if self.intervalSpinBox.value() >= 1:
self.progressbar.setRange(0, self.intervalSpinBox.value() * 1000)
self.progressbar.setRange(0, int(self.intervalSpinBox.value() * 1000))
else:
self.progressbar.setRange(0, 0)
self.update_progress(0)
Expand Down
8 changes: 6 additions & 2 deletions qspectrumanalyzer/plot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import collections, math

from Qt import QtCore
from Qt import QtCore, QtGui

import pyqtgraph as pg

# Basic PyQtGraph settings
Expand Down Expand Up @@ -310,8 +311,11 @@ def update_plot(self, data_storage):

# Create waterfall image on first run
if self.counter == 1:
tr = QtGui.QTransform()
tr.scale((data_storage.x[-1] - data_storage.x[0]) / len(data_storage.x), 1)

self.waterfallImg = pg.ImageItem()
self.waterfallImg.scale((data_storage.x[-1] - data_storage.x[0]) / len(data_storage.x), 1)
self.waterfallImg.setTransform(tr)
self.plot.clear()
self.plot.addItem(self.waterfallImg)

Expand Down