diff --git a/ks_includes/functions.py b/ks_includes/functions.py index 6053b9ea..1160c10a 100644 --- a/ks_includes/functions.py +++ b/ks_includes/functions.py @@ -100,6 +100,10 @@ def get_software_version(): return "?" +def parse_bool(value): + return value.lower() == "true" + + def patch_threading_excepthook(): """Installs our exception handler into the threading modules Thread object Inspired by https://bugs.python.org/issue1230540 diff --git a/panels/pins.py b/panels/pins.py index 55e7ce72..6f641994 100644 --- a/panels/pins.py +++ b/panels/pins.py @@ -4,6 +4,7 @@ import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk, GLib, Pango from ks_includes.screen_panel import ScreenPanel +from ks_includes.functions import parse_bool class Panel(ScreenPanel): @@ -40,7 +41,7 @@ class Panel(ScreenPanel): self.devices[pin] = {} section = self._printer.get_config_section(pin) - if section.get('pwm') or section.get('hardware_pwm'): + if parse_bool(section.get('pwm', 'false')) or parse_bool(section.get('hardware_pwm', 'false')): scale = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, min=0, max=100, step=1) scale.set_value(self.check_pin_value(pin)) scale.set_digits(0)