ProjectController.py
changeset 730 4480b7da6bea
parent 728 e0424e96e3fd
child 731 4fc681ed0c61
equal deleted inserted replaced
729:25054c592dc4 730:4480b7da6bea
    57                 <xsd:choice minOccurs="0">
    57                 <xsd:choice minOccurs="0">
    58                 """+targets.targetchoices+"""
    58                 """+targets.targetchoices+"""
    59                 </xsd:choice>
    59                 </xsd:choice>
    60               </xsd:complexType>
    60               </xsd:complexType>
    61             </xsd:element>
    61             </xsd:element>
       
    62             <xsd:element name="Libraries" minOccurs="0">
       
    63               <xsd:complexType>
       
    64               """+"\n".join(['<xsd:attribute name="Enable_'+
       
    65                              lib.rsplit('.',1)[-1]+
       
    66                              '" type="xsd:boolean" use="optional" default="true"/>' 
       
    67                              for lib in features.libraries])+"""
       
    68               </xsd:complexType>
       
    69             </xsd:element>
    62           </xsd:sequence>
    70           </xsd:sequence>
    63           <xsd:attribute name="URI_location" type="xsd:string" use="optional" default=""/>
    71           <xsd:attribute name="URI_location" type="xsd:string" use="optional" default=""/>
    64           <xsd:attribute name="Disable_Extensions" type="xsd:boolean" use="optional" default="false"/>
    72           <xsd:attribute name="Disable_Extensions" type="xsd:boolean" use="optional" default="false"/>
    65           """+"\n".join(['<xsd:attribute name="Enable_'+lib.rsplit('.',1)[-1]+'" type="xsd:boolean" use="optional" default="true"/>' for lib in features.libraries])+"""
       
    66         </xsd:complexType>
    73         </xsd:complexType>
    67       </xsd:element>
    74       </xsd:element>
    68     </xsd:schema>
    75     </xsd:schema>
    69     """
    76     """
    70 
    77 
   104 
   111 
   105     def LoadLibraries(self):
   112     def LoadLibraries(self):
   106         self.Libraries = []
   113         self.Libraries = []
   107         TypeStack=[]
   114         TypeStack=[]
   108         for clsname in features.libraries:
   115         for clsname in features.libraries:
   109             if getattr(self.BeremizRoot, "Enable_"+clsname.rsplit('.',1)[-1]):
   116             if self.BeremizRoot.Libraries is None or getattr(self.BeremizRoot.Libraries, "Enable_"+clsname.rsplit('.',1)[-1]):
   110                 Lib = GetClassImporter(clsname)()(TypeStack)
   117                 Lib = GetClassImporter(clsname)()(TypeStack)
   111                 TypeStack.append(Lib.GetTypes())
   118                 TypeStack.append(Lib.GetTypes())
   112                 self.Libraries.append(Lib)
   119                 self.Libraries.append(Lib)
   113 
   120 
   114     def __del__(self):
   121     def __del__(self):
   346     def UpdateProjectVariableLocation(self, old_leading, new_leading):
   353     def UpdateProjectVariableLocation(self, old_leading, new_leading):
   347         self.Project.updateElementAddress(old_leading, new_leading)
   354         self.Project.updateElementAddress(old_leading, new_leading)
   348         self.BufferProject()
   355         self.BufferProject()
   349         if self.AppFrame is not None:
   356         if self.AppFrame is not None:
   350             self.AppFrame.RefreshTitle()
   357             self.AppFrame.RefreshTitle()
   351             self.AppFrame.RefreshInstancesTree()
   358             self.AppFrame.RefreshPouInstanceVariablesPanel()
   352             self.AppFrame.RefreshFileMenu()
   359             self.AppFrame.RefreshFileMenu()
   353             self.AppFrame.RefreshEditMenu()
   360             self.AppFrame.RefreshEditMenu()
   354             self.AppFrame.RefreshEditor()
   361             self.AppFrame.RefreshEditor()
   355     
   362     
   356     def GetVariableLocationTree(self):
   363     def GetVariableLocationTree(self):
  1335             if data is not None :
  1342             if data is not None :
  1336                 if self._connector.NewPLC(MD5, data, extrafiles) and self.GetIECProgramsAndVariables():
  1343                 if self._connector.NewPLC(MD5, data, extrafiles) and self.GetIECProgramsAndVariables():
  1337                     self.UnsubscribeAllDebugIECVariable()
  1344                     self.UnsubscribeAllDebugIECVariable()
  1338                     self.ProgramTransferred()
  1345                     self.ProgramTransferred()
  1339                     if self.AppFrame is not None:
  1346                     if self.AppFrame is not None:
  1340                         self.AppFrame.RefreshInstancesTree()
       
  1341                         self.AppFrame.CloseObsoleteDebugTabs()
  1347                         self.AppFrame.CloseObsoleteDebugTabs()
  1342                     self.logger.write(_("Transfer completed successfully.\n"))
  1348                     self.logger.write(_("Transfer completed successfully.\n"))
  1343                 else:
  1349                 else:
  1344                     self.logger.write_error(_("Transfer failed\n"))
  1350                     self.logger.write_error(_("Transfer failed\n"))
  1345             else:
  1351             else: