Пример #1
0
    def __init__(self, parent, **params):
        get_or_put(params, 'i18n', 'time.units.group.title')
        get_or_put(params, 'i18n_def', 'Time units')
        get_or_put(params, 'layout', QHBoxLayout())
        self.default_unit = params.get('default_unit', Millisecond)
        super(TimeUnitsWidget, self).__init__(parent, **params)
        self.__unitsButtonsGroup__ = ButtonGroupWidget(self)
        self.__change_unit_handler__ = params.get('change_unit_handler', None)

        for time_unit in get_units_for_type(TimeUnit):
            unitCheckBox = CheckBoxWidget(self,
                                          i18n_def="%s [%s]" %
                                          (time_unit.name, time_unit.label))

            #add artificially property unit for later use in getUnit method
            unitCheckBox.unit = time_unit

            if time_unit == self.default_unit:
                unitCheckBox.setChecked(True)
            self.__unitsButtonsGroup__.addButton(unitCheckBox)

        self.connect(self.__unitsButtonsGroup__,
                     SIGNAL("buttonClicked(QAbstractButton *)"),
                     self.__buttonClicked__)
        self.__old_button_unit__ = None
Пример #2
0
    def __init__(self, parent, **params):
        get_or_put(params, 'i18n_def', 'Separator')
        self.params = Params(**params)
        self.separatorsGroupBox = GroupBoxWidget(parent,
                            i18n="separator.widget.group.title",
                            i18n_def=nvl(self.params.i18n_def, "Separator"),
                            layout=QVBoxLayout())

        self.predefinedSeparatorsComposite = CompositeWidget(
                                                    self.separatorsGroupBox,
                                                    layout=QHBoxLayout())
        self.predefinedSeparatorsButtonsGroup = ButtonGroupWidget(
                                            self.predefinedSeparatorsComposite)

        self.predefinedSeparatorsSpecs = Separator.getSeparatorsSpec(
                                                    separator_label_handler)
        for separatorSpec in self.predefinedSeparatorsSpecs:
            label = separatorSpec.label
            if not label == Separator.CUSTOM.label:  # @UndefinedVariable
                predefinedSeparatorCheckBox = CheckBoxWidget(
                                            self.predefinedSeparatorsComposite)
                #attach artificially a separatorSpec object used later in
                #def setSeparator(self, _separator) method
                predefinedSeparatorCheckBox.separator_spec = separatorSpec
                predefinedSeparatorCheckBox.setText(label)
                predefinedSeparatorCheckBox.sep_spec = separatorSpec
                if self.params.default_separator and \
                    separatorSpec.id_ == self.params.default_separator.id_:
                    predefinedSeparatorCheckBox.setChecked(True)
                self.predefinedSeparatorsButtonsGroup.addButton(
                                                predefinedSeparatorCheckBox)

        self.separatorsGroupBox.connect(self.predefinedSeparatorsButtonsGroup,
                                    SIGNAL("buttonClicked(QAbstractButton *)"),
                                    self.predefinedSeparatorButtonClicked)

        if not self.params.no_custom_separator == True:
            self.customSeparatorCheckBox = CheckBoxWidget(
                                        self.predefinedSeparatorsComposite,
                                        i18n="separator.custom.checkbox",
                                        i18n_def="Custom")
            self.customSeparatorCheckBox.sep_spec = Separator.CUSTOM
            self.separatorsGroupBox.connect(self.customSeparatorCheckBox,
                                        SIGNAL("clicked()"),
                                        self.customSeparatorButtonClicked)

            self.customSeparatorEdit = LineEditWidget(
                        self.predefinedSeparatorsComposite,
                        maxLength=15,
                        width=get_width_of_n_letters(14),
                        text_changed_handler=self.customSeparatorButtonClicked,
                        enabled=False)

        self.setEnabled(self.params.enabled)
    def __createAnnotationButtons__(self):

        self.__button_group__ = ButtonGroupWidget(self)

        unique_annotations0 = get_unique_annotations(
            self.data_accessor.annotation0)
        empty = is_empty(unique_annotations0)
        self.set_title(empty)
        self.__all_button__ = CheckBoxWidget(
            self, i18n_def='ALL', clicked_handler=self.__all_button_handler__)
        self.__button_group__.addButton(self.__all_button__)
        for unique_annotation in unique_annotations0:
            annotationCheckBox = CheckBoxWidget(
                self, i18n_def=str(unique_annotation))
            self.__button_group__.addButton(annotationCheckBox)

        self.__button_group__.setExclusive(False)
        self.__button_group__.connect(self.__button_group__,
                                      BUTTON_CLICKED_SIGNAL,
                                      self.__button_handler__)
