plugger.py
changeset 623 8cdb533c3c7a
parent 619 8584ddae9385
child 624 8e74266033f8
equal deleted inserted replaced
622:885a224a35be 623:8cdb533c3c7a
   648         for d in self.PluginMethods:
   648         for d in self.PluginMethods:
   649             if d["method"]==method:
   649             if d["method"]==method:
   650                 d["shown"]=value
   650                 d["shown"]=value
   651                 return True
   651                 return True
   652         return False
   652         return False
       
   653 
       
   654     def CallMethod(self, method):
       
   655         for d in self.PluginMethods:
       
   656             if d["method"]==method and d.get("enabled", True) and d.get("shown", True):
       
   657                 getattr(self, method)()
   653 
   658 
   654 def _GetClassFunction(name):
   659 def _GetClassFunction(name):
   655     def GetRootClass():
   660     def GetRootClass():
   656         return getattr(__import__("plugins." + name), name).RootClass
   661         return getattr(__import__("plugins." + name), name).RootClass
   657     return GetRootClass
   662     return GetRootClass
  1383                 }
  1388                 }
  1384         plc_main_code += targets.targetcode(self.GetTarget().getcontent()["name"])
  1389         plc_main_code += targets.targetcode(self.GetTarget().getcontent()["name"])
  1385         return plc_main_code
  1390         return plc_main_code
  1386 
  1391 
  1387         
  1392         
  1388     def _build(self):
  1393     def _Build(self):
  1389         """
  1394         """
  1390         Method called by user to (re)build SoftPLC and plugin tree
  1395         Method called by user to (re)build SoftPLC and plugin tree
  1391         """
  1396         """
  1392         if self.AppFrame is not None:
  1397         if self.AppFrame is not None:
  1393             self.AppFrame.ClearErrors()
  1398             self.AppFrame.ClearErrors()
  1944 
  1949 
  1945     PluginMethods = [
  1950     PluginMethods = [
  1946         {"bitmap" : opjimg("Build"),
  1951         {"bitmap" : opjimg("Build"),
  1947          "name" : _("Build"),
  1952          "name" : _("Build"),
  1948          "tooltip" : _("Build project into build folder"),
  1953          "tooltip" : _("Build project into build folder"),
  1949          "method" : "_build"},
  1954          "method" : "_Build"},
  1950         {"bitmap" : opjimg("Clean"),
  1955         {"bitmap" : opjimg("Clean"),
  1951          "name" : _("Clean"),
  1956          "name" : _("Clean"),
  1952          "enabled" : False,
  1957          "enabled" : False,
  1953          "tooltip" : _("Clean project build folder"),
  1958          "tooltip" : _("Clean project build folder"),
  1954          "method" : "_Clean"},
  1959          "method" : "_Clean"},