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
9661f66a
Commit
9661f66a
authored
Jul 02, 2015
by
eric pellegrini
Browse files
Removed duplicate class
Bug fix in McStas analysis
parent
62820c4d
Changes
6
Hide whitespace changes
Inline
Side-by-side
MDANSE/App/GUI/ConfigurationPanel.py
deleted
100644 → 0
View file @
62820c4d
#MDANSE : Molecular Dynamics Analysis for Neutron Scattering Experiments
#------------------------------------------------------------------------------------------
#Copyright (C)
#2015- Eric C. Pellegrini Institut Laue-Langevin
#BP 156
#6, rue Jules Horowitz
#38042 Grenoble Cedex 9
#France
#pellegrini[at]ill.fr
#goret[at]ill.fr
#aoun[at]ill.fr
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
#
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#Lesser General Public License for more details.
#
#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
'''
Created on Apr 10, 2015
:author: Eric C. Pellegrini
'''
import
wx
from
MDANSE
import
REGISTRY
from
MDANSE.Framework.Configurable
import
ConfigurationError
class
ConfigurationPanel
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
configuration
):
wx
.
Panel
.
__init__
(
self
,
parent
,
wx
.
ID_ANY
)
self
.
_configuration
=
configuration
self
.
_widgets
=
{}
self
.
build_panel
()
def
build_panel
(
self
):
self
.
panelSizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
for
cfg
in
self
.
_configuration
.
configurators
.
values
():
widgetClass
=
REGISTRY
[
"configuratorwidget"
][
cfg
.
widget
]
self
.
_widgets
[
cfg
.
name
]
=
widgetClass
(
self
,
cfg
.
name
,
self
.
_configuration
)
self
.
panelSizer
.
Add
(
self
.
_widgets
[
cfg
.
name
],
0
,
wx
.
ALL
|
wx
.
EXPAND
,
5
)
self
.
SetSizer
(
self
.
panelSizer
)
self
.
Layout
()
self
.
Fit
()
@
property
def
widgets
(
self
):
return
self
.
_widgets
def
get_value
(
self
):
return
dict
([(
k
,
v
.
get_value
())
for
k
,
v
in
self
.
_widgets
.
items
()])
def
validate
(
self
):
for
w
in
self
.
_widgets
.
values
():
w
.
SetBackgroundColour
(
wx
.
NullColour
)
w
.
Refresh
()
try
:
self
.
_configuration
.
setup
(
self
.
get_value
())
except
ConfigurationError
as
e
:
d
=
wx
.
MessageDialog
(
self
,
str
(
e
),
style
=
wx
.
ICON_ERROR
|
wx
.
STAY_ON_TOP
|
wx
.
CENTRE
)
d
.
ShowModal
()
w
=
self
.
_widgets
[
e
.
configurator
.
name
]
w
.
SetBackgroundColour
(
"Pink"
)
w
.
Refresh
()
w
.
SetFocus
()
return
False
else
:
return
True
MDANSE/App/GUI/Framework/Widgets/McStasInstrumentWidget.py
View file @
9661f66a
...
...
@@ -46,9 +46,6 @@ class McStasInstrumentWidget(IWidget):
_mcStasTypes
=
{
'double'
:
float
,
'int'
:
int
,
'string'
:
str
}
def
initialize
(
self
):
pass
def
add_widgets
(
self
):
sizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
...
...
@@ -94,8 +91,4 @@ class McStasInstrumentWidget(IWidget):
def
get_widget_value
(
self
):
return
self
.
_instrument
.
GetStringSelection
()
def
set_widget_value
(
self
):
pass
return
self
.
_instrument
.
GetStringSelection
()
\ No newline at end of file
MDANSE/App/GUI/Framework/Widgets/McStasOptionsWidget.py
View file @
9661f66a
...
...
@@ -40,9 +40,6 @@ class McStasOptionsConfiguratorWidget(IWidget):
type
=
"mcstas_options"
def
initialize
(
self
):
pass
def
add_widgets
(
self
):
sizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
...
...
@@ -59,7 +56,4 @@ class McStasOptionsConfiguratorWidget(IWidget):
val
=
self
.
_panel
.
get_value
()
return
val
def
set_widget_value
(
self
):
pass
return
val
\ No newline at end of file
MDANSE/App/GUI/Framework/Widgets/McStasParametersWidget.py
View file @
9661f66a
...
...
@@ -46,9 +46,8 @@ class McStasParametersWidget(IWidget):
_mcStasTypes
=
{
'double'
:
'float'
,
'int'
:
'integer'
,
'string'
:
'input_file'
}
def
initialize
(
self
):
self
.
_configurationPanel
=
None
def
add_widgets
(
self
):
self
.
_sizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
...
...
@@ -89,7 +88,7 @@ class McStasParametersWidget(IWidget):
self
.
Parent
.
Layout
()
# Trick to show the
e
scrollbar after updating the configuration panel.
# Trick to show the scrollbar after updating the configuration panel.
self
.
Parent
.
Parent
.
SendSizeEvent
()
def
get_widget_value
(
self
):
...
...
@@ -98,8 +97,4 @@ class McStasParametersWidget(IWidget):
val
=
self
.
_configurationPanel
.
get_value
()
return
val
def
set_widget_value
(
self
):
pass
\ No newline at end of file
return
val
\ No newline at end of file
MDANSE/Framework/Configurators/McStasParametersConfigurator.py
View file @
9661f66a
...
...
@@ -40,7 +40,7 @@ class McStasParametersConfigurator(IConfigurator):
This configurator allows to input the McStas instrument parameters that will be used to run a McStas executable file.
'''
type
=
"
instrument
_parameters"
type
=
"
mcstas
_parameters"
_mcStasTypes
=
{
'double'
:
float
,
'int'
:
int
,
'string'
:
str
}
...
...
MDANSE/Framework/Jobs/McStasVirtualInstrument.py
View file @
9661f66a
...
...
@@ -59,19 +59,15 @@ class McStasError(Error):
pass
class
McStasOptions
(
Configurable
):
__metaclass__
=
REGISTRY
type
=
"mcstas_options"
settings
=
collections
.
OrderedDict
()
settings
[
"ncount"
]
=
(
"integer"
,
{
"label"
:
"neutron count"
,
"mini"
:
1
})
settings
[
"ncount"
]
=
(
"integer"
,
{
"label"
:
"neutron count"
,
"mini"
:
0
})
settings
[
"dir"
]
=
(
"output_directory"
,
{
"label"
:
"McStas output directory"
})
class
McStasParameters
(
Configurable
):
__metaclass__
=
REGISTRY
type
=
"mcstas_parameters"
settings
=
collections
.
OrderedDict
()
...
...
@@ -110,7 +106,7 @@ class McStasVirtualInstrument(IJob):
'default'
:
os
.
path
.
join
(
'..'
,
'..'
,
'..'
,
'Data'
,
'McStas'
,
'Instruments'
,
'Simple_ToF_Flat_Sample.out'
)})
settings
[
'options'
]
=
(
'mcstas_options'
,
{
"label"
:
'mcstas options'
})
settings
[
'display'
]
=
(
'boolean'
,
{
'label'
:
'trace the 3D view of the simulation'
})
settings
[
'parameters'
]
=
(
'
instrument
_parameters'
,
{
'label'
:
'instrument parameters'
,
settings
[
'parameters'
]
=
(
'
mcstas
_parameters'
,
{
'label'
:
'instrument parameters'
,
'dependencies'
:{
"instrument"
:
"instrument"
},
'exclude'
:[
'sample_coh'
,
'sample_inc'
],
'default'
:{
'beam_wavelength_Angs'
:
2.0
,
...
...
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