Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linuxbin
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aerospace and Mechanical Engineering
linuxbin
Commits
f20d4e2d
Commit
f20d4e2d
authored
4 years ago
by
Boman Romain
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master' into boman
parents
e45bf132
c7567002
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
postProLoop.py
+70
-1
70 additions, 1 deletion
postProLoop.py
postProLoopGui.pyw
+37
-21
37 additions, 21 deletions
postProLoopGui.pyw
with
107 additions
and
22 deletions
postProLoop.py
+
70
−
1
View file @
f20d4e2d
...
...
@@ -13,6 +13,7 @@ import externalProgramPath
# Variable globale
import
threading
matlock
=
threading
.
Lock
()
# un seul matlab a la fois (merdouille avec le R2009a sous windows)
sciLock
=
threading
.
Lock
()
# un seul SciLab a la fois (vérifier nécessité)
#------------------------------------------------------------------------------------
class
PostProLoop
(
PRMSet
):
...
...
@@ -47,6 +48,12 @@ class PostProLoop(PRMSet):
TextPRM
(
self
.
pars
,
'
MATLABCMD
'
,
'
Matlab Command (script called)
'
,
''
)
TextPRM
(
self
.
pars
,
'
MATLABPATH
'
,
'
Path to Matlab scripts
'
,
''
)
TextPRM
(
self
.
pars
,
'
MATLABREQUEST
'
,
'
Requested file to run Matlab script
'
,
'
parameters.m
'
)
#'result.mat', ...
# Scilab
YesNoPRM
(
self
.
pars
,
'
SCILABRUN
'
,
'
Execute a Scilab function
'
,
False
)
TextPRM
(
self
.
pars
,
'
SCILABEXE
'
,
'
Path To Scilab Exe
'
,
progs
[
'
SCILAB
'
])
TextPRM
(
self
.
pars
,
'
SCILABCMD
'
,
'
Scilab Command (script called)
'
,
''
)
TextPRM
(
self
.
pars
,
'
SCILABPATH
'
,
'
Path to Scilab scripts
'
,
''
)
TextPRM
(
self
.
pars
,
'
SCILABREQUEST
'
,
'
Requested file to run Scilab script
'
,
'
parameters.sci
'
)
#'result.sod', ...
# GS
YesNoPRM
(
self
.
pars
,
'
GSRUN
'
,
'
Run GS on Eps Files
'
,
False
)
TextPRM
(
self
.
pars
,
'
GSEXE
'
,
'
Path To Matlab Exe
'
,
progs
[
'
GHOSTSCRIPT
'
])
...
...
@@ -76,6 +83,14 @@ class PostProLoop(PRMSet):
PRMAction
(
self
.
actions
,
'
i
'
,
self
.
pars
[
'
MATLABPATH
'
])
PRMAction
(
self
.
actions
,
'
j
'
,
self
.
pars
[
'
MATLABREQUEST
'
])
NoAction
(
self
.
actions
)
# Scilab
NoAction
(
self
.
actions
)
PRMAction
(
self
.
actions
,
'
1
'
,
self
.
pars
[
'
SCILABRUN
'
])
PRMAction
(
self
.
actions
,
'
2
'
,
self
.
pars
[
'
SCILABEXE
'
])
PRMAction
(
self
.
actions
,
'
3
'
,
self
.
pars
[
'
SCILABCMD
'
])
PRMAction
(
self
.
actions
,
'
4
'
,
self
.
pars
[
'
SCILABPATH
'
])
PRMAction
(
self
.
actions
,
'
5
'
,
self
.
pars
[
'
SCILABREQUEST
'
])
NoAction
(
self
.
actions
)
# GhostScript
PRMAction
(
self
.
actions
,
'
k
'
,
self
.
pars
[
'
GSRUN
'
])
PRMAction
(
self
.
actions
,
'
l
'
,
self
.
pars
[
'
GSEXE
'
])
...
...
@@ -107,6 +122,11 @@ class PostProLoop(PRMSet):
self
.
pars
[
'
MATLABEXE
'
].
enable
(
self
.
pars
[
'
MATLABRUN
'
].
val
==
True
)
self
.
pars
[
'
MATLABPATH
'
].
enable
(
self
.
pars
[
'
MATLABRUN
'
].
val
==
True
)
self
.
pars
[
'
MATLABREQUEST
'
].
enable
(
self
.
pars
[
'
MATLABRUN
'
].
val
==
True
)
# Scilab
self
.
pars
[
'
SCILABCMD
'
].
enable
(
self
.
pars
[
'
SCILABRUN
'
].
val
==
True
)
self
.
pars
[
'
SCILABEXE
'
].
enable
(
self
.
pars
[
'
SCILABRUN
'
].
val
==
True
)
self
.
pars
[
'
SCILABPATH
'
].
enable
(
self
.
pars
[
'
SCILABRUN
'
].
val
==
True
)
self
.
pars
[
'
SCILABREQUEST
'
].
enable
(
self
.
pars
[
'
SCILABRUN
'
].
val
==
True
)
# GhostScript
self
.
pars
[
'
GSEXE
'
].
enable
(
self
.
pars
[
'
GSRUN
'
].
val
==
True
)
self
.
pars
[
'
GSFILTER
'
].
enable
(
self
.
pars
[
'
GSRUN
'
].
val
==
True
)
...
...
@@ -184,6 +204,11 @@ class PostProLoop(PRMSet):
#out = matlab.execMatlabScript(self.pars['MATLABCMD'].val , self.pars['MATLABPATH'].val)
print
(
"
matlab done
"
)
if
self
.
pars
[
'
SCILABRUN
'
].
val
and
self
.
checkRequest
(
self
.
pars
[
'
SCILABREQUEST
'
].
val
):
print
(
"
launch scilab...
"
)
out
=
execScilabScript
(
self
.
pars
[
'
SCILABEXE
'
].
val
,
self
.
pars
[
'
SCILABCMD
'
].
val
,
self
.
pars
[
'
SCILABPATH
'
].
val
)
#out = scilab.execScilabScript(self.pars['SCILABCMD'].val , self.pars['SCILABPATH'].val)
print
(
"
scilab done
"
)
if
self
.
pars
[
'
GSRUN
'
].
val
and
self
.
checkRequest
(
self
.
pars
[
'
GSREQUEST
'
].
val
):
print
(
"
launch Ghostscript translation of eps files...
"
)
#execGhostScriptPostPro(device='png256', outExt='png',res=300)
...
...
@@ -243,7 +268,51 @@ def execMatlabScript(matlabExe, matlabCmd, mFilePath=None):
return
a
#=================================================================================
#=================================================================================
def
execScilabScript
(
scilabExe
,
scilabCmd
,
sciFilePath
=
None
,
verb
=
True
):
sciCmd
=
""
if
sciFilePath
:
print
(
"
sciFilePath =
"
,
sciFilePath
)
sciCmd
=
sciCmd
+
"
getd(
'
%s
'
);
"
%
sciFilePath
sciCmd
=
sciCmd
+
scilabCmd
if
verb
:
print
(
"
entering execSciLabPostPro
"
)
print
(
"
sciCmd =
"
,
sciCmd
)
progs
=
externalProgramPath
.
ExtProgs
()
if
not
progs
.
checkValidity
(
'
SCILAB
'
)
:
return
0
# log file
logFile
=
os
.
path
.
abspath
(
"
sciLab.log
"
)
if
verb
:
print
(
"
logFile =
"
,
logFile
)
# Command line
#import toolbox.pyutils as pyutils
# -nwni = génération de la db, mais pas de génération de figure (nécessite l'affichage)
# -nw = génération de la db, & génération des figures en background
# Argument "-nw" is no longer supported since Scilab 6.0.2.
# scilab -nw starts WScilex-cli.exe: Scilab CLI with full functionnalities.
#cmd = '"%s" -e "%s" > "%s" 2>&1' % (scilabExe, sciCmd, logFile)
cmd
=
'"
%s
"
-nw -e
"
%s
"
>
"
%s
"
2>&1
'
%
(
scilabExe
,
sciCmd
,
logFile
)
if
verb
:
print
(
'
subprocess command :
'
,
cmd
)
# acquire sciLock
tim0
=
time
.
time
()
sciLock
.
acquire
()
try
:
print
(
"
Running Scilab...
"
)
import
subprocess
scilabProcess
=
subprocess
.
call
(
cmd
,
shell
=
True
)
print
(
"
Running Scilab... Done
"
)
a
=
1.0
except
:
# fonction objectif doit retourner un double
print
(
"
problem during Scilab run
"
)
a
=
0.0
# release sciLock
sciLock
.
release
()
print
(
"
Scilab exec time = %d sec
"
%
(
time
.
time
()
-
tim0
))
return
a
#=================================================================================
#=================================================================================
def
execGhostScript
(
gsExe
,
inFilter
=
'
*.eps
'
,
device
=
'
png256
'
,
res
=
300
):
import
subprocess
,
os
,
time
tim0
=
time
.
time
()
...
...
This diff is collapsed.
Click to expand it.
postProLoopGui.pyw
+
37
−
21
View file @
f20d4e2d
...
...
@@ -47,6 +47,9 @@ class PostProLoopGui(QWidget):
# | Matlab : |
# | - options |
# |--------------------------------|
# | Scilab : |
# | - options |
# |--------------------------------|
# | GhostScript : |
# | - options |
# |--------------------------------|
...
...
@@ -105,43 +108,56 @@ class PostProLoopGui(QWidget):
self
.
sf
[
'
MATLABCMD
'
]
=
TextLine
(
self
,
grplay2
,
self
.
postProLoop
.
pars
[
'
MATLABCMD
'
],
2
,
0
,
4
)
self
.
sf
[
'
MATLABPATH
'
]
=
PathLine
(
self
,
grplay2
,
self
.
postProLoop
.
pars
[
'
MATLABPATH
'
],
3
,
0
,
4
)
self
.
sf
[
'
MATLABREQUEST
'
]
=
TextLine
(
self
,
grplay2
,
self
.
postProLoop
.
pars
[
'
MATLABREQUEST
'
],
4
,
0
,
4
)
#
GhostScript
box
self
.
mesherGrpBox
=
QGroupBox
(
"
GhostScript (eps -> png)
"
)
#
Scilab
box
self
.
mesherGrpBox
=
QGroupBox
(
"
Scilab
"
)
box
.
addWidget
(
self
.
mesherGrpBox
)
grplay3
=
QGridLayout
()
grplay3
.
setColumnStretch
(
2
,
1
)
self
.
mesherGrpBox
.
setLayout
(
grplay3
)
self
.
sf
[
'
GSRUN
'
]
=
CheckBoxLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
GSRUN
'
],
0
,
0
)
self
.
sf
[
'
GSEXE
'
]
=
ExeFileLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
GSEXE
'
],
exeFileType
,
1
,
0
,
4
)
self
.
sf
[
'
GSFILTER
'
]
=
TextLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
GSFILTER
'
],
2
,
0
,
1
)
self
.
sf
[
'
GSOUTPUTFORMAT
'
]
=
MultiPMRLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
GSOUTPUTFORMAT
'
],
3
,
0
)
self
.
sf
[
'
GSDEFINITION
'
]
=
TextLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
GSDEFINITION
'
],
3
,
3
,
1
,
QIntValidator
(
72
,
1800
))
self
.
sf
[
'
GSREQUEST
'
]
=
TextLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
GSREQUEST
'
],
4
,
0
,
1
)
#build Latex box
self
.
mesherGrpBox
=
QGroupBox
(
"
Python
"
)
self
.
sf
[
'
SCILABRUN
'
]
=
CheckBoxLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
SCILABRUN
'
],
0
,
0
)
self
.
sf
[
'
SCILABEXE
'
]
=
ExeFileLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
SCILABEXE
'
],
exeFileType
,
1
,
0
,
4
)
self
.
sf
[
'
SCILABCMD
'
]
=
TextLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
SCILABCMD
'
],
2
,
0
,
4
)
self
.
sf
[
'
SCILABPATH
'
]
=
PathLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
SCILABPATH
'
],
3
,
0
,
4
)
self
.
sf
[
'
SCILABREQUEST
'
]
=
TextLine
(
self
,
grplay3
,
self
.
postProLoop
.
pars
[
'
SCILABREQUEST
'
],
4
,
0
,
4
)
#GhostScript box
self
.
mesherGrpBox
=
QGroupBox
(
"
GhostScript (eps -> png)
"
)
box
.
addWidget
(
self
.
mesherGrpBox
)
grplay4
=
QGridLayout
()
grplay4
.
setColumnStretch
(
2
,
1
)
self
.
mesherGrpBox
.
setLayout
(
grplay4
)
self
.
sf
[
'
PYTHONRUN
'
]
=
CheckBoxLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
PYTHONRUN
'
],
0
,
0
)
self
.
sf
[
'
PYTHONMODULE
'
]
=
FileLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
PYTHONMODULE
'
],
'
*.py
'
,
1
,
0
,
4
)
self
.
sf
[
'
PYTHONSCRIPT
'
]
=
TextLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
PYTHONSCRIPT
'
],
2
,
0
,
4
)
self
.
sf
[
'
PYTHONREQUEST
'
]
=
TextLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
PYTHONREQUEST
'
],
3
,
0
,
4
)
'''
self
.
sf
[
'
GSRUN
'
]
=
CheckBoxLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
GSRUN
'
],
0
,
0
)
self
.
sf
[
'
GSEXE
'
]
=
ExeFileLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
GSEXE
'
],
exeFileType
,
1
,
0
,
4
)
self
.
sf
[
'
GSFILTER
'
]
=
TextLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
GSFILTER
'
],
2
,
0
,
1
)
self
.
sf
[
'
GSOUTPUTFORMAT
'
]
=
MultiPMRLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
GSOUTPUTFORMAT
'
],
3
,
0
)
self
.
sf
[
'
GSDEFINITION
'
]
=
TextLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
GSDEFINITION
'
],
3
,
3
,
1
,
QIntValidator
(
72
,
1800
))
self
.
sf
[
'
GSREQUEST
'
]
=
TextLine
(
self
,
grplay4
,
self
.
postProLoop
.
pars
[
'
GSREQUEST
'
],
4
,
0
,
1
)
#build Latex box
self.mesherGrpBox = QGroupBox(
"
Latex
"
)
self
.
mesherGrpBox
=
QGroupBox
(
"
Python
"
)
box
.
addWidget
(
self
.
mesherGrpBox
)
grplay5
=
QGridLayout
()
grplay5
.
setColumnStretch
(
2
,
1
)
self
.
mesherGrpBox
.
setLayout
(
grplay5
)
self.sf[
'
LATEXRUN
'
] = CheckBoxLine(self, grplay5, self.postProLoop.pars[
'
LATEXRUN
'
], 0, 0)
self.sf[
'
LATEXCMD
'
] = TextLine (self, grplay5, self.postProLoop.pars[
'
LATEXCMD
'
], 1, 0, 4)
self.sf[
'
LATEXREQUEST
'
] = TextLine (self, grplay5, self.postProLoop.pars[
'
LATEXREQUEST
'
], 2, 0, 4)
self
.
sf
[
'
PYTHONRUN
'
]
=
CheckBoxLine
(
self
,
grplay5
,
self
.
postProLoop
.
pars
[
'
PYTHONRUN
'
],
0
,
0
)
self
.
sf
[
'
PYTHONMODULE
'
]
=
FileLine
(
self
,
grplay5
,
self
.
postProLoop
.
pars
[
'
PYTHONMODULE
'
],
'
*.py
'
,
1
,
0
,
4
)
self
.
sf
[
'
PYTHONSCRIPT
'
]
=
TextLine
(
self
,
grplay5
,
self
.
postProLoop
.
pars
[
'
PYTHONSCRIPT
'
],
2
,
0
,
4
)
self
.
sf
[
'
PYTHONREQUEST
'
]
=
TextLine
(
self
,
grplay5
,
self
.
postProLoop
.
pars
[
'
PYTHONREQUEST
'
],
3
,
0
,
4
)
'''
#build Latex box
self.mesherGrpBox = QGroupBox(
"
Latex
"
)
box.addWidget(self.mesherGrpBox)
grplay6 = QGridLayout()
grplay6.setColumnStretch(2,1)
self.mesherGrpBox.setLayout(grplay6)
self.sf[
'
LATEXRUN
'
] = CheckBoxLine(self, grplay6, self.postProLoop.pars[
'
LATEXRUN
'
], 0, 0)
self.sf[
'
LATEXCMD
'
] = TextLine (self, grplay6, self.postProLoop.pars[
'
LATEXCMD
'
], 1, 0, 4)
self.sf[
'
LATEXREQUEST
'
] = TextLine (self, grplay6, self.postProLoop.pars[
'
LATEXREQUEST
'
], 2, 0, 4)
'''
def
buildButtonFrame
(
self
,
box
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment