From ec399a5b93d5b93d12c34b6298725364dec02912 Mon Sep 17 00:00:00 2001 From: Mauro Scomparin Date: Mon, 16 Sep 2019 23:53:54 +0200 Subject: [PATCH] nuovi --- money/money.py | 28 +++++++++++++++++++++ money/translations/it/LC_MESSAGES/money.mo | Bin 868 -> 996 bytes money/translations/it/LC_MESSAGES/money.po | 23 +++++++++-------- money/translations/money.pot | 20 +++++++++------ setup.py | 2 +- 5 files changed, 54 insertions(+), 19 deletions(-) diff --git a/money/money.py b/money/money.py index 40ccf7e..b33494f 100755 --- a/money/money.py +++ b/money/money.py @@ -227,9 +227,22 @@ def filter_regex_movements(data_file, conf, filter): movements = load_file(data_file) ordered_movements = sort_movements(movements) filtered_movements = mov_filter(ordered_movements, filter) + actual_value = Decimal('0') + total_expenses = Decimal('0') + total_incomes = Decimal('0') for movement in filtered_movements: + movement_value = Decimal(movement[VALUE_FIELD_NAME]) + actual_value = actual_value + movement_value + if movement_value > Decimal('0'): + total_incomes = total_incomes + movement_value + else: + total_expenses = total_expenses + movement_value formatted_movement = format_movement(movement) print(formatted_movement) + print(value_message(_('actual value: {}'), actual_value)) + print(value_message(_('total incomes: {}'), total_incomes)) + print(value_message(_('total expenses: {}'), total_expenses)) + print(matches_number_message(len(filtered_movements))) def filter_movements(): """Writes the latest movements that match a filter formatted. @@ -364,6 +377,21 @@ def last_movement_number_message(n): """ return _('latest {} movements:').format(n) +def matches_number_message(n): + """Formats the number of movements to show to the user. + + Parameters + ---------- + n : int + The number to show to the user. + + Returns + ------- + str + A string to show to the user with the number of movements shown. + + """ + return _('matching movements: {}').format(n) def value_message(str, value): return str.format(value) diff --git a/money/translations/it/LC_MESSAGES/money.mo b/money/translations/it/LC_MESSAGES/money.mo index bf7456f199f85edd704caa19e8143595fa91da69..d976e93d69ff190fccb04cab5c7016d8d6c97f45 100644 GIT binary patch delta 466 zcmXxgF-yZh6u|L2Q`@SwY7t!=vI#<61PAdOI5>&mB0_ zeg$!Ga&xg$zkuJs|GVlVm)~9T?!8M!)lscCY*p?RF~?Y8+%c9J4b6?{;5=HK#w)Dg zEzV&7Z~cIatOvM+&luo4Ht+){@e5lx#08~#>W7IG3?{}2b!_vjiITWY6=}SSl6Qd8 z_z=0&DK}~CP#WK06$dDdA5r!_p?t_IO5HdAJmy49WWzVoSIsj1qsc^?Nz}*qqEb-) zn1mcog6;kbr~FDO&hP8WvR1bB&T0}BM;)8SVdBnBV$vet3cJ@Tbr&i#vAGOS>{(&5 nva9#>#>=PP*K1^2$+Z4m78TZSiH=R4J08)wCX!PM;Blb9}yQIF^NSYEF^-J!N4Gqh&yOpgGCHnj7(Z+k=H|T}h_(lzK=&Hs^4jPn24-2S$CDe=7P<@*J>wVO| z0W!kS?%M~rUNR=46{R8i!VuA$$B9aRMinNmKea7qHedQz+qKn8G0?N#Xfj\n" "Language-Team: Italian\n" @@ -46,7 +46,6 @@ msgid "now" msgstr "adesso" #: money/money.py:55 -#, fuzzy msgid "regex filter" msgstr "filtro regex" @@ -54,18 +53,22 @@ msgstr "filtro regex" msgid "data file:" msgstr "file dati:" -#: money/money.py:365 -msgid "latest {} movements:" -msgstr "ultimi {} movimenti:" - -#: money/money.py:416 +#: money/money.py:242 money/money.py:444 msgid "actual value: {}" msgstr "valore attuale: {}" -#: money/money.py:417 +#: money/money.py:243 money/money.py:445 msgid "total incomes: {}" msgstr "incassi totali: {}" -#: money/money.py:418 +#: money/money.py:244 money/money.py:446 msgid "total expenses: {}" msgstr "spese totali: {}" + +#: money/money.py:378 +msgid "latest {} movements:" +msgstr "ultimi {} movimenti:" + +#: money/money.py:394 +msgid "matching movements: {}" +msgstr "movimenti filtrati: {}" diff --git a/money/translations/money.pot b/money/translations/money.pot index 68e7a1d..63248b1 100644 --- a/money/translations/money.pot +++ b/money/translations/money.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-09-16 23:16+0200\n" +"POT-Creation-Date: 2019-09-16 23:45+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -53,18 +53,22 @@ msgstr "" msgid "data file:" msgstr "" -#: money/money.py:365 -msgid "latest {} movements:" -msgstr "" - -#: money/money.py:416 +#: money/money.py:242 money/money.py:444 msgid "actual value: {}" msgstr "" -#: money/money.py:417 +#: money/money.py:243 money/money.py:445 msgid "total incomes: {}" msgstr "" -#: money/money.py:418 +#: money/money.py:244 money/money.py:446 msgid "total expenses: {}" msgstr "" + +#: money/money.py:378 +msgid "latest {} movements:" +msgstr "" + +#: money/money.py:394 +msgid "matching movements: {}" +msgstr "" diff --git a/setup.py b/setup.py index 1ffded9..de5644c 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ here = path.abspath(path.dirname(__file__)) setup( name='money', - version='2.0.2', + version='2.0.3', description='Money handling program', long_description='A python program to handle expenses and incomes', url='http://code.scompo.it:3000/scompo/money', -- 2.25.1