Skip to content

Commit

Permalink
fix settings sliders snapping to rounded values
Browse files Browse the repository at this point in the history
  • Loading branch information
mjfrisby committed Jan 12, 2024
1 parent ca9b5a4 commit 4cf69fd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3788,10 +3788,11 @@ def generate_settings_row(self, item, i, rowdisabled=False):
# print(f"label {value_label.objectName()} for slider {slider.objectName()}")
factor = float(item['sliderfactor'])
if '%' in item['value']:
pctval = int(item['value'].replace('%', ''))
val = float(item['value'].replace('%', '')) / 100
else:
pctval = int(float(item['value']) * 100)
pctval = int(round(pctval / factor))
val = float(item['value'])

pctval = int((val / factor) * 100)
if self.show_slider_debug:
logging.debug(f"read value: {item['value']} factor: {item['sliderfactor']} slider: {pctval}")
slider.blockSignals(True)
Expand Down

0 comments on commit 4cf69fd

Please sign in to comment.