コード例 #1
0
 def refresh_list(self):
     self.ids.yearlist.clear_widgets()
     currency = app_scr.config.get('CustSettings', 'Currency')
     expense_dict = Expenses.get_expenses(date=self.current_date,
                                          date_type='year')
     if expense_dict == {}:
         self.ids.yearlist.add_widget(
             MDLabel(text='No expenses to show',
                     halign='center',
                     theme_text_color='Hint'))
     total = 0.0
     for key, value in expense_dict.items():
         self.ids.yearlist.add_widget(
             CustomListItem(text=key,
                            right_text='{} {}'.format(currency,
                                                      str(value))))
         total = total + float(value)
     self.ids.total.text = '{} {}'.format(currency, total)
コード例 #2
0
 def refresh_list(self):
     self.ids.monthlist.clear_widgets()
     currency = app_scr.config.get('CustSettings', 'Currency')
     expense_dict = Expenses.get_expenses(date=self.current_date,
                                          date_type='month')
     if expense_dict == {}:
         self.ids.monthlist.add_widget(
             MDLabel(text='No expenses to show',
                     halign='center',
                     theme_text_color='Hint'))
     total = 0.0
     for key, value in expense_dict.items():
         exp_date = datetime.strptime(key, '%Y-%m-%d')
         self.ids.monthlist.add_widget(
             CustomListItem(text=exp_date.strftime('%d %b %Y'),
                            right_text='{} {}'.format(currency,
                                                      str(value))))
         total = total + value
     self.ids.total.text = '{} {}'.format(currency, total)
コード例 #3
0
 def refresh_list(self):
     self.ids.list.clear_widgets()
     currency = app_scr.config.get('CustSettings', 'Currency')
     expense_dict = Expenses.get_expenses(
         date=self.current_date.strftime('%Y-%m-%d'), date_type='day')
     if expense_dict == {}:
         self.ids.list.add_widget(
             MDLabel(text='No expenses to show',
                     halign='center',
                     theme_text_color='Hint'))
     total = 0.0
     for key, value in expense_dict.items():
         self.ids.list.add_widget(
             CustomDayItem(text=value['item_name'],
                           right_text='{} {}'.format(
                               currency, str(value['value'])),
                           expense_id=key))
         total = total + value['value']
     self.ids.total.text = '{} {}'.format(currency, total)