How to use the kiwi.ui.objectlist.ColoredColumn function in kiwi

To help you get started, we’ve selected a few kiwi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stoq / stoq / stoqlib / gui / wizards / purchasefinishwizard.py View on Github external
def _get_columns(self):
        return [IdentifierColumn('identifier', title=_('Purchase #')),
                Column('description', _("Description"), data_type=str,
                       width=150, expand=True,
                       ellipsize=Pango.EllipsizeMode.END),
                Column('due_date', _("Due date"), sorted=True,
                       data_type=datetime.date, width=90,
                       justify=Gtk.Justification.RIGHT),
                Column('paid_date', _("Paid date"),
                       data_type=datetime.date, width=90),
                Column('status_str', _("Status"), data_type=str, width=80),
                ColoredColumn('value', _("Value"), data_type=currency,
                              width=90, color='red',
                              justify=Gtk.Justification.RIGHT,
                              data_func=payment_value_colorize),
                ColoredColumn('paid_value', _("Paid value"),
                              data_type=currency, width=92, color='red',
                              justify=Gtk.Justification.RIGHT,
                              data_func=payment_value_colorize)]
github stoq / stoq / stoqlib / gui / dialogs / productiondetails.py View on Github external
columns = [Column('serial_number', title=_('Serial Number'),
                          data_type=str, expand=True)]

        # Add one column for each test from each product.
        products = dict()
        for item in self.model.get_items():
            if item.product in products:
                continue
            products[item.product] = 1
            for test in item.product.quality_tests:
                columns.append(
                    # This wont just the serial number, since we use format_func
                    # to change the displayed value, but we still need one
                    # property to create the column
                    ColoredColumn('serial_number',
                                  data_type=str, title=test.description,
                                  format_func=self._format_func,
                                  format_func_data=test,
                                  color='red', data_func=self._colorize,
                                  use_data_model=True))

        columns.extend([
            Column('test_passed', title=_('Tests Passed'),
                       data_type=bool, visible=False),
            Column('entered_stock', title=_('Entered Stock'),
                   data_type=bool, visible=False)])
        return columns
github stoq / stoq / stoqlib / gui / slaves / productionslave.py View on Github external
Column('code', title=_('Code'), data_type=str),
            Column('category_description', title=_('Category'),
                   data_type=str, expand=True, ellipsize=Pango.EllipsizeMode.END),
            Column('description', title=_('Description'), data_type=str,
                   expand=True, ellipsize=Pango.EllipsizeMode.END, sorted=True),
            Column('unit_description', title=_('Unit'),
                   data_type=str),
            Column('needed', title=_('Needed'), data_type=Decimal,
                   format_func=format_quantity),
            Column('stock_quantity', title=_('In Stock'), data_type=Decimal,
                   format_func=format_quantity),
            ColoredColumn('to_purchase', title=_('To Purchase'),
                          data_type=Decimal, format_func=format_quantity,
                          use_data_model=True, color='red',
                          data_func=self._colorize_to_purchase_col),
            ColoredColumn('to_make', title=_('To Make'), data_type=Decimal,
                          format_func=format_quantity, use_data_model=True,
                          color='red', data_func=self._colorize_to_make_col)]
github stoq / stoq / stoqlib / gui / wizards / purchasefinishwizard.py View on Github external
def _get_columns(self):
        return [IdentifierColumn('identifier', title=_('Purchase #')),
                Column('description', _("Description"), data_type=str,
                       width=150, expand=True,
                       ellipsize=Pango.EllipsizeMode.END),
                Column('due_date', _("Due date"), sorted=True,
                       data_type=datetime.date, width=90,
                       justify=Gtk.Justification.RIGHT),
                Column('paid_date', _("Paid date"),
                       data_type=datetime.date, width=90),
                Column('status_str', _("Status"), data_type=str, width=80),
                ColoredColumn('value', _("Value"), data_type=currency,
                              width=90, color='red',
                              justify=Gtk.Justification.RIGHT,
                              data_func=payment_value_colorize),
                ColoredColumn('paid_value', _("Paid value"),
                              data_type=currency, width=92, color='red',
                              justify=Gtk.Justification.RIGHT,
                              data_func=payment_value_colorize)]
github stoq / stoq / stoqlib / gui / dialogs / saledetails.py View on Github external
return [IdentifierColumn('identifier', title=_('Payment #')),
                Column('method.description', _("Type"),
                       data_type=str, width=60),
                Column('description', _("Description"), data_type=str,
                       width=150, expand=True),
                Column('due_date', _("Due date"), sorted=True,
                       data_type=datetime.date, width=90,
                       justify=Gtk.Justification.RIGHT),
                Column('paid_date', _("Paid date"),
                       data_type=datetime.date, width=90),
                Column('status_str', _("Status"), data_type=str, width=80),
                ColoredColumn('value', _("Value"), data_type=currency,
                              width=90, color='red',
                              justify=Gtk.Justification.RIGHT,
                              data_func=payment_value_colorize),
                ColoredColumn('paid_value', _("Paid value"), data_type=currency,
                              width=92, color='red',
                              justify=Gtk.Justification.RIGHT,
                              data_func=payment_value_colorize)]
