Commit 0c2db90c authored by TOUZE Francois's avatar TOUZE Francois
Browse files

specify pathname of the user & softwares directories

parent 177583f6
......@@ -29,8 +29,8 @@ dataManager::dataManager() :
}
dataManager::dataManager(string userDir,string wrkDir,string s) :
workingDir_(wrkDir + "/"),
userDir_(userDir + "/"),
workingDir_(wrkDir),
userDir_(userDir),
nameOfCase_(s),
machineCourante_(NULL),
sectorCounter_(0),
......
......@@ -38,10 +38,17 @@ pspa::pspa ()
pspa::pspa (string basename)
{
nameOfCase_ = string();
dataManager_= NULL;
string userDir= basename + "workZone/";
string workingDir= basename + "pspa.git/softwares/";
dataManager_ = new dataManager(userDir,workingDir,nameOfCase_);
registerAllElements();
componentFactory::enregistrer( new sector( dataManager_ ) );
}
string userDir= basename + "workZone";
string workingDir= basename + "pspa/simulate";
pspa::pspa (string userDir,string workingDir)
{
nameOfCase_ = string();
dataManager_ = new dataManager(userDir,workingDir,nameOfCase_);
registerAllElements();
......
......@@ -17,6 +17,7 @@ class pspa
pspa ();
pspa ( string );
pspa ( string, string );
~pspa ();
string read( const char* );
......
......@@ -10,6 +10,7 @@ cdef extern from "cppcode.h":
cdef cppclass pspa:
pspa () except +
pspa ( string ) except +
pspa ( string, string ) except +
string read ( const char* );
bool simulate ();
bool execute ( string );
......
......@@ -12,7 +12,10 @@ cdef class Pypspa:
def __cinit__(self, string s) :
self.c_rect = new pspa( s )
def __cinit__(self, string s1, string s2) :
self.c_rect = new pspa( s1, s2 )
def __dealloc__(self):
del self.c_rect
......
......@@ -10,7 +10,7 @@ pspaplot::pspaplot() {}
// Overloaded constructor
pspaplot::pspaplot(string basename)
{
userDir_= basename + "workZone/";
userDir_= basename;
}
// Destructor
......
......@@ -17,14 +17,17 @@ cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
curdir = os.getcwd()
print( "current directory => ", curdir)
pkgRoot = curdir.split('pspa-web')
pkgRoot = curdir.split('pspa.git')
print( "root directory => ", pkgRoot[0])
upath = os.path.join(pkgRoot[0],'workZone/')
wpath = os.path.join(pkgRoot[0],'pspa.git/softwares/')
@app.route('/api/importe', methods=['GET', 'POST'])
def importe():
up_bytes= str.encode( pkgRoot[0] )
ptr= pspacode.Pypspa( up_bytes )
u_bytes= str.encode( upath )
w_bytes= str.encode( wpath )
ptr= pspacode.Pypspa( u_bytes, w_bytes )
x= request.json
print( "/api/importe => ", x['fileName'] )
......@@ -44,8 +47,9 @@ def simulate():
#print( "y => ", x["simulations"])
#print( "z => ", x["projectName"])
up_bytes= str.encode( pkgRoot[0] )
ptr= pspacode.Pypspa( up_bytes )
u_bytes= str.encode( upath )
w_bytes= str.encode( wpath )
ptr= pspacode.Pypspa( u_bytes, w_bytes )
data= json.dumps(x, ensure_ascii=False)
x_bytes= str.encode( data )
......@@ -63,8 +67,8 @@ def simulate():
@app.route('/api/console', methods=['GET', 'POST'])
def console():
#print( "api/console => ", request.full_path)
print( "api/console => ", request.full_path)
""" x is the list after splitting by the separator 'ids='
"""
x = request.full_path.split("ids=")
......@@ -76,13 +80,12 @@ def console():
#print( "api/pourVoir y => ", y)
z= []
if len(y[0]) > 0:
path= os.path.join(pkgRoot[0],'workZone/')
if len(y[0]) > 0:
for item in y:
d={"id":urllib.parse.unquote( item )}
ids= urllib.parse.unquote( item ).split()
out= ids[0]+"-output.txt"
fname= os.path.join(path,out)
fname= os.path.join(upath,out)
if os.path.exists( fname ):
fp= open(fname).read()
d["output"]= fp
......@@ -108,7 +111,8 @@ def plots():
x2= x['plotItem']
print( "/api/plots x2=> ", x2, type(x2) )
"""
up_bytes= str.encode( pkgRoot[0] )
up_bytes= str.encode( upath )
ptr= pspaplot.Pypspaplot( up_bytes )
data= json.dumps(x, ensure_ascii=False)
......@@ -116,7 +120,7 @@ def plots():
ptr.settings( x_bytes )
data= os.path.join(pkgRoot[0],'workZone/simulator-plot.txt')
data= os.path.join(upath,'simulator-plot.txt')
"""
data= os.path.join(pkgRoot[0],"workZone/raf.txt")
......
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
}
}
}
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}
# pspa/frontend
# pspa
> Plateforme de Simulation Pour les Accélerateurs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment