merge
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 09 Dec 2024 15:51:41 +0100 (3 months ago)
changeset 4067 bafb3f25d5bd
parent 4065 d876242447da (diff)
parent 4066 e894ff2a2584 (current diff)
child 4068 4f47609a5f62
merge
--- a/PLCControler.py	Fri Dec 06 15:48:54 2024 +0100
+++ b/PLCControler.py	Mon Dec 09 15:51:41 2024 +0100
@@ -1357,12 +1357,7 @@
         return [x for x, _y in TypeHierarchy_list if not x.startswith("ANY")]
 
     def IsOfType(self, typename, reference, debug=False):
-        if typename is None or reference is None:
-            return True
-        
-        typename = typename.upper()
-        reference = reference.upper()
-        if typename == reference:
+        if reference is None or typename == reference:
             return True
 
         basetype = TypeHierarchy.get(typename)
--- a/PLCOpenEditor.py	Fri Dec 06 15:48:54 2024 +0100
+++ b/PLCOpenEditor.py	Mon Dec 09 15:51:41 2024 +0100
@@ -273,7 +273,7 @@
 
         result = None
 
-        dialog = wx.FileDialog(self, _("Choose a file"), directory, "",  _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.OPEN)
+        dialog = wx.FileDialog(self, _("Choose a file"), directory, "",  _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.FD_OPEN)
         if dialog.ShowModal() == wx.ID_OK:
             filepath = dialog.GetPath()
             if os.path.isfile(filepath):
--- a/editors/Viewer.py	Fri Dec 06 15:48:54 2024 +0100
+++ b/editors/Viewer.py	Mon Dec 09 15:51:41 2024 +0100
@@ -2538,8 +2538,8 @@
 
     def GetScaledSize(self, width, height):
         if self.Scaling is not None:
-            width = round(width / self.Scaling[0] + 0.4) * self.Scaling[0]
-            height = round(height / self.Scaling[1] + 0.4) * self.Scaling[1]
+            width = round((width / self.Scaling[0] + 0.4) * self.Scaling[0])
+            height = round((height / self.Scaling[1] + 0.4) * self.Scaling[1])
         return width, height
 
     def AddNewElement(self, element, bbox, wire=None, connector=None):
--- a/plcopen/pou_block_instances.xslt	Fri Dec 06 15:48:54 2024 +0100
+++ b/plcopen/pou_block_instances.xslt	Mon Dec 09 15:51:41 2024 +0100
@@ -112,6 +112,9 @@
       </xsl:apply-templates>
     </xsl:for-each>
   </xsl:template>
+  <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*">
+    <xsl:value-of select="local-name()"/>
+  </xsl:template>
   <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived">
     <xsl:value-of select="@name"/>
   </xsl:template>
@@ -121,9 +124,6 @@
   <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring">
     <xsl:text>WSTRING</xsl:text>
   </xsl:template>
-  <xsl:template match="*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*">
-    <xsl:value-of select="local-name()"/>
-  </xsl:template>
   <xsl:template name="VariableBlockInfos">
     <xsl:param name="type"/>
     <xsl:variable name="expression">
--- a/plcopen/pou_block_instances.ysl2	Fri Dec 06 15:48:54 2024 +0100
+++ b/plcopen/pou_block_instances.ysl2	Mon Dec 09 15:51:41 2024 +0100
@@ -102,6 +102,10 @@
         }
     }
     
+    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*" {
+        > «local-name()»
+    }
+    
     template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived" {
         > «@name»
     }
@@ -114,10 +118,6 @@
         > WSTRING
     }
     
-    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*" {
-        > «local-name()»
-    }
-    
     function "VariableBlockInfos" {
         param "type";
         variable "expression" > «ppx:expression/text()»