Пример #4
0
class TimeUnitsWidget(GroupBoxWidget):
    def __init__(self, parent, **params):
        get_or_put(params, 'i18n', 'time.units.group.title')
        get_or_put(params, 'i18n_def', 'Time units')
        get_or_put(params, 'layout', QHBoxLayout())
        self.default_unit = params.get('default_unit', Millisecond)
        super(TimeUnitsWidget, self).__init__(parent, **params)
        self.__unitsButtonsGroup__ = ButtonGroupWidget(self)
        self.__change_unit_handler__ = params.get('change_unit_handler', None)

        for time_unit in get_units_for_type(TimeUnit):
            unitCheckBox = CheckBoxWidget(self,
                                          i18n_def="%s [%s]" %
                                          (time_unit.name, time_unit.label))

            #add artificially property unit for later use in getUnit method
            unitCheckBox.unit = time_unit

            if time_unit == self.default_unit:
                unitCheckBox.setChecked(True)
            self.__unitsButtonsGroup__.addButton(unitCheckBox)

        self.connect(self.__unitsButtonsGroup__,
                     SIGNAL("buttonClicked(QAbstractButton *)"),
                     self.__buttonClicked__)
        self.__old_button_unit__ = None

    def getUnit(self):
        unitCheckBox = self.__unitsButtonsGroup__.checkedButton()
        if unitCheckBox:
            return unitCheckBox.unit

    def addUnit(self, unit):
        unitCheckBox = CheckBoxWidget(self,
                                      i18n_def="%s [%s]" %
                                      (unit.name, unit.label))
        unitCheckBox.unit = unit
        if unit == self.default_unit:
            unitCheckBox.setChecked(True)
        self.__unitsButtonsGroup__.addButton(unitCheckBox)

    def __buttonClicked__(self, button):
        if not button.unit == self.__old_button_unit__:
            if not self.__change_unit_handler__ == None:
                self.__change_unit_handler__(button.unit)
        self.__old_button_unit__ = button.unit

    def setUnit(self, unit):
        """
        method which marks a button with an appropriate unit as checked
        """
        for button in self.__unitsButtonsGroup__.buttons():
            if button.unit.name == unit.name:
                button.setChecked(True)
Пример #5
0
class TimeUnitsWidget(GroupBoxWidget):

    def __init__(self, parent, **params):
        get_or_put(params, 'i18n', 'time.units.group.title')
        get_or_put(params, 'i18n_def', 'Time units')
        get_or_put(params, 'layout', QHBoxLayout())
        self.default_unit = params.get('default_unit', Millisecond)
        super(TimeUnitsWidget, self).__init__(parent, **params)
        self.__unitsButtonsGroup__ = ButtonGroupWidget(self)
        self.__change_unit_handler__ = params.get('change_unit_handler', None)

        for time_unit in get_units_for_type(TimeUnit):
            unitCheckBox = CheckBoxWidget(self,
                    i18n_def="%s [%s]" % (time_unit.name, time_unit.label))

            #add artificially property unit for later use in getUnit method
            unitCheckBox.unit = time_unit

            if time_unit == self.default_unit:
                unitCheckBox.setChecked(True)
            self.__unitsButtonsGroup__.addButton(unitCheckBox)

        self.connect(self.__unitsButtonsGroup__,
                    SIGNAL("buttonClicked(QAbstractButton *)"),
                    self.__buttonClicked__)
        self.__old_button_unit__ = None

    def getUnit(self):
        unitCheckBox = self.__unitsButtonsGroup__.checkedButton()
        if unitCheckBox:
            return unitCheckBox.unit

    def addUnit(self, unit):
        unitCheckBox = CheckBoxWidget(self,
                    i18n_def="%s [%s]" % (unit.name, unit.label))
        unitCheckBox.unit = unit
        if unit == self.default_unit:
            unitCheckBox.setChecked(True)
        self.__unitsButtonsGroup__.addButton(unitCheckBox)

    def __buttonClicked__(self, button):
        if not button.unit == self.__old_button_unit__:
            if not self.__change_unit_handler__ == None:
                self.__change_unit_handler__(button.unit)
        self.__old_button_unit__ = button.unit

    def setUnit(self, unit):
        """
        method which marks a button with an appropriate unit as checked
        """
        for button in self.__unitsButtonsGroup__.buttons():
            if button.unit.name == unit.name:
                button.setChecked(True)
    def __createAnnotationButtons__(self):

        self.__button_group__ = ButtonGroupWidget(self)

        unique_annotations0 = get_unique_annotations(
                                                self.data_accessor.annotation0)
        empty = is_empty(unique_annotations0)
        self.set_title(empty)
        self.__all_button__ = CheckBoxWidget(self, i18n_def='ALL',
                                clicked_handler=self.__all_button_handler__)
        self.__button_group__.addButton(self.__all_button__)
        for unique_annotation in unique_annotations0:
            annotationCheckBox = CheckBoxWidget(self,
                                            i18n_def=str(unique_annotation))
            self.__button_group__.addButton(annotationCheckBox)

        self.__button_group__.setExclusive(False)
        self.__button_group__.connect(self.__button_group__,
                                      BUTTON_CLICKED_SIGNAL,
                                      self.__button_handler__)
