How to use the kiwi.ui.objectlist.Column 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 / kiwi / examples / list / sortable.py View on Github external
from gi.repository import Gtk

from kiwi.ui.objectlist import Column, ObjectList


class Fruit:
    def __init__(self, name, price):
        self.name = name
        self.price = price

fruits = ObjectList([Column('name', data_type=str, sorted=True),
                     Column('price', data_type=int)])

for name, price in [('Kiwi', 8),
                    ('Apple', 4),
                    ('Pineapple', 2),
                    ('Banana', 3),
                    ('Melon', 5)]:
    fruits.append(Fruit(name, price))

window = Gtk.Window()
window.connect('delete-event', Gtk.main_quit)
window.set_title('Fruits')
window.set_size_request(150, 180)

window.add(fruits)
window.show_all()
github ldipenti / GNOME-War-Pad / src / plugins / utopia_planitia / ui.py View on Github external
Column('tech', data_type=int),
                    Column('fuel_use', data_type=int),
                    # TODO add calculated data
                    ])
            # Beam
        else: 
            if isinstance(components[0], gwp.models.Beam):
                self.spec_list = ObjectList([
                        Column('name', data_type=str),
                        Column('kill', data_type=int),
                        Column('damage', data_type=int),
                        Column('cost', data_type=int),
                        Column('tri', data_type=int),
                        Column('dur', data_type=int),
                        Column('mol', data_type=int),
                        Column('mass', data_type=int),
                        Column('tech', data_type=int),
                        # TODO add calculated data
                        ])
            # Tube
            else: 
                if isinstance(components[0], gwp.models.Torpedo):
                    self.spec_list = ObjectList([
                            Column('name', data_type=str),
                            Column('kill', data_type=int),
                            Column('damage', data_type=int),
                            Column('launcher_cost', data_type=int),
                            Column('torp_cost', data_type=int),
                            Column('tri', data_type=int),
                            Column('dur', data_type=int),
                            Column('mol', data_type=int),
                            Column('mass', data_type=int),
github stoq / stoq / stoqlib / gui / search / personsearch.py View on Github external
def get_columns(self):
        return [Column('name', _('Role'), str, sorted=True, expand=True)]
github stoq / stoq / stoqlib / gui / dialogs / productstockdetails.py View on Github external
def _get_returned_columns(self):
        return [IdentifierColumn("returned_identifier", title=_('Returned #'), sorted=True),
                Column('batch_number', title=_('Batch'), data_type=str,
                       visible=self._is_batch),
                Column('batch_date', title=_('Batch Date'),
                       data_type=datetime.date, visible=False),
                Column("reason", title=_(u"Reason"),
                       data_type=str, expand=True),
                Column("quantity", title=_(u"Quantity"),
                       data_type=Decimal, format_func=format_quantity),
                Column("invoice_number", title=_(u"Invoice"),
                       data_type=int, visible=False),
                Column("price", title=_(u"Price"), data_type=currency,
                       format_func=get_formatted_cost),
                Column("return_date", title=_(u"Return Date"),
                       data_type=datetime.date, justify=Gtk.Justification.RIGHT)]
github stoq / kiwi / examples / search.py View on Github external
def get_columns(self):
        return [Column('description', data_type=str, title='Description',
                       expand=True),
                Column('price', data_type=currency, title='Price'),
                Column('date', data_type=datetime.date, width=90)]
github stoq / stoq / stoqlib / gui / dialogs / costcenterdialog.py View on Github external
def _get_payments_columns(self):
        return [IdentifierColumn('identifier', title=_('Payment #'), sorted=True),
                Column('method.description', _("Method"),
                       data_type=str, width=60),
                Column('description', _("Description"), data_type=str,
                       expand=True),
                Column('due_date', _("Due date"), visible=False,
                       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),
                Column('value', _("Value"), data_type=currency,
                       justify=Gtk.Justification.RIGHT, visible=False),
                Column('paid_value', _("Paid value"), data_type=currency,
                       justify=Gtk.Justification.RIGHT)]
github stoq / stoq / stoqlib / gui / dialogs / renegotiationdetails.py View on Github external
def _get_payments_columns(self):
        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('base_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 / personmergedialog.py View on Github external
def _get_columns(self):
        return [NameColumn(title=_('Name'), data_type=str, width=350),
                Column('cpf', title=_('CPF'), data_type=str),
                Column('cnpj', title=_('CNPJ'), data_type=str),
                Column('phone_number', title=_('Phone'), data_type=str,
                       format_func=format_phone_number),
                Column('mobile_number', title=_('Mobile'), data_type=str,
                       format_func=format_phone_number),
                Column('address', title=_('Address'), data_type=str, width=250),
                Column('fax_number', title=_('Fax'), data_type=str,
                       format_func=format_phone_number),
                Column('email', title=_('Email'), data_type=str)]
github stoq / stoq / stoqlib / gui / dialogs / costcenterdialog.py View on Github external
def _get_stock_transactions_columns(self):
        return [Column('date', _('Date'), data_type=datetime.date,
                       sorted=True),
                Column('responsible_name', _('Responsible'),
                       visible=False, data_type=str),
                Column('product_description', _('Product'), data_type=str,
                       expand=True),
                Column('stock_transaction.description', _('Description'), data_type=str,
                       width=140),
                Column('stock_cost', _('Stock cost'), data_type=currency),
                Column('quantity', _('Qty'), data_type=Decimal, format_func=abs),
                Column('total', _('Total'), data_type=currency)]
github stoq / stoq / stoqlib / gui / dialogs / stockdecreasedialog.py View on Github external
def _get_payment_columns(self):
        return [IdentifierColumn("identifier", title=_('Payment #')),
                Column("method.description", title=_("Type"),
                       data_type=str),
                Column("description", title=_("Description"),
                       data_type=str),
                Column("due_date", title=_("Due date"),
                       data_type=datetime.date),
                Column("paid_date", title=_("Paid date"),
                       data_type=datetime.date),
                Column("value", title=_("Value"),
                       data_type=currency),
                Column("paid_value", title=_("Paid value"),
                       data_type=currency),
                ]