Ejemplo n.º 1
0
    def __init__(self, account, parent):
        self.account = account
        builder = Gtk.Builder()
        builder.add_from_file(get_ui_file("account/edit_account_dialog.glade"))
        self.dlg = builder.get_object("dialog")
        self.dlg.set_transient_for(parent.tree.get_toplevel())
        self.name_entry = builder.get_object("name_entry")
        self.name_entry.set_text(account.name)
        self.balance_entry = builder.get_object("balance_entry")
        adjustment = builder.get_object("adjustment1")
        adjustment.set_value(account.balance)
        self.combobox = builder.get_object("type_combobox")
        liststore = Gtk.ListStore(int, str)
        self.combobox.set_model(liststore)
        cell = Gtk.CellRendererText()
        self.combobox.pack_start(cell, True)
        self.combobox.add_attribute(cell, "text", 1)
        for account_type, name in account_m.yield_account_types():
            iterator = liststore.append([account_type, name])
            if account_type == account.type:
                self.combobox.set_active_iter(iterator)

        self.dlg.add_buttons(Gtk.STOCK_CLOSE, Gtk.ResponseType.ACCEPT)
        self.dlg.connect("response", self.on_response)
        self.dlg.show()
Ejemplo n.º 2
0
 def _load_accounts(self):
     accounts = account.get_all_accounts()
     for account_type, type_name in account.yield_account_types():
         iterator = self.model.append(None, [None, type_name, 0.0, 0, None, None, Pango.Weight.BOLD])
         ta_count = 0
         balance = 0
         for acc in accounts:
             if acc.type == account_type:
                 new_iter = self.model.append(iterator, [acc,
                            acc.name,
                            acc.balance,
                            len(acc.transactions),
                            acc.birthday,
                            acc.lastday,
                            Pango.Weight.NORMAL
                           ])
                 new_row = self.model[new_iter]
                 balance += acc.balance
                 ta_count += new_row[3]
                 self.model[iterator] = [None, type_name, balance, ta_count, None, None, Pango.Weight.BOLD]