Пример #7
0
    def __init__(self, parent, **params):
        get_or_put(params, 'i18n', 'time.units.group.title')
        get_or_put(params, 'i18n_def', 'Time units')
        get_or_put(params, 'layout', QHBoxLayout())
        self.default_unit = params.get('default_unit', Millisecond)
        super(TimeUnitsWidget, self).__init__(parent, **params)
        self.__unitsButtonsGroup__ = ButtonGroupWidget(self)
        self.__change_unit_handler__ = params.get('change_unit_handler', None)

        for time_unit in get_units_for_type(TimeUnit):
            unitCheckBox = CheckBoxWidget(self,
                    i18n_def="%s [%s]" % (time_unit.name, time_unit.label))

            #add artificially property unit for later use in getUnit method
            unitCheckBox.unit = time_unit

            if time_unit == self.default_unit:
                unitCheckBox.setChecked(True)
            self.__unitsButtonsGroup__.addButton(unitCheckBox)

        self.connect(self.__unitsButtonsGroup__,
                    SIGNAL("buttonClicked(QAbstractButton *)"),
                    self.__buttonClicked__)
        self.__old_button_unit__ = None
class CommonAnnotationFilterWidget(GroupBoxWidget):
    def __init__(self, parent, **params):
        get_or_put(params, 'layout', QHBoxLayout())
        super(CommonAnnotationFilterWidget, self).__init__(parent, **params)
        self.params = Params(**params)
        self.data_accessor = self.params.data_accessor  # alias
        self.__filter__ = AnnotationFilter()
        self.__createAnnotationButtons__()
        self.createActionButton()
        self.__activateActionButton__(False)

    @property
    def action_button(self):
        pass

    @property
    def excluded_annotations(self):
        annotations = []
        for button in self.__button_group__.buttons():
            if button.isChecked():
                if button == self.__all_button__:
                    return ALL_ANNOTATIONS
                annotations.append(int(button.text()))
        return annotations

    def setEnabledAnnotations(self, _annotations):
        for button in self.__button_group__.buttons():
            if button == self.__all_button__:
                button.setEnabled(ALL_ANNOTATIONS == _annotations)
            elif ALL_ANNOTATIONS == _annotations or \
                int(button.text()) in _annotations:
                button.setEnabled(True)
            else:
                button.setEnabled(False)

    def setDisabledAnnotations(self, _annotations):
        for button in self.__button_group__.buttons():
            if button == self.__all_button__:
                button.setEnabled(not ALL_ANNOTATIONS == _annotations)
            elif ALL_ANNOTATIONS == _annotations or \
                int(button.text()) in _annotations:
                button.setEnabled(False)

    def disableIfAllChecked(self):
        for button in self.__button_group__.buttons():
            if not button == self.__all_button__ and not button.isChecked():
                return
        self.__all_button__.setEnabled(False)

    def reset(self):
        self.__button_group__.setEnabled(True)
        self.__button_group__.setAllChecked(False)
        self.__activateActionButton__(False)

    @property
    def use_filter(self):
        return self.__button_group__.isAnyChecked()

    @property
    def annotation_filter(self):
        return self.__filter__

    def set_title(self, empty):
        if empty:
            self.setTitle("Annotation filter [NOT ACTIVE - data already filtered]") # @IgnorePep8
            self.setEnabled(False)
        else:
            self.setTitle("Annotation filter")
            self.setEnabled(True)

    @property
    def buttons_count(self):
        return len(self.__button_group__.buttons())

    def setUncheckNotAnnotations(self, _annotations):
        for button in self.__button_group__.buttons():
            if button == self.__all_button__:
                button.setChecked(False)
            else:
                if int(button.text()) not in _annotations:
                    button.setChecked(False)

    def setCheckedAnnotations(self, _annotations):
        """
        check all buttons in accordance with annotations
        """
        for button in self.__button_group__.buttons():
            if not button == self.__all_button__:
                if int(button.text()) in _annotations:
                    button.setChecked(True)

    def isAllUnchecked(self):
        return self.__button_group__.isAllUnchecked()

    def __createAnnotationButtons__(self):

        self.__button_group__ = ButtonGroupWidget(self)

        unique_annotations0 = get_unique_annotations(
                                                self.data_accessor.annotation0)
        empty = is_empty(unique_annotations0)
        self.set_title(empty)
        self.__all_button__ = CheckBoxWidget(self, i18n_def='ALL',
                                clicked_handler=self.__all_button_handler__)
        self.__button_group__.addButton(self.__all_button__)
        for unique_annotation in unique_annotations0:
            annotationCheckBox = CheckBoxWidget(self,
                                            i18n_def=str(unique_annotation))
            self.__button_group__.addButton(annotationCheckBox)

        self.__button_group__.setExclusive(False)
        self.__button_group__.connect(self.__button_group__,
                                      BUTTON_CLICKED_SIGNAL,
                                      self.__button_handler__)

    def __button_handler__(self, button):
        if button.isChecked():
            if button == self.__all_button__:
                self.__setCheckedAnnotationsButtons__(False)
                self.__setEnabledAnnotationsButtons__(False)
            else:
                self.__all_button__.setChecked(False)
            self.__activateActionButton__(True)
        else:
            if button == self.__all_button__ or \
                self.__button_group__.isAllUnchecked():
                self.__activateActionButton__(False)
            if button == self.__all_button__:
                self.__setEnabledAnnotationsButtons__(True)

    def __all_button_handler__(self):
        self.__button_handler__(self.__all_button__)

    def __setCheckedAnnotationsButtons__(self, _checked):
        for button in self.__button_group__.buttons():
            if not button == self.__all_button__:
                button.setChecked(_checked)

    def __setEnabledAnnotationsButtons__(self, _enabled):
        for button in self.__button_group__.buttons():
            if not button == self.__all_button__:
                button.setEnabled(_enabled)

    def __activateActionButton__(self, _activate):
        self.action_button.setEnabled(_activate)
        if _activate == False and hasattr(self.action_button, 'setChecked'):
            self.action_button.setChecked(False)

    def useFilter(self):
        return self.action_button.isChecked() \
            if hasattr(self.action_button, 'isChecked') else False

    def getFilter(self):
        return self.__filter__

    def setAnnotationFilterParams(self, annotation_filter_params):
        """
        set up annotation filter widget parameters
        """
        if not annotation_filter_params.all_annotations:
            if not annotation_filter_params.annotations == None:
                self.setEnabledAnnotations(annotation_filter_params.annotations) # @IgnorePep8
                self.setCheckedAnnotations(annotation_filter_params.annotations) # @IgnorePep8

        self.__all_button__.setChecked(
                                    annotation_filter_params.all_annotations)
        self.__all_button__.setEnabled(True)

        self.__action_button__.setChecked(annotation_filter_params.use_filter)
        if annotation_filter_params.use_filter or \
            annotation_filter_params.all_annotations or \
            not annotation_filter_params.annotations == None:
            self.__action_button__.setEnabled(True)

    def getAnnotationFilterParams(self):
        all_annotations = False
        annotations = self.excluded_annotations
        if annotations == ALL_ANNOTATIONS \
            or self.__all_button__.isChecked():
            all_annotations = True
            annotations = None
        if not annotations == None and len(annotations) == 0:
            annotations = None
        return AnnotationFilterParams(annotations, all_annotations,
                                      self.useFilter())
