from Qt import QtCore, QtGui, QtWidgets

from settings_manager.setting import Setting
from settings_manager.ui.setting_widgets.setting_ui import SettingUI


class BoolSetting(QtWidgets.QCheckBox, SettingUI):
    def __init__(self, setting=None, parent=None):
        # type: (Setting, QtWidgets.QWidget) -> None
        super(BoolSetting, self).__init__(parent)
        SettingUI.__init__(self, setting)
        self.stateChanged.connect(self.onValueChanged)

    def setValue(self, value):
        # type: (QtCore.Qt.CheckState|bool) -> None
        if isinstance(value, bool):
            value = QtCore.Qt.Checked if value else QtCore.Qt.Unchecked
        self.setCheckState(value)

    def value(self):
        # type: () -> QtCore.Qt.CheckState
        return self.checkState()

    def onValueChanged(self, value):
        # type: (QtCore.Qt.CheckState) -> None
        value = True if value == QtCore.Qt.Checked else False
        super(BoolSetting, self).onValueChanged(value)

f5f9c1f6274d279b947e82daf09c96c86c92b817
<mask token>


class BoolSetting(QtWidgets.QCheckBox, SettingUI):

    def __init__(self, setting=None, parent=None):
        super(BoolSetting, self).__init__(parent)
        SettingUI.__init__(self, setting)
        self.stateChanged.connect(self.onValueChanged)

    def setValue(self, value):
        if isinstance(value, bool):
            value = QtCore.Qt.Checked if value else QtCore.Qt.Unchecked
        self.setCheckState(value)
    <mask token>
    <mask token>

<mask token>


class BoolSetting(QtWidgets.QCheckBox, SettingUI):

    def __init__(self, setting=None, parent=None):
        super(BoolSetting, self).__init__(parent)
        SettingUI.__init__(self, setting)
        self.stateChanged.connect(self.onValueChanged)

    def setValue(self, value):
        if isinstance(value, bool):
            value = QtCore.Qt.Checked if value else QtCore.Qt.Unchecked
        self.setCheckState(value)

    def value(self):
        return self.checkState()
    <mask token>

<mask token>


class BoolSetting(QtWidgets.QCheckBox, SettingUI):

    def __init__(self, setting=None, parent=None):
        super(BoolSetting, self).__init__(parent)
        SettingUI.__init__(self, setting)
        self.stateChanged.connect(self.onValueChanged)

    def setValue(self, value):
        if isinstance(value, bool):
            value = QtCore.Qt.Checked if value else QtCore.Qt.Unchecked
        self.setCheckState(value)

    def value(self):
        return self.checkState()

    def onValueChanged(self, value):
        value = True if value == QtCore.Qt.Checked else False
        super(BoolSetting, self).onValueChanged(value)

from Qt import QtCore, QtGui, QtWidgets
from settings_manager.setting import Setting
from settings_manager.ui.setting_widgets.setting_ui import SettingUI


class BoolSetting(QtWidgets.QCheckBox, SettingUI):

    def __init__(self, setting=None, parent=None):
        super(BoolSetting, self).__init__(parent)
        SettingUI.__init__(self, setting)
        self.stateChanged.connect(self.onValueChanged)

    def setValue(self, value):
        if isinstance(value, bool):
            value = QtCore.Qt.Checked if value else QtCore.Qt.Unchecked
        self.setCheckState(value)

    def value(self):
        return self.checkState()

    def onValueChanged(self, value):
        value = True if value == QtCore.Qt.Checked else False
        super(BoolSetting, self).onValueChanged(value)

from Qt import QtCore, QtGui, QtWidgets

from settings_manager.setting import Setting
from settings_manager.ui.setting_widgets.setting_ui import SettingUI


class BoolSetting(QtWidgets.QCheckBox, SettingUI):
    def __init__(self, setting=None, parent=None):
        # type: (Setting, QtWidgets.QWidget) -> None
        super(BoolSetting, self).__init__(parent)
        SettingUI.__init__(self, setting)
        self.stateChanged.connect(self.onValueChanged)

    def setValue(self, value):
        # type: (QtCore.Qt.CheckState|bool) -> None
        if isinstance(value, bool):
            value = QtCore.Qt.Checked if value else QtCore.Qt.Unchecked
        self.setCheckState(value)

    def value(self):
        # type: () -> QtCore.Qt.CheckState
        return self.checkState()

    def onValueChanged(self, value):
        # type: (QtCore.Qt.CheckState) -> None
        value = True if value == QtCore.Qt.Checked else False
        super(BoolSetting, self).onValueChanged(value)
