Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
MDANSE
Commits
9f8c10a8
Commit
9f8c10a8
authored
Jun 04, 2015
by
eric pellegrini
Browse files
Prevent the controller tab from closing
The temporary job script files are now also saved when running a job from the GUI
parent
7cca2257
Changes
4
Hide whitespace changes
Inline
Side-by-side
MDANSE/App/GUI/ControllerPanel.py
View file @
9f8c10a8
...
...
@@ -23,7 +23,7 @@ class ControllerPanel(wx.Panel):
def
build_panel
(
self
):
self
.
_notebook
=
wxaui
.
AuiNotebook
(
self
)
self
.
_notebook
=
wxaui
.
AuiNotebook
(
self
,
style
=
wxaui
.
AUI_NB_DEFAULT_STYLE
&
~
wxaui
.
AUI_NB_CLOSE_ON_ACTIVE_TAB
)
self
.
_pages
=
collections
.
OrderedDict
()
self
.
_pages
[
"logger"
]
=
wx
.
TextCtrl
(
self
,
style
=
wx
.
TE_MULTILINE
|
wx
.
TE_READONLY
|
wx
.
TE_BESTWRAP
|
wx
.
HSCROLL
|
wx
.
TE_AUTO_URL
)
...
...
MDANSE/App/GUI/Framework/Plugins/JobPlugin.py
View file @
9f8c10a8
...
...
@@ -103,10 +103,9 @@ class JobPlugin(ComponentPlugin):
parameters
=
self
.
_parametersPanel
.
get_value
()
t
=
tempfile
.
mkstemp
(
prefix
=
"MDANSE_%s_"
%
self
.
_job
.
type
,
text
=
True
)
os
.
close
(
t
[
0
])
script
=
os
.
path
.
join
(
PLATFORM
.
jobscripts_directory
(),
self
.
_job
.
_name
)
+
'.py'
self
.
_job
.
save
(
t
[
1
]
,
parameters
)
self
.
_job
.
save
(
script
,
parameters
)
if
PLATFORM
.
name
==
"windows"
:
startupinfo
=
subprocess
.
STARTUPINFO
()
...
...
@@ -115,7 +114,7 @@ class JobPlugin(ComponentPlugin):
else
:
startupinfo
=
None
subprocess
.
Popen
([
sys
.
executable
,
t
[
1
]
],
startupinfo
=
startupinfo
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
subprocess
.
Popen
([
sys
.
executable
,
script
],
startupinfo
=
startupinfo
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
time
.
sleep
(
1
)
...
...
MDANSE/Core/Platform.py
View file @
9f8c10a8
...
...
@@ -302,6 +302,20 @@ class Platform(object):
return
path
def
jobscripts_directory
(
self
):
'''
Returns the path of the directory where the MDANSE job script files are stored.
:return: the path of the directory where the MDANSE job script files are stored.
:rtype: str
'''
path
=
os
.
path
.
join
(
self
.
application_directory
(),
'jobscripts'
)
self
.
create_directory
(
path
)
return
path
def
temporary_files_directory
(
self
):
'''
Returns the path of the directory where the temporary MDANSE job status files are stored.
...
...
MDANSE/Framework/Jobs/IJob.py
View file @
9f8c10a8
...
...
@@ -85,12 +85,12 @@ class JobError(Error):
return
self
.
_message
def
key_generator
(
s
ize
=
4
,
chars
=
None
,
prefix
=
""
):
def
key_generator
(
keyS
ize
,
chars
=
None
,
prefix
=
""
):
if
chars
is
None
:
chars
=
string
.
ascii_lowercase
+
string
.
digits
key
=
''
.
join
(
random
.
choice
(
chars
)
for
_
in
range
(
s
ize
))
key
=
''
.
join
(
random
.
choice
(
chars
)
for
_
in
range
(
keyS
ize
))
if
prefix
:
key
=
"%s_%s"
%
(
prefix
,
key
)
...
...
@@ -121,7 +121,7 @@ class IJob(Configurable):
while
True
:
# Followed by 4 random letters.
name
=
key_generator
(
4
,
prefix
=
prefix
)
name
=
key_generator
(
6
,
prefix
=
prefix
)
if
not
name
in
registeredJobs
:
break
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment