From f97ae0a02b149f19ef5d96dbdb55f0dbc8f45815 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Mon, 1 Jul 2019 20:52:51 +0200 Subject: [PATCH] Config: properly handle loading bool datatype Signed-off-by: Juraj Oravec --- config/config.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/config.py b/config/config.py index a5a0b34..9d90093 100644 --- a/config/config.py +++ b/config/config.py @@ -66,7 +66,7 @@ class {{ name }}{% if base_classes %}({% for inh in base_classes %}{{ inh.baseTy settings.beginGroup("{% if settings_group_name %}{{ settings_group_name }}{% else %}{{ name }}{% endif %}") {% for member in members %} - self.{{ member.name }} = {{ member.type }}(settings.value("{{ member.name }}", self.{{ member.name }})) + self.{{ member.name }} = {% if member.type == "bool" %}self._{% endif %}{{ member.type }}(settings.value("{{ member.name }}", self.{{ member.name }})) {% endfor %} settings.endGroup() @@ -118,3 +118,11 @@ class {{ name }}{% if base_classes %}({% for inh in base_classes %}{{ inh.baseTy self.{{ member.name }}Changed.emit({{ member.name }}) {% endfor %} + + + {% if include_load_save %} + + def _bool(self, value): + return value == "true" + + {% endif %}