diff --git a/src/sakia/core/money/quant_zerosum.py b/src/sakia/core/money/quant_zerosum.py index c77a009a..e023c4c2 100644 --- a/src/sakia/core/money/quant_zerosum.py +++ b/src/sakia/core/money/quant_zerosum.py @@ -37,12 +37,12 @@ def translated_name(cls): 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 ac6cfcb8..55434344 100644 --- a/src/sakia/core/money/quantitative.py +++ b/src/sakia/core/money/quantitative.py @@ -27,12 +27,12 @@ def translated_name(cls): 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 697ec8be..fd651ebc 100644 --- a/src/sakia/core/money/relative.py +++ b/src/sakia/core/money/relative.py @@ -38,12 +38,12 @@ def translated_name(cls): 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 8fdae53c..daaef168 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) +
+ + + + + +
RRelative value
QQuantitative value
UDUniversal Dividend
tTime when the value appeared
""" + ) + _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', '
')) def __init__(self, amount, community, app, block_number=None): super().__init__(amount, community, app, block_number) @@ -19,6 +36,13 @@ def translated_name(cls): 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 1495fa29..5837cac2 100644 --- a/src/sakia/core/money/relative_zerosum.py +++ b/src/sakia/core/money/relative_zerosum.py @@ -36,12 +36,12 @@ def translated_name(cls): 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 46c17eb4..e541aee3 100644 --- a/src/sakia/gui/informations_tab.py +++ b/src/sakia/gui/informations_tab.py @@ -206,11 +206,15 @@ async def refresh_labels(self): """ 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 ) )