Exemple #1
0
 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)
Exemple #2
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
Exemple #3
0
 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)
Exemple #4
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