# HG changeset patch # User laurent # Date 1323872267 -3600 # Node ID eb2d9f2b356769a4726f32acbd0ff7a34a67ff36 # Parent cbeb769b0a565effa78d8ccf8e2243376b2b6853 Adding support for loading specific POUs library in LPCBeremiz diff -r cbeb769b0a56 -r eb2d9f2b3567 LPCBeremiz.py --- a/LPCBeremiz.py Wed Dec 14 15:17:36 2011 +0100 +++ b/LPCBeremiz.py Wed Dec 14 15:17:47 2011 +0100 @@ -364,7 +364,7 @@ @param dst: destination directory """ for i in os.listdir(src): - if not i.startswith('.'): + if not i.startswith('.') and i != "pous.xml": srcpath = os.path.join(src,i) dstpath = os.path.join(dst,i) if os.path.isdir(srcpath): @@ -405,11 +405,14 @@ "method" : "_Transfer"}, ] - def __init__(self, frame, logger): + def __init__(self, frame, logger, buildpath): + self.OrigBuildPath = buildpath + PluginsRoot.__init__(self, frame, logger) self.PlugChildsTypes += [("LPCBus", LPCBus, "LPC bus")] - + self.PlugType = "LPC" + self.OnlineMode = "OFF" self.LPCConnector = None @@ -419,7 +422,13 @@ self.SimulationBuildPath = None self.AbortTransferTimer = None - + + def PluginLibraryFilePath(self): + if self.OrigBuildPath is not None: + return os.path.join(self.OrigBuildPath, "pous.xml") + else: + return PluginsRoot.PluginLibraryFilePath(self) + def GetProjectName(self): return self.Project.getname() @@ -568,9 +577,8 @@ self.ProjectPath = ProjectPath self.BuildPath = self._getBuildPath() - self.OrigBuildPath = BuildPath - if BuildPath is not None: - mycopytree(BuildPath, self.BuildPath) + if self.OrigBuildPath is not None: + mycopytree(self.OrigBuildPath, self.BuildPath) # If dir have already be made, and file exist if os.path.isdir(self.PlugPath()) and os.path.isfile(self.PluginXmlFilePath()): @@ -1527,9 +1535,9 @@ Log = StdoutPseudoFile(port) - PluginRoot = LPCPluginsRoot(None, Log) + PluginRoot = LPCPluginsRoot(None, Log, buildpath) if projectOpen is not None and os.path.isdir(projectOpen): - result = PluginRoot.LoadProject(projectOpen, buildpath) + result = PluginRoot.LoadProject(projectOpen) if result: Log.write("Error: Invalid project directory", result) else: diff -r cbeb769b0a56 -r eb2d9f2b3567 plugger.py --- a/plugger.py Wed Dec 14 15:17:36 2011 +0100 +++ b/plugger.py Wed Dec 14 15:17:47 2011 +0100 @@ -137,6 +137,9 @@ return os.path.join(self.PlugParent.PlugPath(), PlugName + NameTypeSeparator + self.PlugType) + def GetIconPath(self, name): + return opjimg(name) + def PlugTestModified(self): return self.ChangesToSave @@ -294,7 +297,7 @@ def BlockTypesFactory(self): if self.LibraryControler is not None: - return [{"name" : "%s POUs" % self.PlugType, "list": self.LibraryControler.Project.GetCustomBlockTypes()}] + return [{"name" : _("%s POUs") % self.PlugType, "list": self.LibraryControler.Project.GetCustomBlockTypes()}] return [] def ParentsBlockTypesFactory(self): @@ -790,6 +793,8 @@ ID_STATUSTIMER = wx.NewId() self.StatusTimer = wx.Timer(self.AppFrame, ID_STATUSTIMER) self.AppFrame.Bind(wx.EVT_TIMER, self.PullPLCStatusProc, self.StatusTimer) + + self.RefreshPluginsBlockLists() def ResetAppFrame(self, logger): if self.AppFrame is not None: