# HG changeset patch
# User Edouard Tisserant
# Date 1533554090 -7200
# Node ID 42566291b9bce249c3e83ba4468d1cbf03e7b851
# Parent  02f03bd7639e852e6bbcbee015026aa4677e3290
Make some POU libraries selected by default or not. This changes structure of features.libraries, please check and update your extensions if they use libraries

diff -r 02f03bd7639e -r 42566291b9bc ProjectController.py
--- a/ProjectController.py	Wed Jul 04 17:47:38 2018 +0300
+++ b/ProjectController.py	Mon Aug 06 13:14:50 2018 +0200
@@ -194,8 +194,9 @@
               <xsd:complexType>
               """+"\n".join(['<xsd:attribute name=' +
                              '"Enable_' + libname + '_Library" ' +
-                             'type="xsd:boolean" use="optional" default="false"/>'
-                             for libname, _lib in features.libraries])+"""
+                             'type="xsd:boolean" use="optional" default="' + 
+                                ('true' if default else 'false') + '"/>'
+                             for libname, _lib, default in features.libraries])+"""
               </xsd:complexType>
             </xsd:element>""") if len(features.libraries) > 0 else '') + """
           </xsd:sequence>
@@ -205,6 +206,7 @@
       </xsd:element>
     </xsd:schema>
     """
+    print XSD
     return XSD
 
 
@@ -270,7 +272,7 @@
     def LoadLibraries(self):
         self.Libraries = []
         TypeStack = []
-        for libname, clsname in features.libraries:
+        for libname, clsname, default in features.libraries:
             if self.BeremizRoot.Libraries is not None and getattr(self.BeremizRoot.Libraries, "Enable_"+libname+"_Library"):
                 Lib = GetClassImporter(clsname)()(self, libname, TypeStack)
                 TypeStack.append(Lib.GetTypes())
diff -r 02f03bd7639e -r 42566291b9bc features.py
--- a/features.py	Wed Jul 04 17:47:38 2018 +0300
+++ b/features.py	Mon Aug 06 13:14:50 2018 +0200
@@ -9,10 +9,10 @@
 # See COPYING file for copyrights details.
 
 libraries = [
-    ('Native', 'NativeLib.NativeLibrary'),
-    ('Python', 'py_ext.PythonLibrary'),
-    ('Etherlab', 'etherlab.EthercatMaster.EtherlabLibrary'),
-    ('SVGUI', 'svgui.SVGUILibrary')]
+    ('Native', 'NativeLib.NativeLibrary', True),
+    ('Python', 'py_ext.PythonLibrary', True),
+    ('Etherlab', 'etherlab.EthercatMaster.EtherlabLibrary', False),
+    ('SVGUI', 'svgui.SVGUILibrary', False)]
 
 catalog = [
     ('canfestival', _('CANopen support'), _('Map located variables over CANopen'), 'canfestival.canfestival.RootClass'),