-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
small changes to the scripts, add module example
- Loading branch information
Joerg Raedler
committed
Apr 11, 2019
1 parent
1709e79
commit 74a6a76
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
# This file is part of CoTeTo - a code generation tool | ||
# 20170602 Joerg Raedler [email protected] | ||
# | ||
# This is the commandline interface to CoTeTo. | ||
# Run `python CoTeTo-cli.py --help` to get help on the | ||
# commandline options and arguements | ||
|
||
import os | ||
import sys | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
# This file is part of CoTeTo - a code generation tool | ||
# 20170602 Joerg Raedler [email protected] | ||
# | ||
# This is the graphical user interface to CoTeTo. | ||
# Run `python CoTeTo-gui.py --help` to get help on the | ||
# commandline options and arguements | ||
|
||
import os | ||
import sys | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
#-*- coding:utf-8 -*- | ||
# | ||
# This file is part of CoTeTo - a code generation tool | ||
# 20190411 Joerg Raedler [email protected] | ||
# | ||
# This is an example of the usage of CoTeTo as a python module. | ||
# | ||
|
||
import os | ||
import sys | ||
|
||
# check if we are running in the development folder - | ||
# just a hack to run this script without installing CoTeTo first - | ||
# usually not needed for users | ||
parent = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) | ||
if os.path.isfile(os.path.join(parent, 'setup.py')): | ||
sys.path.insert(0, parent) | ||
|
||
#### Example Code | ||
|
||
# 1. import the controller class from CoTeTo | ||
from CoTeTo.Controller import Controller | ||
|
||
# 2. initialize a controller instance | ||
# for a list of optional arguments see CoTeTo/Controller.py | ||
con = Controller() | ||
|
||
# 3. choose a generator ... | ||
# a list of available generators can be printed with print(con.generators.keys()) | ||
gen = con.generators['Example01Mako::1.0'] | ||
|
||
# 4. ... and execute it! | ||
# arguments are: | ||
# a list of input URIs (not used with the dummy loader) | ||
# a filename or prefix for the output | ||
gen.execute(('spam', ), 'ModuleTestOutput.txt') |