diff --git a/src/sakia/core/money/quant_zerosum.py b/src/sakia/core/money/quant_zerosum.py index c77a009abf51260b108203f3c227b89543ba8209..e023c4c2afee2ef29e4a44ac98d07050a90f8cc8 100644 --- a/src/sakia/core/money/quant_zerosum.py +++ b/src/sakia/core/money/quant_zerosum.py @@ -37,12 +37,12 @@ class QuantitativeZSum(BaseReferential): def units(self): return QCoreApplication.translate("QuantitativeZSum", QuantitativeZSum._UNITS_STR_).format(self.community.short_currency) - @classmethod - def formula(cls): + @property + def formula(self): return QCoreApplication.translate('QuantitativeZSum', QuantitativeZSum._FORMULA_STR_) - @classmethod - def description(cls): + @property + def description(self): return QCoreApplication.translate("QuantitativeZSum", QuantitativeZSum._DESCRIPTION_STR_) @property diff --git a/src/sakia/core/money/quantitative.py b/src/sakia/core/money/quantitative.py index ac6cfcb8d23cafc08e37af36ce972ed70c7bcbfc..55434344501b59050c7c50bb9d1ac83297f67561 100644 --- a/src/sakia/core/money/quantitative.py +++ b/src/sakia/core/money/quantitative.py @@ -27,12 +27,12 @@ class Quantitative(BaseReferential): def units(self): return QCoreApplication.translate("Quantitative", Quantitative._UNITS_STR_).format(self.community.short_currency) - @classmethod - def formula(cls): + @property + def formula(self): return QCoreApplication.translate('Quantitative', Quantitative._FORMULA_STR_) - @classmethod - def description(cls): + @property + def description(self): return QCoreApplication.translate("Quantitative", Quantitative._DESCRIPTION_STR_) @property diff --git a/src/sakia/core/money/relative.py b/src/sakia/core/money/relative.py index 697ec8be2c6f9fd5aae843d8772f5bb10d0a27b4..fd651ebc6b80e97c41c328ba1802cc6577314d91 100644 --- a/src/sakia/core/money/relative.py +++ b/src/sakia/core/money/relative.py @@ -38,12 +38,12 @@ class Relative(BaseReferential): def units(self): return QCoreApplication.translate("Relative", Relative._UNITS_STR_).format(self.community.short_currency) - @classmethod - def formula(cls): + @property + def formula(self): return QCoreApplication.translate('Relative', Relative._FORMULA_STR_) - @classmethod - def description(cls): + @property + def description(self): return QCoreApplication.translate("Relative", Relative._DESCRIPTION_STR_) @property diff --git a/src/sakia/core/money/relative_to_past.py b/src/sakia/core/money/relative_to_past.py index 8fdae53c34b54ec1aa3b136ac2219936b945494c..daaef1683358b9d81500f8acd426346c580c6a3e 100644 --- a/src/sakia/core/money/relative_to_past.py +++ b/src/sakia/core/money/relative_to_past.py @@ -7,6 +7,23 @@ class RelativeToPast(BaseReferential): _NAME_STR_ = QT_TRANSLATE_NOOP('RelativeToPast', 'Past UD') _REF_STR_ = QT_TRANSLATE_NOOP('RelativeToPast', "{0} {1}UD({2}) {3}") _UNITS_STR_ = QT_TRANSLATE_NOOP('RelativeToPast', "UD({0}) {1}") + _FORMULA_STR_ = QT_TRANSLATE_NOOP('RelativeToPast', + """R = Q / UD(t) + <br > + <table> + <tr><td>R</td><td>Relative value</td></tr> + <tr><td>Q</td><td>Quantitative value</td></tr> + <tr><td>UD</td><td>Universal Dividend</td></tr> + <tr><td>t</td><td>Time when the value appeared</td></tr> + </table>""" + ) + _DESCRIPTION_STR_ = QT_TRANSLATE_NOOP('RelativeToPast', + """Relative referential using UD at the Time when the value appeared. + Relative value R is calculated by dividing the quantitative value Q by the + Universal Dividend UD at the Time when the value appeared. + All past UD created are displayed with a value of 1 UD. + This referential is practical to remember what was the value at the Time. + """.replace('\n', '<br >')) def __init__(self, amount, community, app, block_number=None): super().__init__(amount, community, app, block_number) @@ -19,6 +36,13 @@ class RelativeToPast(BaseReferential): def units(self): return QCoreApplication.translate("RelativeToPast", RelativeToPast._UNITS_STR_).format('t', self.community.short_currency) + @property + def formula(self): + return QCoreApplication.translate('RelativeToPast', RelativeToPast._FORMULA_STR_) + + @property + def description(self): + return QCoreApplication.translate("RelativeToPast", RelativeToPast._DESCRIPTION_STR_) @property def diff_units(self): diff --git a/src/sakia/core/money/relative_zerosum.py b/src/sakia/core/money/relative_zerosum.py index 1495fa29e394f647bb7a6275053d908a36e39368..5837cac2c0531df0c040846d1a4f4e8c421dcf87 100644 --- a/src/sakia/core/money/relative_zerosum.py +++ b/src/sakia/core/money/relative_zerosum.py @@ -36,12 +36,12 @@ class RelativeZSum(BaseReferential): def units(self): return QCoreApplication.translate("RelativeZSum", RelativeZSum._UNITS_STR_).format(self.community.short_currency) - @classmethod - def formula(cls): + @property + def formula(self): return QCoreApplication.translate('RelativeZSum', RelativeZSum._FORMULA_STR_) - @classmethod - def description(cls): + @property + def description(self): return QCoreApplication.translate("RelativeZSum", RelativeZSum._DESCRIPTION_STR_) @property diff --git a/src/sakia/gui/informations_tab.py b/src/sakia/gui/informations_tab.py index 46c17eb4c94a12c81718be5bf3be396a1dcd1914..e541aee3414aabee0e55ebd66d4815f24f07a597 100644 --- a/src/sakia/gui/informations_tab.py +++ b/src/sakia/gui/informations_tab.py @@ -206,11 +206,15 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget): </table> """ templates = [] - for ref in Referentials: + for ref_class in Referentials: + ref = ref_class(0, self.community, self.app, None) + # print(ref_class.__class__.__name__) + # if ref_class.__class__.__name__ == 'RelativeToPast': + # continue templates.append(ref_template.format(self.tr('Name'), ref.translated_name(), - self.tr('Units'), ref.units(self.community.currency), - self.tr('Formula'), ref.formula(), - self.tr('Description'), ref.description() + self.tr('Units'), ref.units, + self.tr('Formula'), ref.formula, + self.tr('Description'), ref.description ) )