Пример #9
0
class SeparatorWidget(object):
    """
    widget used to choose a separator sign
    """
    def __init__(self, parent, **params):
        get_or_put(params, 'i18n_def', 'Separator')
        self.params = Params(**params)
        self.separatorsGroupBox = GroupBoxWidget(parent,
                            i18n="separator.widget.group.title",
                            i18n_def=nvl(self.params.i18n_def, "Separator"),
                            layout=QVBoxLayout())

        self.predefinedSeparatorsComposite = CompositeWidget(
                                                    self.separatorsGroupBox,
                                                    layout=QHBoxLayout())
        self.predefinedSeparatorsButtonsGroup = ButtonGroupWidget(
                                            self.predefinedSeparatorsComposite)

        self.predefinedSeparatorsSpecs = Separator.getSeparatorsSpec(
                                                    separator_label_handler)
        for separatorSpec in self.predefinedSeparatorsSpecs:
            label = separatorSpec.label
            if not label == Separator.CUSTOM.label:  # @UndefinedVariable
                predefinedSeparatorCheckBox = CheckBoxWidget(
                                            self.predefinedSeparatorsComposite)
                #attach artificially a separatorSpec object used later in
                #def setSeparator(self, _separator) method
                predefinedSeparatorCheckBox.separator_spec = separatorSpec
                predefinedSeparatorCheckBox.setText(label)
                predefinedSeparatorCheckBox.sep_spec = separatorSpec
                if self.params.default_separator and \
                    separatorSpec.id_ == self.params.default_separator.id_:
                    predefinedSeparatorCheckBox.setChecked(True)
                self.predefinedSeparatorsButtonsGroup.addButton(
                                                predefinedSeparatorCheckBox)

        self.separatorsGroupBox.connect(self.predefinedSeparatorsButtonsGroup,
                                    SIGNAL("buttonClicked(QAbstractButton *)"),
                                    self.predefinedSeparatorButtonClicked)

        if not self.params.no_custom_separator == True:
            self.customSeparatorCheckBox = CheckBoxWidget(
                                        self.predefinedSeparatorsComposite,
                                        i18n="separator.custom.checkbox",
                                        i18n_def="Custom")
            self.customSeparatorCheckBox.sep_spec = Separator.CUSTOM
            self.separatorsGroupBox.connect(self.customSeparatorCheckBox,
                                        SIGNAL("clicked()"),
                                        self.customSeparatorButtonClicked)

            self.customSeparatorEdit = LineEditWidget(
                        self.predefinedSeparatorsComposite,
                        maxLength=15,
                        width=get_width_of_n_letters(14),
                        text_changed_handler=self.customSeparatorButtonClicked,
                        enabled=False)

        self.setEnabled(self.params.enabled)

    def getSeparatorSign(self):
        sign = self.__getPredefinedSeparatorSign__()
        if sign:
            return sign
        if not self.params.no_custom_separator == True:
            return self.__getCustomSeparatorSign__()

    def predefinedSeparatorButtonClicked(self, button):
        if not self.params.no_custom_separator == True:
            self.__customSeparatorClear__()
        if self.params.separatorHandler and \
            not self.predefinedSeparatorsButtonsGroup.checkedButton() == None:
            self.params.separatorHandler(self.__getPredefinedSeparatorSign__())

    def customSeparatorButtonClicked(self):
        checked = self.customSeparatorCheckBox.isChecked()
        separator = self.__getCustomSeparatorSign__()
        if checked and self.params.separatorHandler and separator:
            self.params.separatorHandler(separator)
        self.customSeparatorEdit.setEnabled(checked)
        if checked:
            self.__uncheckPredefinedButtons__()
            self.customSeparatorEdit.setFocus()

    def __getPredefinedSeparatorSign__(self):
        button = self.predefinedSeparatorsButtonsGroup.checkedButton()
        if not button == None:
            for (sign, _, label) in self.predefinedSeparatorsSpecs:
                if button.text() == label:
                    return sign

    def __getCustomSeparatorSign__(self):
        if self.customSeparatorCheckBox.isChecked():
            return str(self.customSeparatorEdit.text())

    def setEnabled(self, enabled):
        if not enabled == None:
            self.separatorsGroupBox.setEnabled(enabled)

    def setSeparator(self, _separator):
        if _separator:
            separatorSign = Separator.getSeparatorSign(_separator)
            if separatorSign == Separator.WHITE_SPACE:
                for button in self.predefinedSeparatorsButtonsGroup.buttons():
                    if button.separator_spec.id_ == Separator.WHITE_SPACE.id_:  # @UndefinedVariable @IgnorePep8
                        button.setChecked(True)
                        return
            elif separatorSign == Separator.CUSTOM:
                self.customSeparatorEdit.setText(_separator)
                self.__uncheckPredefinedButtons__()
            elif not separatorSign == Separator.NONE:
                for button in self.predefinedSeparatorsButtonsGroup.buttons():
                    if button.sep_spec.id_ == separatorSign.id_:
                        if not self.params.no_custom_separator == True:
                            self.__customSeparatorClear__()
                        button.setChecked(True)
                        return

    def __customSeparatorClear__(self):
        self.customSeparatorCheckBox.setChecked(False)
        self.customSeparatorEdit.setText("")
        self.customSeparatorEdit.setEnabled(False)

    def __uncheckPredefinedButtons__(self):
        #to uncheck button included in a button group one have to use a trick:
        #change to none exclusive state behaviour of the button group, then
        #uncheck checked button and reverse to previous exclusive state of
        #the button group
        if self.predefinedSeparatorsButtonsGroup.checkedButton():
            self.predefinedSeparatorsButtonsGroup.setExclusive(False)
            self.predefinedSeparatorsButtonsGroup.checkedButton().setChecked(
                                                                        False)
            self.predefinedSeparatorsButtonsGroup.setExclusive(True)
