def _populate_widgets_with_record(self): # Format the amount field if self.currentrecord.amount: self.amount.set_text( utils.float_to_currency(self.currentrecord.amount)) else: self.amount.set_text("") # Format the dueDate field dt = self.currentrecord.dueDate self.dueDate.set_date(dt) utils.select_combo_text(self.payee, self.currentrecord.payee) if self.currentrecord.category: actions = Actions() cat_name = self.currentrecord.category.name records = actions.get_categories(name=cat_name) if records: categoryname = records[0].name utils.select_combo_text(self.category, categoryname, 1) else: self.category.set_active(0) if self.currentrecord.notes: self.txtbuffer.set_text(self.currentrecord.notes) #self.chkPaid.set_active(self.currentrecord.Paid) if self.currentrecord.alarmDate: self.alarmbutton.set_date(self.currentrecord.alarmDate)
def _populate_widgets_with_record(self): # Format the amount field if self.currentrecord.amount: self.amount.set_text(utils.float_to_currency(self.currentrecord.amount)) else: self.amount.set_text("") # Format the dueDate field dt = self.currentrecord.dueDate self.dueDate.set_date(dt) utils.select_combo_text(self.payee, self.currentrecord.payee) if self.currentrecord.category: actions = Actions() cat_name = self.currentrecord.category.name records = actions.get_categories(name=cat_name) if records: categoryname = records[0].name utils.select_combo_text(self.category, categoryname, 1) else: self.category.set_active(0) if self.currentrecord.notes: self.txtbuffer.set_text(self.currentrecord.notes) #self.chkPaid.set_active(self.currentrecord.Paid) if self.currentrecord.alarmDate: self.alarmbutton.set_date(self.currentrecord.alarmDate)
def on_timeline_cb(self, date, display_type, force=False): # TODO: Improve tooltip # TODO: Improve cache if date in self._bullet_cache.keys() and not force: return None self._bullet_cache[date] = self.actions.get_bills(dueDate=date) if self._bullet_cache[date]: status = self.gconf_client.get('show_paid_bills') amount = 0 amount_not_paid = 0 tooltip = '' bullet = Event() bullet.date = date for bill in self._bullet_cache[date]: amount += bill.amount if tooltip: tooltip += '\n' tooltip += bill.payee + ' (' + str( float_to_currency(bill.amount)) + ')' if bill.paid: tooltip += ' [%s]' % _('Paid') if status == 0: return False bullet.status = bullet.status | bullet.PAID else: amount_not_paid += bill.amount if date <= datetime.date.today(): if status == 1: return False bullet.status = bullet.status | bullet.OVERDUE else: if status == 1: return False bullet.status = bullet.status | bullet.TO_BE_PAID if bill.notes: tooltip += ' - ' + bill.notes bullet.amountdue = amount_not_paid if amount_not_paid else amount bullet.payee = bill.payee bills = len(self._bullet_cache[date]) if bills > 1: bullet.multi = bills bullet.payee = '%d bills' % bills bullet.tooltip = tooltip return bullet return None
def on_timeline_cb(self, date, display_type, force=False): # TODO: Improve tooltip # TODO: Improve cache if date in self._bullet_cache.keys() and not force: return None self._bullet_cache[date] = self.actions.get_bills(dueDate=date) if self._bullet_cache[date]: status = self.gconf_client.get("show_paid_bills") amount = 0 amount_not_paid = 0 tooltip = "" bullet = Event() bullet.date = date for bill in self._bullet_cache[date]: amount += bill.amount if tooltip: tooltip += "\n" tooltip += bill.payee + " (" + str(float_to_currency(bill.amount)) + ")" if bill.paid: tooltip += " [%s]" % _("Paid") if status == 0: return False bullet.status = bullet.status | bullet.PAID else: amount_not_paid += bill.amount if date <= datetime.date.today(): if status == 1: return False bullet.status = bullet.status | bullet.OVERDUE else: if status == 1: return False bullet.status = bullet.status | bullet.TO_BE_PAID if bill.notes: tooltip += " - " + bill.notes bullet.amountdue = amount_not_paid if amount_not_paid else amount bullet.payee = bill.payee bills = len(self._bullet_cache[date]) if bills > 1: bullet.multi = bills bullet.payee = "%d bills" % bills bullet.tooltip = tooltip return bullet return None
def amountdue_cell_data_function(self, column, cell, model, iter): amountDue = model.get_value(iter, 5) if amountDue: amountDue = model.get_value(iter, 5).replace(',', '.') else: amountDue = "" paid = model.get_value(iter, 7) amountDue = len(amountDue) > 0 and amountDue or 0 amountDue = utils.float_to_currency(float(amountDue)) if int(paid): amountDue = "<s>%s</s>" % amountDue cell.set_property('markup', amountDue) cell.set_property('xalign', 1.0)