Skip to content
Snippets Groups Projects
Commit d54e07e8 authored by Vincent Texier's avatar Vincent Texier
Browse files

refs #335 Fix broken referentials after merge and add informations about "Past UD"

parent b46c02e6
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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):
......
......@@ -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
......
......@@ -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
)
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment