From e69d6917662073d97c55fcd39e9f91e3e0f84a13 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 13 Dec 2021 12:03:59 -0300 Subject: [PATCH] [view] fix: crashing when using floats for spinner components --- CHANGELOG.md | 1 + bauh/api/abstract/view.py | 4 ++-- bauh/view/core/settings.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 618986de..35858b89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixes - UI - crashing when resizing with floats instead of integers [#216](https://github.com/vinifmor/bauh/issues/216) + - crashing when using floats for spinner components [#217](https://github.com/vinifmor/bauh/issues/217) ## [0.9.23] 2021-12-10 ### Features diff --git a/bauh/api/abstract/view.py b/bauh/api/abstract/view.py index 35102601..8a0263f3 100644 --- a/bauh/api/abstract/view.py +++ b/bauh/api/abstract/view.py @@ -289,8 +289,8 @@ class TabGroupComponent(ViewComponent): class RangeInputComponent(InputViewComponent): - def __init__(self, id_: str, label: str, tooltip: str, min_value: float, max_value: float, - step_value: float, value: float = None, max_width: int = None): + def __init__(self, id_: str, label: str, tooltip: str, min_value: int, max_value: int, + step_value: int, value: Optional[int] = None, max_width: int = None): super(RangeInputComponent, self).__init__(id_=id_) self.label = label self.tooltip = tooltip diff --git a/bauh/view/core/settings.py b/bauh/view/core/settings.py index 4244070b..88820a55 100644 --- a/bauh/view/core/settings.py +++ b/bauh/view/core/settings.py @@ -208,7 +208,7 @@ class GenericSettingsManager: select_scale = RangeInputComponent(id_="scalef", label=self.i18n['core.config.ui.scale_factor'] + ' (%)', tooltip=self.i18n['core.config.ui.scale_factor.tip'], - min_value=100, max_value=400, step_value=5, value=scale * 100, + min_value=100, max_value=400, step_value=5, value=int(scale * 100), max_width=default_width) cur_style = QApplication.instance().property('qt_style') if not core_config['ui']['qt_style'] else core_config['ui']['qt_style']