Example #1
0
    def _update_summary(self, klist):
        quantity = total = 0
        for obj in klist:
            quantity += obj.quantity
            total += obj.total_sold

        self.quantity_label.set_label(_(u'Total quantity: %s') % format_quantity(quantity))
        self.total_sold_label.set_label(_(u'Total sold: %s') % get_formatted_cost(total))
Example #2
0
    def _update_summary(self, klist):
        quantity = total = 0
        for obj in klist:
            quantity += obj.quantity
            total += obj.total_sold

        self.quantity_label.set_label(
            _(u'Total quantity: %s') % format_quantity(quantity))
        self.total_sold_label.set_label(
            _(u'Total sold: %s') % get_formatted_cost(total))
Example #3
0
    def _update_widgets(self):
        has_selected = self.component_combo.read() is not None
        self.add_button.set_sensitive(has_selected)
        has_selected = self.component_tree.get_selected() is not None
        self.edit_button.set_sensitive(has_selected)
        self.remove_button.set_sensitive(has_selected)

        # FIXME: This is wrong. Summary label already calculates the total. We
        # are duplicating this.
        value = self.get_component_cost()
        self.component_label.set_value(get_formatted_cost(value))

        if not self._validate_components():
            self.component_combo.set_sensitive(False)
            self.add_button.set_sensitive(False)
            self.edit_button.set_sensitive(False)
            self.remove_button.set_sensitive(False)
            self.info_label.set_text(_(u"This product is being produced. "
                                       "Can't change components."))
Example #4
0
    def _update_widgets(self):
        has_selected = self.component_combo.read() is not None
        self.add_button.set_sensitive(has_selected)
        has_selected = self.component_tree.get_selected() is not None
        self.edit_button.set_sensitive(has_selected)
        self.remove_button.set_sensitive(has_selected)

        # FIXME: This is wrong. Summary label already calculates the total. We
        # are duplicating this.
        value = self.get_component_cost()
        self.component_label.set_value(get_formatted_cost(value))

        if not self._validate_components():
            self.component_combo.set_sensitive(False)
            self.add_button.set_sensitive(False)
            self.edit_button.set_sensitive(False)
            self.remove_button.set_sensitive(False)
            self.info_label.set_text(_(u"This product is being produced. "
                                       "Can't change components."))
Example #5
0
    def _update_widgets(self):
        has_selected = self.component_combo.read() is not None
        self.add_button.set_sensitive(has_selected)
        has_selected = self.component_tree.get_selected() is not None
        self.edit_button.set_sensitive(has_selected)
        self.remove_button.set_sensitive(has_selected)

        value = self.get_component_cost()
        if self._previous_value != value:
            self._previous_value = value
            self.emit('cost-updated', value)
        self.component_label.set_value(get_formatted_cost(value))

        if not self._validate_components():
            self.component_combo.set_sensitive(False)
            self.add_button.set_sensitive(False)
            self.edit_button.set_sensitive(False)
            self.remove_button.set_sensitive(False)
            self.info_label.set_text(_(u"This product is being produced. "
                                       "Can't change components."))
Example #6
0
    def _update_widgets(self):
        has_selected = self.component_combo.read() is not None
        self.add_button.set_sensitive(has_selected)
        has_selected = self.component_tree.get_selected() is not None
        self.edit_button.set_sensitive(has_selected)
        self.remove_button.set_sensitive(has_selected)

        value = self.get_component_cost()
        if self._previous_value != value:
            self._previous_value = value
            self.emit('cost-updated', value)
        self.component_label.set_value(get_formatted_cost(value))

        if not self._validate_components():
            self.component_combo.set_sensitive(False)
            self.add_button.set_sensitive(False)
            self.edit_button.set_sensitive(False)
            self.remove_button.set_sensitive(False)
            self.info_label.set_text(_(u"This product is being produced. "
                                       "Can't change components."))
Example #7
0
def test_get_formatted_cost():
    assert formatters.get_formatted_cost(1.69) == "R$ 1,69"