Example #1
0
    def __init__(self, with_code=True, create_mode=False):
        self.create_mode = create_mode
        self._accounts = {}

        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 account.total < 0
            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.SELECTION_SINGLE)

        def render_icon(icon):
            return self.render_icon(icon, gtk.ICON_SIZE_MENU)
        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:
            self.set_headers_visible(False)
Example #2
0
 def __init__(self):
     ObjectTree.__init__(self)
     self.connect('double-click', self._on__double_click)
     self.connect('row-activated', self._on__row_activated)
     self.connect('right-click', self._on__right_click)
Example #3
0
 def __init__(self, columns):
     ObjectTree.__init__(self, columns)