github stoq / stoq / stoqlib / gui / search / productsearch.py View on Github external
SearchColumn('category_description', title=_('Category'),
                             data_type=str, width=120),
                SearchColumn('description', title=_('Description'), data_type=str,
                             expand=True, sorted=True),
                SearchColumn('location', title=_('Location'), data_type=str,
                             visible=False),
                SearchColumn('maximum_quantity', title=_('Maximum'),
                             visible=False, format_func=format_data,
                             data_type=Decimal),
                SearchColumn('minimum_quantity', title=_('Minimum'),
                             format_func=format_data, data_type=Decimal),
                SearchColumn('stock', title=_('In Stock'),
                             format_func=format_data, data_type=Decimal),
                SearchColumn('to_receive_quantity', title=_('To Receive'),
                              format_func=format_data, data_type=Decimal),
                ColoredColumn('difference', title=_('Difference'), color='red',
                              format_func=format_data, data_type=Decimal,
                              data_func=lambda x: x <= Decimal(0)),]
github stoq / stoq / stoqlib / gui / dialogs / productiondialog.py View on Github external
return [Column('industrialized_str', title=_(u'Ind.'), data_type=str),
                Column('code', title=_(u'code'), data_type=str),
                Column('category', title=_(u'Category'), data_type=str,
                        sorted=True),
                Column('description', title=_(u'Description'), data_type=str),
                Column('location', title=_(u'Location'), data_type=str),
                Column('needed_quantity', title=_(u'Needed'),
                        data_type=Decimal),
                Column('stock_quantity', _(u'In Stock'), data_type=Decimal),
                Column('to_receive', _(u'To Receive'), data_type=Decimal),
                ColoredColumn('purchase_quantity', _(u'To Purchase'),
                              data_type=Decimal,
                              editable_attribute='not_industrialized',
                              data_func=self._purchase_colorize,
                              use_data_model=True),
                ColoredColumn('make_quantity', title=_(u'To Make'),
                              data_type=Decimal,
                              editable_attribute='industrialized',
                              data_func=self._make_colorize,
                              use_data_model=True),
           ]
github stoq / stoq / stoqlib / gui / widgets / accounttree.py View on Github external
columns = [StockTextColumn('description', title=_("Account name"),
                                   data_type=str, pack_end=True, expand=True,
                                   sorted=True, sort_func=sort_models)]
        if with_code:
            columns.append(Column('code', title=_("Code"), data_type=str,
                                  width=120))
        if not create_mode:
            # FIXME: This needs to be much better colorized, and moved to the
            #        domain classes
            def colorize(account):
                if (account.kind == 'account' and
                        account.account_type == Account.TYPE_INCOME):
                    return False
                else:
                    return payment_value_colorize(account.total)
            columns.append(ColoredColumn('total', title=_("Total"), width=100,
                                         data_type=currency,
                                         color='red',
                                         data_func=colorize,
                                         use_data_model=True))
        ObjectTree.__init__(self, columns,
                            mode=Gtk.SelectionMode.SINGLE)

        def render_icon(icon):
            theme = Gtk.IconTheme.get_default()
            return theme.load_icon(icon, 16, Gtk.IconLookupFlags.FORCE_SIZE)

        self._pixbuf_money = render_icon(STOQ_MONEY)
        self._pixbuf_payable = render_icon(STOQ_PAYABLE_APP)
        self._pixbuf_receivable = render_icon(STOQ_BILLS)
        self._pixbuf_till = render_icon(STOQ_TILL_APP)
        if self.create_mode:
github stoq / stoq / stoqlib / gui / dialogs / purchasedetails.py View on Github external
def _get_payments_columns(self):
        return [IdentifierColumn('identifier', title=_('Payment #')),
                Column('description', _("Description"), data_type=str,
                       expand=True, ellipsize=Pango.EllipsizeMode.END),
                Column('due_date', _("Due date"), sorted=True,
                       data_type=datetime.date, justify=Gtk.Justification.RIGHT),
                Column('paid_date', _("Paid date"), data_type=datetime.date),
                Column('status_str', _("Status"), data_type=str),
                ColoredColumn('value', _("Value"), data_type=currency,
                              justify=Gtk.Justification.RIGHT, use_data_model=True,
                              data_func=payment_value_colorize),
                ColoredColumn('paid_value', _("Paid value"), data_type=currency,
                              justify=Gtk.Justification.RIGHT, use_data_model=True,
                              data_func=payment_value_colorize)]