Skip to content
Snippets Groups Projects
Commit adbd0823 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

don't change attributes changed server-side

parent a6c27536
No related branches found
No related tags found
No related merge requests found
......@@ -638,8 +638,16 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
std::vector<onelab::number> ps;
_onelabClient->get(ps, name);
bool noRange = true, noChoices = true, noLoop = true, noGraph = true;
if(ps.size()){ // use value from server
val[0] = ps[0].getValue();
// keep track of these attributes, which can be changed server-side
if(ps[0].getMin() != -onelab::parameter::maxNumber() ||
ps[0].getMax() != onelab::parameter::maxNumber() ||
ps[0].getStep() != 0.) noRange = false;
if(ps[0].getChoices().size()) noChoices = false;
if(ps[0].getAttribute("Loop").size()) noLoop = false;
if(ps[0].getAttribute("Graph").size()) noGraph = false;
}
else{
ps.resize(1);
......@@ -647,26 +655,26 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
ps[0].setValue(val[0]);
}
// send updated parameter to server
if(fopt.count("Range") && fopt["Range"].size() == 2){
if(noRange && fopt.count("Range") && fopt["Range"].size() == 2){
ps[0].setMin(fopt["Range"][0]); ps[0].setMax(fopt["Range"][1]);
}
else if(fopt.count("Min") && fopt.count("Max")){
else if(noRange && fopt.count("Min") && fopt.count("Max")){
ps[0].setMin(fopt["Min"][0]); ps[0].setMax(fopt["Max"][0]);
}
else if(fopt.count("Min")){
else if(noRange && fopt.count("Min")){
ps[0].setMin(fopt["Min"][0]); ps[0].setMax(onelab::parameter::maxNumber());
}
else if(fopt.count("Max")){
else if(noRange && fopt.count("Max")){
ps[0].setMax(fopt["Max"][0]); ps[0].setMin(-onelab::parameter::maxNumber());
}
if(fopt.count("Step")) ps[0].setStep(fopt["Step"][0]);
if(fopt.count("Choices")) ps[0].setChoices(fopt["Choices"]);
if(noRange && fopt.count("Step")) ps[0].setStep(fopt["Step"][0]);
if(noChoices && fopt.count("Choices")) ps[0].setChoices(fopt["Choices"]);
if(fopt.count("Visible")) ps[0].setVisible(fopt["Visible"][0] ? true : false);
if(copt.count("Help")) ps[0].setHelp(copt["Help"][0]);
if(copt.count("Label")) ps[0].setLabel(copt["Label"][0]);
if(copt.count("ShortHelp")) ps[0].setLabel(copt["ShortHelp"][0]);
if(copt.count("Loop")) ps[0].setAttribute("Loop", copt["Loop"][0]);
if(copt.count("Graph")) ps[0].setAttribute("Graph", copt["Graph"][0]);
if(noLoop && copt.count("Loop")) ps[0].setAttribute("Loop", copt["Loop"][0]);
if(noGraph && copt.count("Graph")) ps[0].setAttribute("Graph", copt["Graph"][0]);
if(copt.count("Hightlight")) ps[0].setAttribute("Highlight", copt["Hightlight"][0]);
_onelabClient->set(ps[0]);
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment