Skip to content

Commit

Permalink
Fix 'float' to 'int' conversion, formatting (#226).
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoCeruti committed Dec 18, 2021
1 parent 9447719 commit b462a07
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lisp/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with Linux Show Player. If not, see <http://www.gnu.org/licenses/>.

from abc import abstractmethod
from collections import Sized, Iterable, Container
from collections.abc import Sized, Iterable, Container

from lisp.core.signal import Signal

Expand Down
2 changes: 1 addition & 1 deletion lisp/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import re
import socket
from collections import Mapping
from collections.abc import Mapping
from enum import Enum
from os import listdir
from os.path import isdir, exists, join
Expand Down
2 changes: 1 addition & 1 deletion lisp/layouts/list_layout/listwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _update_duration(self, duration):
self.setTextVisible(True)
self.setFormat(strtime(duration, accurate=self.accurate_time))
# Avoid settings min and max to 0, or the the bar go in busy state
self.setRange(0 if duration > 0 else -1, duration)
self.setRange(0 if duration > 0 else -1, int(duration))
else:
self.setTextVisible(False)

Expand Down
2 changes: 1 addition & 1 deletion lisp/modules/action_cues/volume_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def get_settings(self):
if not (checkable and not self.volumeGroup.isCheckable()):
conf['volume'] = self.volumeEdit.value() / 100
if not (checkable and not self.fadeGroup.isCheckable()):
conf['duration'] = self.fadeEdit.duration() * 1000
conf['duration'] = int(self.fadeEdit.duration() * 1000)
conf['fade_type'] = self.fadeEdit.fadeType()

return conf
Expand Down
2 changes: 1 addition & 1 deletion lisp/modules/gst_backend/settings/audio_pan.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_settings(self):
return {}

def load_settings(self, settings):
self.panSlider.setValue(settings.get('pan', 0.5) * 10)
self.panSlider.setValue(int(settings.get('pan', 0.5) * 10))

def pan_changed(self, value):
if value < 0:
Expand Down
4 changes: 2 additions & 2 deletions lisp/modules/gst_backend/settings/db_meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def retranslateUi(self):
translate('DbMeterSettings', 'Peak falloff (dB/sec)'))

def load_settings(self, settings):
self.intervalSpin.setValue(settings.get('interval', 50) / Gst.MSECOND)
self.ttlSpin.setValue(settings.get('peak_ttl', 500) / Gst.MSECOND)
self.intervalSpin.setValue(settings.get('interval', 50) // Gst.MSECOND)
self.ttlSpin.setValue(settings.get('peak_ttl', 500) // Gst.MSECOND)
self.falloffSpin.setValue(settings.get('peak_falloff', 20))

def get_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion lisp/modules/gst_backend/settings/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_settings(self):
return {}

def load_settings(self, settings):
self.speedSlider.setValue(settings.get('speed', 1) * 100)
self.speedSlider.setValue(int(settings.get('speed', 1) * 100))

def speedChanged(self, value):
self.speedLabel.setText(str(value / 100.0))
2 changes: 1 addition & 1 deletion lisp/modules/gst_backend/settings/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def get_settings(self):
return settings

def load_settings(self, settings):
self.volume.setValue(linear_to_db(settings.get('volume', 1)) * 10)
self.volume.setValue(int(linear_to_db(settings.get('volume', 1)) * 10))
self.muteButton.setMute(settings.get('mute', False))
self.normal = settings.get('normal_volume', 1)
self.normalLabel.setText(
Expand Down
2 changes: 1 addition & 1 deletion lisp/ui/widgets/qclickslider.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def mousePressEvent(self, e):
value += e.x() * (zmax / self.width())

if self.value() != value:
self.setValue(value)
self.setValue(round(value))
self.sliderJumped.emit(self.value())
e.accept()
else:
Expand Down
8 changes: 4 additions & 4 deletions lisp/ui/widgets/qdbmeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,25 @@ def paintEvent(self, e):

for n, (peak, rms, dPeak) in enumerate(zip(peaks, rmss, dPeaks)):
# Maximum "peak-rect" size
maxRect = QtCore.QRect(xpos, self.height() - 2, xdim - 2,
maxRect = QtCore.QRectF(xpos, self.height() - 2, xdim - 2,
2 - self.height())

# Set QLinearGradient start and final-stop position
self.grad.setStart(maxRect.topLeft())
self.grad.setFinalStop(maxRect.bottomRight())

# Draw peak (audio peak in dB)
rect = QtCore.QRect(xpos, self.height() - 2, xdim - 2, -peak)
rect = QtCore.QRectF(xpos, self.height() - 2, xdim - 2, -peak)
qp.setOpacity(0.6)
qp.fillRect(rect, self.grad)
qp.setOpacity(1.0)

# Draw rms (in db)
rect = QtCore.QRect(xpos, self.height() - 2, xdim - 2, -rms)
rect = QtCore.QRectF(xpos, self.height() - 2, xdim - 2, -rms)
qp.fillRect(rect, self.grad)

# Draw decay peak
decRect = QtCore.QRect(xpos, (self.height() - 3) - dPeak,
decRect = QtCore.QRectF(xpos, (self.height() - 3) - dPeak,
xdim - 2, 2)
qp.fillRect(decRect, self.grad)

Expand Down

0 comments on commit b462a07

Please sign in to comment.