Skip to content

Commit

Permalink
Convert slider inputs to integer;
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesema authored Jul 11, 2024
1 parent 191b674 commit e1f1403
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions pyapr/utils/filegui.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ def setValue(self, value):
super(DoubleSlider, self).setValue(int(value * self._multi))

def setMinimum(self, value):
return super(DoubleSlider, self).setMinimum(value * self._multi)
# Convert the result to an integer to comply with the expected type
int_value = int(value * self._multi)
return super(DoubleSlider, self).setMinimum(int_value)

def setMaximum(self, value):
return super(DoubleSlider, self).setMaximum(value * self._multi)
# Convert the result to an integer to comply with the expected type
int_value = int(value * self._multi)
return super(DoubleSlider, self).setMaximum(int_value)

def setSingleStep(self, value):
return super(DoubleSlider, self).setSingleStep(value * self._multi)
# Convert the result to an integer to comply with the expected type
int_value = int(value * self._multi)
return super(DoubleSlider, self).setSingleStep(int_value)

def singleStep(self):
return float(super(DoubleSlider, self).singleStep()) / self._multi
Expand Down Expand Up @@ -116,7 +122,7 @@ def __init__(self, slider_decimals=0):

self.slider.valueChanged.connect(self.valuechange)

self.setGeometry(300, 300, self.full_size, self.full_size)
self.setGeometry(int(300), int(300), self.full_size, self.full_size)

self.layout.addWidget(self.slider, 1, 0)

Expand Down Expand Up @@ -352,7 +358,7 @@ def set_image(self, img, converter):
self.slider.setMinimum(0)
self.slider.setMaximum(self.z_num - 1)
self.slider.setTickPosition(QtWidgets.QSlider.TicksBothSides)
self.slider.setGeometry(0.05 * self.full_size, 0.97 * self.full_size, 0.95 * self.full_size, 40)
self.slider.setGeometry(int(0.05 * self.full_size), int(0.97 * self.full_size), int(0.95 * self.full_size), int(40))

self.setLUT('viridis')

Expand Down
2 changes: 1 addition & 1 deletion pyapr/viewer/compressInteractive.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self):
self.slider_q.move(200, 70)
self.slider_q.connectSlider(self.valuechangeQ)
self.slider_q.maxBox.setValue(20)
self.slider_q.slider.setSingleStep(0.1)
self.slider_q.slider.setSingleStep(int(1))

self.slider_B = CustomSlider(self, "background")
self.slider_B.move(200, 100)
Expand Down

0 comments on commit e1f1403

Please sign in to comment.