class CommonAnnotationFilterWidget(GroupBoxWidget):
    def __init__(self, parent, **params):
        get_or_put(params, 'layout', QHBoxLayout())
        super(CommonAnnotationFilterWidget, self).__init__(parent, **params)
        self.params = Params(**params)
        self.data_accessor = self.params.data_accessor  # alias
        self.__filter__ = AnnotationFilter()
        self.__createAnnotationButtons__()
        self.createActionButton()
        self.__activateActionButton__(False)

    @property
    def action_button(self):
        pass

    @property
    def excluded_annotations(self):
        annotations = []
        for button in self.__button_group__.buttons():
            if button.isChecked():
                if button == self.__all_button__:
                    return ALL_ANNOTATIONS
                annotations.append(int(button.text()))
        return annotations

    def setEnabledAnnotations(self, _annotations):
        for button in self.__button_group__.buttons():
            if button == self.__all_button__:
                button.setEnabled(ALL_ANNOTATIONS == _annotations)
            elif ALL_ANNOTATIONS == _annotations or \
                int(button.text()) in _annotations:
                button.setEnabled(True)
            else:
                button.setEnabled(False)

    def setDisabledAnnotations(self, _annotations):
        for button in self.__button_group__.buttons():
            if button == self.__all_button__:
                button.setEnabled(not ALL_ANNOTATIONS == _annotations)
            elif ALL_ANNOTATIONS == _annotations or \
                int(button.text()) in _annotations:
                button.setEnabled(False)

    def disableIfAllChecked(self):
        for button in self.__button_group__.buttons():
            if not button == self.__all_button__ and not button.isChecked():
                return
        self.__all_button__.setEnabled(False)

    def reset(self):
        self.__button_group__.setEnabled(True)
        self.__button_group__.setAllChecked(False)
        self.__activateActionButton__(False)

    @property
    def use_filter(self):
        return self.__button_group__.isAnyChecked()

    @property
    def annotation_filter(self):
        return self.__filter__

    def set_title(self, empty):
        if empty:
            self.setTitle(
                "Annotation filter [NOT ACTIVE - data already filtered]"
            )  # @IgnorePep8
            self.setEnabled(False)
        else:
            self.setTitle("Annotation filter")
            self.setEnabled(True)

    @property
    def buttons_count(self):
        return len(self.__button_group__.buttons())

    def setUncheckNotAnnotations(self, _annotations):
        for button in self.__button_group__.buttons():
            if button == self.__all_button__:
                button.setChecked(False)
            else:
                if int(button.text()) not in _annotations:
                    button.setChecked(False)

    def setCheckedAnnotations(self, _annotations):
        """
        check all buttons in accordance with annotations
        """
        for button in self.__button_group__.buttons():
            if not button == self.__all_button__:
                if int(button.text()) in _annotations:
                    button.setChecked(True)

    def isAllUnchecked(self):
        return self.__button_group__.isAllUnchecked()

    def __createAnnotationButtons__(self):

        self.__button_group__ = ButtonGroupWidget(self)

        unique_annotations0 = get_unique_annotations(
            self.data_accessor.annotation0)
        empty = is_empty(unique_annotations0)
        self.set_title(empty)
        self.__all_button__ = CheckBoxWidget(
            self, i18n_def='ALL', clicked_handler=self.__all_button_handler__)
        self.__button_group__.addButton(self.__all_button__)
        for unique_annotation in unique_annotations0:
            annotationCheckBox = CheckBoxWidget(
                self, i18n_def=str(unique_annotation))
            self.__button_group__.addButton(annotationCheckBox)

        self.__button_group__.setExclusive(False)
        self.__button_group__.connect(self.__button_group__,
                                      BUTTON_CLICKED_SIGNAL,
                                      self.__button_handler__)

    def __button_handler__(self, button):
        if button.isChecked():
            if button == self.__all_button__:
                self.__setCheckedAnnotationsButtons__(False)
                self.__setEnabledAnnotationsButtons__(False)
            else:
                self.__all_button__.setChecked(False)
            self.__activateActionButton__(True)
        else:
            if button == self.__all_button__ or \
                self.__button_group__.isAllUnchecked():
                self.__activateActionButton__(False)
            if button == self.__all_button__:
                self.__setEnabledAnnotationsButtons__(True)

    def __all_button_handler__(self):
        self.__button_handler__(self.__all_button__)

    def __setCheckedAnnotationsButtons__(self, _checked):
        for button in self.__button_group__.buttons():
            if not button == self.__all_button__:
                button.setChecked(_checked)

    def __setEnabledAnnotationsButtons__(self, _enabled):
        for button in self.__button_group__.buttons():
            if not button == self.__all_button__:
                button.setEnabled(_enabled)

    def __activateActionButton__(self, _activate):
        self.action_button.setEnabled(_activate)
        if _activate == False and hasattr(self.action_button, 'setChecked'):
            self.action_button.setChecked(False)

    def useFilter(self):
        return self.action_button.isChecked() \
            if hasattr(self.action_button, 'isChecked') else False

    def getFilter(self):
        return self.__filter__

    def setAnnotationFilterParams(self, annotation_filter_params):
        """
        set up annotation filter widget parameters
        """
        if not annotation_filter_params.all_annotations:
            if not annotation_filter_params.annotations == None:
                self.setEnabledAnnotations(
                    annotation_filter_params.annotations)  # @IgnorePep8
                self.setCheckedAnnotations(
                    annotation_filter_params.annotations)  # @IgnorePep8

        self.__all_button__.setChecked(
            annotation_filter_params.all_annotations)
        self.__all_button__.setEnabled(True)

        self.__action_button__.setChecked(annotation_filter_params.use_filter)
        if annotation_filter_params.use_filter or \
            annotation_filter_params.all_annotations or \
            not annotation_filter_params.annotations == None:
            self.__action_button__.setEnabled(True)

    def getAnnotationFilterParams(self):
        all_annotations = False
        annotations = self.excluded_annotations
        if annotations == ALL_ANNOTATIONS \
            or self.__all_button__.isChecked():
            all_annotations = True
            annotations = None
        if not annotations == None and len(annotations) == 0:
            annotations = None
        return AnnotationFilterParams(annotations, all_annotations,
                                      self.useFilter())