use translatable descriptions for stadard and additional IEC function
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 11 Jan 2017 14:15:45 +0300
changeset 1625 be3f68731798
parent 1624 bc84d659894f
child 1626 0779c1b18c01
use translatable descriptions for stadard and additional IEC function
blocks from xml files instead of hardcoded in python
i18n/app.fil
plcopen/definitions.py
--- a/i18n/app.fil	Wed Jan 11 12:57:40 2017 +0300
+++ b/i18n/app.fil	Wed Jan 11 14:15:45 2017 +0300
@@ -116,3 +116,5 @@
 ../IDEFrame.py
 ../PLCGenerator.py
 ../Beremiz_service.py
+../plcopen/Additional_Function_Blocks.xml
+../plcopen/Standard_Function_Blocks.xml
\ No newline at end of file
--- a/plcopen/definitions.py	Wed Jan 11 12:57:40 2017 +0300
+++ b/plcopen/definitions.py	Wed Jan 11 14:15:45 2017 +0300
@@ -48,35 +48,8 @@
 
 StdFuncsCSV = join(sd,"iec_std.csv")
 
-# FIXME : since std fb now loaded from TC6 file, is that still necessary ?
-StdBlockComments = {
-    "SR": _("SR bistable\nThe SR bistable is a latch where the Set dominates."),
-    "RS": _("RS bistable\nThe RS bistable is a latch where the Reset dominates."),
-    "SEMA": _("Semaphore\nThe semaphore provides a mechanism to allow software elements mutually exclusive access to certain ressources."),
-    "R_TRIG": _("Rising edge detector\nThe output produces a single pulse when a rising edge is detected."),
-    "F_TRIG": _("Falling edge detector\nThe output produces a single pulse when a falling edge is detected."),
-    "CTU": _("Up-counter\nThe up-counter can be used to signal when a count has reached a maximum value."),
-    "CTD": _("Down-counter\nThe down-counter can be used to signal when a count has reached zero, on counting down from a preset value."),
-    "CTUD": _("Up-down counter\nThe up-down counter has two inputs CU and CD. It can be used to both count up on one input and down on the other."),
-    "TP": _("Pulse timer\nThe pulse timer can be used to generate output pulses of a given time duration."),
-    "TON": _("On-delay timer\nThe on-delay timer can be used to delay setting an output true, for fixed period after an input becomes true."),
-    "TOF": _("Off-delay timer\nThe off-delay timer can be used to delay setting an output false, for fixed period after input goes false."),
-    "RTC": _("Real time clock\nThe real time clock has many uses including time stamping, setting dates and times of day in batch reports, in alarm messages and so on."),
-    "INTEGRAL": _("Integral\nThe integral function block integrates the value of input XIN over time."),
-    "DERIVATIVE": _("Derivative\nThe derivative function block produces an output XOUT proportional to the rate of change of the input XIN."),
-    "PID": _("PID\nThe PID (proportional, Integral, Derivative) function block provides the classical three term controller for closed loop control."),
-    "RAMP": _("Ramp\nThe RAMP function block is modelled on example given in the standard."),
-    "HYSTERESIS": _("Hysteresis\nThe hysteresis function block provides a hysteresis boolean output driven by the difference of two floating point (REAL) inputs XIN1 and XIN2."),
-}
-
-for block_type in ["CTU", "CTD", "CTUD"]:
-    for return_type in ["DINT", "LINT", "UDINT", "ULINT"]:
-        StdBlockComments["%s_%s" % (block_type, return_type)] = StdBlockComments[block_type]
-
 def GetBlockInfos(pou):
     infos = pou.getblockInfos()
-    # FIXME : as well
-    infos["comment"] = StdBlockComments[infos["name"]]
     infos["inputs"] = [
         (var_name, var_type, "rising")
         if var_name in ["CU", "CD"]