equal
deleted
inserted
replaced
235 projectfiles_path = os.path.join(self.GetProjectPath(), "project_files") |
235 projectfiles_path = os.path.join(self.GetProjectPath(), "project_files") |
236 if not os.path.exists(projectfiles_path): |
236 if not os.path.exists(projectfiles_path): |
237 os.mkdir(projectfiles_path) |
237 os.mkdir(projectfiles_path) |
238 return projectfiles_path |
238 return projectfiles_path |
239 |
239 |
|
240 def AddProjectDefaultConfiguration(self, config_name="config", res_name="resource1"): |
|
241 self.ProjectAddConfiguration(config_name) |
|
242 self.ProjectAddConfigurationResource(config_name, res_name) |
|
243 |
240 def NewProject(self, ProjectPath, BuildPath=None): |
244 def NewProject(self, ProjectPath, BuildPath=None): |
241 """ |
245 """ |
242 Create a new project in an empty folder |
246 Create a new project in an empty folder |
243 @param ProjectPath: path of the folder where project have to be created |
247 @param ProjectPath: path of the folder where project have to be created |
244 @param PLCParams: properties of the PLCOpen program created |
248 @param PLCParams: properties of the PLCOpen program created |
252 {"projectName": _("Unnamed"), |
256 {"projectName": _("Unnamed"), |
253 "productName": _("Unnamed"), |
257 "productName": _("Unnamed"), |
254 "productVersion": "1", |
258 "productVersion": "1", |
255 "companyName": _("Unknown"), |
259 "companyName": _("Unknown"), |
256 "creationDateTime": datetime(*localtime()[:6])}) |
260 "creationDateTime": datetime(*localtime()[:6])}) |
257 self.ProjectAddConfiguration("config") |
261 self.AddProjectDefaultConfiguration() |
258 self.ProjectAddConfigurationResource("config", "resource1") |
|
259 |
262 |
260 # Change XSD into class members |
263 # Change XSD into class members |
261 self._AddParamsMembers() |
264 self._AddParamsMembers() |
262 self.Children = {} |
265 self.Children = {} |
263 # Keep track of the root confnode (i.e. project path) |
266 # Keep track of the root confnode (i.e. project path) |
282 return _("Chosen folder doesn't contain a program. It's not a valid project!") |
285 return _("Chosen folder doesn't contain a program. It's not a valid project!") |
283 # Load PLCOpen file |
286 # Load PLCOpen file |
284 result = self.OpenXMLFile(plc_file) |
287 result = self.OpenXMLFile(plc_file) |
285 if result: |
288 if result: |
286 return result |
289 return result |
|
290 if len(self.GetProjectConfigNames()) == 0: |
|
291 self.AddProjectDefaultConfiguration() |
287 # Change XSD into class members |
292 # Change XSD into class members |
288 self._AddParamsMembers() |
293 self._AddParamsMembers() |
289 self.Children = {} |
294 self.Children = {} |
290 # Keep track of the root confnode (i.e. project path) |
295 # Keep track of the root confnode (i.e. project path) |
291 self.ProjectPath = ProjectPath |
296 self.ProjectPath = ProjectPath |