~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Tools/generateTemplates/templateModuleAppMain.py

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-07-16 18:37:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090716183741-oww9kcxqrk991i1n
Tags: upstream-0.8.2237
ImportĀ upstreamĀ versionĀ 0.8.2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! python
 
2
# -*- coding: utf-8 -*-
 
3
# (c) 2006 Juergen Riegel 
 
4
 
 
5
import template
 
6
import generateBase.generateModel_Module
 
7
import generateBase.generateTools
 
8
 
 
9
class TemplateModuleAppMain (template.ModelTemplate):
 
10
        def Generate(self):
 
11
                file = open(self.path + "/App" + self.module.Name + ".cpp",'w')
 
12
                generateBase.generateTools.replace(self.Template,locals(),file)
 
13
                #file.write( generateBase.generateTools.replace(self.Template,locals()))
 
14
 
 
15
        Template = """
 
16
/***************************************************************************
 
17
 *   This program is free software; you can redistribute it and/or modify  *
 
18
 *   it under the terms of the GNU Library General Public License as       *
 
19
 *   published by the Free Software Foundation; either version 2 of the    *
 
20
 *   License, or (at your option) any later version.                       *
 
21
 *   for detail see the LICENCE text file.                                 *
 
22
 *                                                                         *
 
23
 ***************************************************************************/
 
24
 
 
25
#include "PreCompiled.h"
 
26
#ifndef _PreComp_
 
27
# include <Python.h>
 
28
#endif
 
29
 
 
30
#include <Base/Console.h>
 
31
 
 
32
+ for i in self.module.Content.Feature:
 
33
#include "Feature/@i.Name@.h"
 
34
-
 
35
 
 
36
extern struct PyMethodDef @self.module.Name@_methods[];
 
37
 
 
38
 
 
39
extern "C" {
 
40
void App@self.module.Name@Export init@self.module.Name@() {
 
41
 
 
42
  Base::Console().Log("Mod: Loading @self.module.Name@ module... done\\n");
 
43
  PyObject* partModule = Py_InitModule3("@self.module.Name@", @self.module.Name@_methods, module_@self.module.Name@_doc);   /* mod name, table ptr */
 
44
 
 
45
+ for i in self.module.Content.Feature:
 
46
  @self.module.Name@::Feature@i.Name@::init();
 
47
-
 
48
 
 
49
        return;
 
50
}
 
51
 
 
52
} // extern "C"
 
53
"""
 
 
b'\\ No newline at end of file'