Changeset 427 in PSPA for Interface_Web/trunk
- Timestamp:
- Oct 25, 2013, 3:51:05 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT/sources/userInterface/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_console.cc
r417 r427 13 13 14 14 15 GWt_console::GWt_console() 16 :WContainerWidget() 15 GWt_console::GWt_console() : WContainerWidget() 17 16 { 18 17 setObjectName("console"); 19 18 20 21 // la ligne de search 22 Wt::WContainerWidget *searchContainer = new Wt::WContainerWidget(); 19 // la ligne de search 20 Wt::WContainerWidget *searchContainer = new Wt::WContainerWidget(); 23 21 24 25 26 22 Wt::WLabel *label = new Wt::WLabel("Search ", searchContainer); 23 searchLineEdit_ = new Wt::WLineEdit("", searchContainer); 24 searchLineEdit_->setToolTip("clic here to search a string in the output"); 27 25 28 // le panel 29 WPanel *panelConsole = new WPanel(this); 30 panelConsole->setTitle(" output"); 31 32 WScrollArea* scrollContainer = new WScrollArea(); 33 34 35 outputCurrent_ = new WText(this); 36 outputCurrent_->setTextFormat(Wt::XHTMLText); 37 outputCurrent_->setInline(false); 38 outputCurrent_->setMaximumSize(750,400); 39 40 scrollContainer->setWidget(outputCurrent_); 41 scrollContainer->setStyleClass("scrollConsole"); 42 43 Wt::WContainerWidget *panelContainer = new Wt::WContainerWidget(); 44 Wt::WVBoxLayout* vContainerLayout = new Wt::WVBoxLayout(); 45 46 vContainerLayout->addWidget(searchContainer); 47 vContainerLayout->addWidget(scrollContainer); 48 49 50 panelContainer->setLayout(vContainerLayout); 51 panelConsole->setCentralWidget(panelContainer); 52 53 // signals 54 searchLineEdit_->keyWentUp ().connect(this, &GWt_console::searchFilter); 26 // le panel 27 WPanel *panelConsole = new WPanel(this); 28 panelConsole->setTitle(" output"); 29 30 WScrollArea* scrollContainer = new WScrollArea(); 31 32 outputCurrent_ = new WText(this); 33 outputCurrent_->setTextFormat(Wt::XHTMLText); 34 outputCurrent_->setInline(false); 35 outputCurrent_->setMaximumSize(750,400); 36 scrollContainer->setWidget(outputCurrent_); 37 scrollContainer->setStyleClass("scrollConsole"); 38 39 Wt::WContainerWidget *panelContainer = new Wt::WContainerWidget(); 40 Wt::WVBoxLayout* vContainerLayout = new Wt::WVBoxLayout(); 41 vContainerLayout->addWidget(searchContainer); 42 vContainerLayout->addWidget(scrollContainer); 43 panelContainer->setLayout(vContainerLayout); 44 panelConsole->setCentralWidget(panelContainer); 45 46 // signals 47 searchLineEdit_->keyWentUp ().connect(this,&GWt_console::searchFilter); 55 48 } 56 57 49 58 50 GWt_console::~GWt_console() … … 60 52 } 61 53 62 63 54 void GWt_console::searchFilter() { 64 65 std::string br = "<br />"; 55 56 std::string br = "<br />"; 57 58 std::string txt = searchLineEdit_->text().toUTF8 (); 59 if (searchLineEdit_->text() == "") { 60 outputCurrent_->setText(outputOriginal_); 61 outputCurrent_->setTextFormat(Wt::XHTMLText); 62 return; 63 } 64 65 std::string outputStr = outputOriginal_.toUTF8(); 66 std::string outputFinal = ""; 67 68 // look for lines that contains the seacrh string 69 bool end = false; 70 int nextPos = 0; 71 int nextPosTxt = 0; 72 int lineNumber = 0; 73 std::string beginStr; 74 std::string endStr; 75 76 // loop on all lines 77 while (end == false) { 78 lineNumber++; 66 79 67 std::string txt = searchLineEdit_->text().toUTF8 (); 68 if (searchLineEdit_->text() == "") { 69 outputCurrent_->setText(outputOriginal_); 70 outputCurrent_->setTextFormat(Wt::XHTMLText); 71 return; 72 } 80 nextPos = outputStr.find(br); 73 81 74 std::string outputStr = outputOriginal_.toUTF8(); 75 std::string outputFinal = ""; 76 77 // look for lines that contains the seacrh string 78 bool end = false; 79 int nextPos = 0; 80 int nextPosTxt = 0; 81 int lineNumber = 0; 82 std::string beginStr; 83 std::string endStr; 84 85 // loop on all lines 86 while (end == false) { 87 lineNumber++; 82 // if this line contains the token 83 if (nextPos != std::string::npos) { 84 beginStr = outputStr.substr(0,nextPos); 85 endStr = outputStr.substr(nextPos+br.size()); 86 outputStr = endStr; 87 88 89 // colorize for all token 90 bool lineEnd = false; 91 std::string colorizeTxt = ""; 92 while (lineEnd == false) { 93 nextPosTxt = beginStr.find(txt); 88 94 89 nextPos = outputStr.find(br); 90 91 // if this line contains the token 92 if (nextPos != std::string::npos) { 93 beginStr = outputStr.substr(0,nextPos); 94 endStr = outputStr.substr(nextPos+br.size()); 95 outputStr = endStr; 96 97 98 // colorize for all token 99 bool lineEnd = false; 100 std::string colorizeTxt = ""; 101 while (lineEnd == false) { 102 nextPosTxt = beginStr.find(txt); 103 104 if (nextPosTxt != std::string::npos) { 105 colorizeTxt += beginStr.substr(0,nextPosTxt)+ 106 std::string("<b><font style='background-color:yellow;'>")+ 107 txt+ 108 std::string("</font></b>"); 109 beginStr = beginStr.substr(nextPosTxt+txt.size()); 110 111 } else if (colorizeTxt != "") { 112 colorizeTxt += beginStr; 113 lineEnd = true; 114 } else { 115 lineEnd = true; 116 } 117 } 118 if (colorizeTxt != "") { 119 std::stringstream ss; 120 ss << lineNumber; 121 outputFinal += std::string("<font color='gray'>line ")+ss.str()+" : </font>"+colorizeTxt+br; 95 if (nextPosTxt != std::string::npos) { 96 colorizeTxt += beginStr.substr(0,nextPosTxt)+ 97 std::string("<b><font style='background-color:yellow;'>")+ 98 txt+ 99 std::string("</font></b>"); 100 beginStr = beginStr.substr(nextPosTxt+txt.size()); 101 102 } else if (colorizeTxt != "") { 103 colorizeTxt += beginStr; 104 lineEnd = true; 105 } else { 106 lineEnd = true; 107 } 108 } 109 if (colorizeTxt != "") { 110 std::stringstream ss; 111 ss << lineNumber; 112 outputFinal += std::string("<font color='gray'>line ")+ss.str()+" : </font>"+colorizeTxt+br; 122 113 } 123 114 } else { … … 133 124 134 125 void GWt_console::addConsoleMessage(WString msg) { 135 136 137 138 139 140 141 142 143 144 145 146 126 127 // changes specials caracters 128 outputOriginal_ += Wt::Utils::htmlEncode (msg.toUTF8(), Wt::Utils::EncodeNewLines); 129 130 // apply filter, will modify outputCurrent 131 searchFilter(); 132 /* 133 * Little javascript trick to make sure we scroll along with new content 134 */ 135 wApp->doJavaScript(outputCurrent_->jsRef() + ".scrollTop += " 136 + outputCurrent_->jsRef() + ".scrollHeight;"); 137 147 138 } 148 139 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc
r408 r427 1 #include "GWt_globalParameters.h" 2 #include <Wt/WVBoxLayout> 3 #include <Wt/WGroupBox> 4 #include <Wt/WText> 1 2 #include <Wt/WDialog> 5 3 #include <Wt/WLineEdit> 6 4 #include <Wt/WBreak> 7 5 #include <Wt/WPushButton> 8 6 9 #include <Wt/WComboBox> 10 11 #include "mixedTools.h" 7 #include "GWt_globalParameters.h" 12 8 #include "GWt_console.h" 13 9 10 #include "dataManager.h" 14 11 15 GWt_globalParameters::GWt_globalParameters( PspaApplication* ps)12 GWt_globalParameters::GWt_globalParameters(dataManager* dt) 16 13 { 17 18 pspa_ = ps; 19 WVBoxLayout* globLayout = new WVBoxLayout(); 20 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 21 WContainerWidget *result = new WContainerWidget(); 22 WPanel *panel = new WPanel(result); 23 panel->setTitle(" global parameters "); 24 25 26 WText* freqText = new WText("frequency (MHz) : "); 27 frequencyEdit_ = new WLineEdit(); 28 29 WText *stepText = new WText("step in phase (deg.) : "); 30 stepEdit_ = new WLineEdit(); 31 32 WText *nstepMaxText = new WText("max step number : "); 33 nstepMAxEdit_ = new WLineEdit(); 34 35 WText *nscText = new WText("periodicity of s.c. computation : "); 36 nscEdit_ = new WLineEdit(); 37 38 39 40 WContainerWidget* contenu = new WContainerWidget(); 41 contenu->addWidget(freqText); 42 contenu->addWidget(frequencyEdit_); 43 contenu->addWidget(new WBreak()); 44 contenu->addWidget(stepText); 45 contenu->addWidget(stepEdit_); 46 contenu->addWidget(new WBreak()); 47 contenu->addWidget(nstepMaxText); 48 contenu->addWidget(nstepMAxEdit_); 49 contenu->addWidget(new WBreak()); 50 contenu->addWidget(nscText); 51 contenu->addWidget(nscEdit_); 52 53 54 55 panel->setCentralWidget(contenu); 56 // panel->setCollapsible(true); 57 58 59 // WPanel *panelModules = new WPanel(result); 60 // panelModules->setTitle(" sections of beam Line for executing softwres "); 61 62 63 // WPushButton* push_add = new WPushButton("add"); 64 65 66 // contenuSections_ = new WContainerWidget(); 67 68 // addSection(); 69 // contenuSections_->addWidget( push_add); 70 71 72 // panelModules->setCentralWidget(contenuSections_); 73 74 75 globLayout->addWidget(result); 76 77 setLayout(globLayout); 78 globLayout->setContentsMargins(0,0,0,0); 79 renew(); 14 dt_ = dt; 80 15 } 81 16 82 // void GWt_globalParameters::addSection() 83 // { 84 // unsigned k; 85 // // WComboBox* selectionBox = new WComboBox(); 17 GWt_globalParameters::GWt_globalParameters(dataManager* dt,WContainerWidget* wt) 18 { 19 dt_ = dt; 20 status_ = new WText("Go ahead...",wt); 21 } 86 22 87 // sectionSelection_.push_back(new WComboBox()); 23 void GWt_globalParameters::initilializeDialog() 24 { 25 string* param = dialogBegin(); 88 26 89 // contenuSections_->addWidget(new WBreak()); 27 dialog_ = new WDialog("global parameters"); 28 new WText("Enter frequency (MHz) : ",dialog_->contents()); 29 frequencyEdit_ = new WLineEdit(param[1].c_str(),dialog_->contents()); 30 new WBreak(dialog_->contents()); 31 new WText("Enter step in phase (deg) : ",dialog_->contents()); 32 stepEdit_ = new WLineEdit(param[2].c_str(),dialog_->contents()); 33 new WBreak(dialog_->contents()); 34 new WText("Enter max step number : ",dialog_->contents()); 35 nstepMAxEdit_ = new WLineEdit(param[3].c_str(),dialog_->contents()); 36 new WBreak(dialog_->contents()); 37 new WText("Enter periodicity of s.c. computation : ",dialog_->contents()); 38 nscEdit_ = new WLineEdit(param[4].c_str(),dialog_->contents()); 39 new WBreak(dialog_->contents()); 90 40 91 // contenuSections_->addWidget(new WText(" from : "));92 // contenuSections_->addWidget(new WLineEdit());93 // contenuSections_->addWidget(new WText(" to : "));94 // contenuSections_->addWidget(new WLineEdit());41 WPushButton *ok = new WPushButton("Ok", dialog_->contents()); 42 ok->clicked().connect(dialog_, &WDialog::accept); 43 WPushButton *no = new WPushButton("Cancel", dialog_->contents()); 44 no->clicked().connect(dialog_, &WDialog::reject); 95 45 46 dialog_->finished().connect(this,&GWt_globalParameters::dialogDone); 47 //dialog_->show(); 48 dialog_->exec(WAnimation(WAnimation::SlideInFromTop)); 49 } 96 50 97 // contenuSections_->addWidget(sectionSelection_.back()); 51 string* GWt_globalParameters::dialogBegin() 52 { 53 string* param = dt_->getGlobalParameters()->getParametersString(); 54 if ( param == NULL ) { 55 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 56 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 57 console->addConsoleMessage(" GWt_globalParameters : empty parameter set"); 58 } 59 } 98 60 99 // unsigned nb = nomDeLogiciel::getNumberOfSoftwares(); 100 // for ( k=0; k < nb; k++) sectionSelection_.back()->addItem( nomDeLogiciel(k).getString() ); 101 // // selectionBox->addItem("Transport"); 102 // } 61 int nbparam = atoi(param[0].c_str()); 62 if ( nbparam != 4 ) { 63 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 64 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 65 console->addConsoleMessage(" GWt_globalParameters : wrong number of parameters"); 66 } 67 } 68 69 envoi_[0] = param[0].c_str(); 70 envoi_[1] = param[1].c_str(); 71 envoi_[2] = param[2].c_str(); 72 envoi_[3] = param[3].c_str(); 73 envoi_[4] = param[4].c_str(); 74 setStatus(); 75 return param; 76 } 103 77 104 105 void GWt_globalParameters::renew() 78 void GWt_globalParameters::dialogDone(WDialog::DialogCode code) 106 79 { 107 string* param = pspa_->getDataManager()->getGlobalParameters()->getParametersString(); 108 if ( param == NULL ) 109 { 110 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 111 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 112 console->addConsoleMessage(" GWt_globalParameters : empty parameter set"); 113 } 114 } 115 int nbparam = atoi(param[0].c_str()); 116 if ( nbparam != 4 ) 117 { 118 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 119 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 120 console->addConsoleMessage(" GWt_globalParameters : wrong number of parameters"); 121 } 122 } 123 frequencyEdit_->setText(param[1].c_str()); 124 stepEdit_->setText(param[2].c_str()); 125 nstepMAxEdit_->setText(param[3].c_str()); 126 nscEdit_->setText(param[4].c_str()); 80 if (code == WDialog::Accepted) updateGlobals(); 81 return; 127 82 } 128 83 129 84 void GWt_globalParameters::updateGlobals() 130 85 { 131 string envoi[5]; 132 envoi[0] = string("4"); 133 envoi[1] = frequencyEdit_->text().toUTF8(); 134 envoi[2] = stepEdit_->text().toUTF8(); 135 envoi[3] = nstepMAxEdit_->text().toUTF8(); 136 envoi[4] = nscEdit_->text().toUTF8(); 137 pspa_->getDataManager()->getGlobalParameters()->setParametersString(envoi); 86 envoi_[0] = string("4"); 87 envoi_[1] = frequencyEdit_->text().toUTF8(); 88 envoi_[2] = stepEdit_->text().toUTF8(); 89 envoi_[3] = nstepMAxEdit_->text().toUTF8(); 90 envoi_[4] = nscEdit_->text().toUTF8(); 91 92 setStatus(); 93 dt_->getGlobalParameters()->setParametersString(envoi_); 138 94 } 139 95 140 // void GWt_globalParameters::getExecute(unsigned index, unsigned& first, unsigned& last, int& programm) 141 // { 142 // string debut; 143 // string fin; 144 // if ( index == 1) 145 // { 146 // debut = origineEdit1_->text().toUTF8(); 147 // fin = extremiteEdit1_->text().toUTF8(); 148 // programm = selectionBox1_->currentIndex(); 149 // cout << " current index " << programm << endl; 150 // } 151 // else 152 // { 153 // debut = origineEdit2_->text().toUTF8(); 154 // fin = extremiteEdit2_->text().toUTF8(); 155 // } 156 // first = atoi ( debut.c_str() ); 157 // last = atoi ( fin.c_str() ); 158 // programm++; 96 void GWt_globalParameters::renew() 97 { 98 string* param = dialogBegin(); 159 99 160 // } 100 frequencyEdit_->setText(param[1].c_str()); 101 stepEdit_->setText(param[2].c_str()); 102 nstepMAxEdit_->setText(param[3].c_str()); 103 nscEdit_->setText(param[4].c_str()); 104 } 161 105 162 // void GWt_globalParameters::addElem() 163 // { 164 // int dernier = pspa_->getDataManager()->beamLineSize(); 165 // extremiteEdit1_->setText( mixedTools::intToString(dernier) ); 166 // } 106 string* GWt_globalParameters::getGlobalParameters() 107 { 108 return envoi_; 109 } 167 110 168 111 void GWt_globalParameters::setStatus() 112 { 113 WString out= WString("<p>frequency="+envoi_[1]+"</p>" 114 "<p>step in phase="+envoi_[2]+"</p>" 115 "<p>max step number="+envoi_[3]+"</p>" 116 "<p>periodicity of s.c. computation="+envoi_[4]+"</p>"); 117 status_->setText(out); 118 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r424 r427 8 8 #include "GWt_softwarePanel.h" 9 9 #include "GWt_globalParameters.h" 10 // #include "GWt_dialog.h"11 10 #include "GWt_draggableImage.h" 12 11 #include "particleBeam.h" … … 36 35 #include <Wt/WRadioButton> 37 36 37 #include <Wt/WPanel> 38 #include <Wt/WMessageBox> 39 38 40 #define HAS_IMAGEMAGIC 1 39 41 … … 76 78 useStyleSheet("htdocs/pspa.css"); 77 79 dtmanage_ = new dataManager(this); 78 // dtmanage_->setWorkingDir(workingDir_); 79 80 /* 81 * The main layout is a 4x3 grid layout. 82 */ 83 WGridLayout *mainGridLayout = new WGridLayout(); 84 // layout->addWidget(createTitle("<a href='workingArea/parmin'> Menu (In future)</a>"), 0, 0, 1, 2); 85 // layout->addWidget(createTitle("Menu (In future)"), 0, 0, 1, 2); 86 80 81 // The main layout is a 4x3 grid layout. 82 WGridLayout *mainGridLayout = new WGridLayout(); 87 83 WHBoxLayout *toolbarLayout = new WHBoxLayout(); 88 84 … … 100 96 101 97 boutonSauve->setToolTip ("sauvegarder votre configuration"); 102 boutonRestaure->setToolTip (" 98 boutonRestaure->setToolTip ("restaurer la configuration depuis le serveur"); 103 99 boutonLoadNew->setToolTip ("charger une configuration"); 104 100 boutongraphicalAnalysis->setToolTip ("analyse graphique"); … … 118 114 boutonSauve->clicked().connect(this, &PspaApplication::sauver); 119 115 boutonRestaure->clicked().connect(this, &PspaApplication::restaurer); 120 // Upload when the button is clicked. 121 // React to a succesfull upload. 116 // Upload when the button is clicked. React to a succesfull upload. 122 117 boutonLoadNew->clicked().connect(this, &PspaApplication::openFileSelector); 123 124 118 boutongraphicalAnalysis->clicked().connect(this, &PspaApplication::dialogOnGraphics); 125 126 119 boutonTrash->clicked().connect(this, &PspaApplication::removeBeamLine); 127 128 120 toolbarLayout->addWidget(boutonSauve , 0,Wt::AlignMiddle); 129 121 toolbarLayout->addWidget(boutonRestaure , 0,Wt::AlignMiddle); … … 140 132 mainGridLayout->addWidget(createPalette(), 2, 0, 4, 1); 141 133 142 143 134 WScrollArea* scroll = new WScrollArea(); 144 135 scroll->setWidget(createBeamLine()); 145 136 scroll->setMinimumSize(300,150); 146 147 137 mainGridLayout->addWidget(scroll, 2, 1, 1, 2); 148 149 150 // console_ = new WContainerWidget(); 151 // console_->decorationStyle().setBackgroundColor (WColor("lightgray")); 152 // console_->setMaximumSize(600,200); 153 // layout->addWidget(console_, 3, 1); 154 // console_->setMinimumSize(300,100); 155 // console_->setOverflow(WContainerWidget::OverflowAuto); 156 157 138 158 139 //----------- 140 159 141 // A supprimer et a mettre en fenetre 160 globalParam_ = createGlobalParamWidget(); 161 // leDessin_ = new WContainerWidget(); 162 // leDessin_ = createDrawingWidget(); 142 // xx globalParam_ = createGlobalParamWidget(); 143 // xx mainGridLayout->addWidget(globalParam_,3,1); 144 145 WWidget* dboard = createDashBoard(); 146 dboard->setMinimumSize(300,100); 147 mainGridLayout->addWidget(dboard,3,1); 148 //----------- 149 163 150 graphicsDialog_ = new GWt_dialog("graphical analysis",createDrawingWidget(),false); 164 151 graphicsDialog_->setMinimumSize(400,400); … … 167 154 168 155 executeWidget_ = new GWt_softwarePanel(dtmanage_,this); 169 170 mainGridLayout->addWidget( globalParam_, 3, 1); 171 // layout->addWidget( leDessin_, 3, 2); 172 mainGridLayout->addWidget( executeWidget_ , 4, 1); 173 //----------- 156 executeWidget_->setMinimumSize(400,100); 157 mainGridLayout->addWidget(executeWidget_,4,1); 174 158 175 159 console_ = new GWt_console(); 176 177 // manage sizes178 160 console_->setMinimumSize(300,100); 179 executeWidget_->setMinimumSize(400,100); 180 181 mainGridLayout->addWidget(console_, 3, 2,2,1); 182 183 184 /* 185 * Let row 2 and column 1 take the excess space. 186 */ 187 mainGridLayout->setRowStretch(4, 1); 188 mainGridLayout->setColumnStretch(2, 1); 161 mainGridLayout->addWidget(console_,3,2,2,1); 162 163 // Let row 2 and column 1 take the excess space. 164 mainGridLayout->setRowStretch(4,1); 165 mainGridLayout->setColumnStretch(2,1); 189 166 190 167 widroot->setLayout(mainGridLayout); 191 192 168 // set auto scrollbar if needed 193 169 widroot->setOverflow(WContainerWidget::OverflowAuto); 194 170 } 171 172 // WWidget* PspaApplication::createGlobalParamWidget() 173 // { 174 // WContainerWidget* globalParam = new GWt_globalParameters(this); 175 // globalParam->setMinimumSize(300,100); 176 // return globalParam; 177 // } 178 179 WWidget* PspaApplication::createDashBoard() 180 { 181 WContainerWidget *result = new WContainerWidget(); 182 183 WPanel *panel = new WPanel(result); 184 panel->setTitle("dashboard"); 185 186 WContainerWidget *textdiv; 187 textdiv = new WContainerWidget(); 188 textdiv->setStyleClass("text"); 189 190 globalParam_ = new GWt_globalParameters(dtmanage_,textdiv); 191 192 WContainerWidget *cnt = new WContainerWidget(); 193 WContainerWidget *buttons = new WContainerWidget(); 194 buttons->setStyleClass("buttons"); 195 196 WPushButton *button; 197 button = new WPushButton("globalParameters", buttons); 198 button->clicked().connect(this, &PspaApplication::messageBox1); 199 200 button = new WPushButton("fodoCells", buttons); 201 button->clicked().connect(this, &PspaApplication::messageBox2); 202 203 styleSheet().addRule(".buttons","padding: 5px;"); 204 styleSheet().addRule(".text", "padding: 4px 8px"); 205 styleSheet().addRule("body", "margin: 0px;"); 206 207 cnt->addWidget(buttons); 208 cnt->addWidget(textdiv); 209 panel->setCentralWidget(cnt); 210 return result; 211 } 212 213 void PspaApplication::messageBox1() 214 { 215 globalParam_->initilializeDialog(); 216 return; 217 } 218 219 void PspaApplication::messageBox2() 220 { 221 return; 195 222 } 196 223 … … 203 230 new WBreak(palette); 204 231 } 205 206 232 return palette; 207 233 } … … 231 257 return beamLine_; 232 258 } 233 234 WWidget* PspaApplication::createGlobalParamWidget()235 {236 WContainerWidget* globalParam = new GWt_globalParameters(this);237 globalParam->setMinimumSize(300,100);238 return globalParam;239 }240 241 259 242 260 void PspaApplication::dialogOnGraphics() … … 639 657 new WText(" after element : " + elementLabel, phaseSpaceDialog->contents()); 640 658 641 for (int k=0 ; k < legende.size(); k++) {659 for (int k=0 ; k < (int)legende.size(); k++) { 642 660 new WBreak(phaseSpaceDialog->contents()); 643 661 new WText(legende.at(k), phaseSpaceDialog->contents()); … … 1062 1080 new WText(" after element : " + elementLabel, w); 1063 1081 1064 for (int k=0 ; k < legende.size(); k++) {1082 for (int k=0 ; k < (int)legende.size(); k++) { 1065 1083 new WBreak(w); 1066 1084 new WText(legende.at(k), w); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r419 r427 19 19 #include "GWt_globalParameters.h" 20 20 #include "GWt_sectionToExecute.h" 21 21 #include "GWt_pspaApplication.h" 22 22 23 23 GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager,PspaApplication* pspa) … … 29 29 // bouton execute 30 30 exec_go_ = new WPushButton("execute!"); 31 // exec_go_->setMinimumSize(300,300);32 // exec_go_->setDisabled(true);33 31 exec_go_->clicked().connect(this, &GWt_softwarePanel::executer); 34 35 36 // preparation du bouton push_ok 37 // WPushButton* exec_ok = new WPushButton("ok"); 38 // exec_ok->clicked().connect(this, &GWt_softwarePanel::updateSectionSelection); 39 32 40 33 // le panel 41 34 WPanel *panelLogiciels = new WPanel(this); … … 43 36 44 37 contenuSections_ = new WContainerWidget(); 45 // contenuSections_->addWidget(exec_ok);46 38 contenuSections_->addWidget(exec_go_); 47 39 contenuSections_->addWidget(new WBreak()); … … 56 48 57 49 void GWt_softwarePanel::addSectionToExecuteW() 58 { 59 50 { 60 51 abstractElement* premierElement; 61 52 abstractElement* dernierElement; … … 63 54 int premierIndex = 0; 64 55 int dernierIndex = 0; 65 66 56 57 // if there is no section 67 58 if(sections_.size() == 0) { 68 69 70 71 // if this is not the first :72 // - first element will be the last of the previous section73 // (or the same if it is the last of the beam line)74 // - lastElement will be the last of the beam line75 // - software will be the first of the list76 59 premierElement = pspa_->getBeamLine()->getAbstractElement(0); 60 premierIndex = 0; 61 62 // if this is not the first : 63 // - first element will be the last of the previous section 64 // (or the same if it is the last of the beam line) 65 // - lastElement will be the last of the beam line 66 // - software will be the first of the list 67 77 68 } else { 78 69 dernierElement = pspa_->getBeamLine()->getAbstractElement(pspa_->getBeamLine()->getBeamLineSize()-1); 79 70 dernierIndex = pspa_->getBeamLine()->getBeamLineSize()-1; 80 71 81 72 premierElement = dernierElement; 82 73 premierIndex = dernierIndex; 83 84 /* int indexOfLastElementOfLastSection = dtmanage_->getJobListAt(dtmanage_->getJobListSize()-1)->getLastElementNumberInSection();85 86 87 // if there are still elements at the end88 if (pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection+1) != NULL ) {89 premierIndex = indexOfLastElementOfLastSection+1;90 premierElement = pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection+1);91 92 // if this is the last element93 } else {94 premierIndex = indexOfLastElementOfLastSection;95 premierElement = pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection);96 97 }98 */99 74 } 100 75 … … 102 77 dernierIndex = pspa_->getBeamLine()->getBeamLineSize()-1; 103 78 // cout << "PspaApplication::addSectionToExecute() : " << premierText << " ââ " << dernierText << endl; 104 105 79 106 80 // abstractSoftware* soft = NULL; … … 140 114 // push back on sections vector 141 115 sections_.push_back(newSection); 142 143 116 contenuSections_->addWidget(newSection); 144 145 117 updateSections(); 146 118 } 147 148 149 // void GWt_softwarePanel::disableSectionExecute()150 // {151 // exec_go_->setDisabled(true);152 // }153 154 155 // void GWt_softwarePanel::checkSectionSelection()156 // {157 // if ( selectedSections_.empty() ) return;158 159 // // traitement de la premiere ligne160 // // on impose le depart du calcul au premier element161 // string premier = dtmanage_->getLabelFromElementNumero(1);162 // (*selectedSections_.begin())->debut->setText(premier);163 164 // string currentString = (*selectedSections_.begin())->fin->text().toUTF8();165 // int current = dtmanage_->getNumeroFromElementLabel(currentString);166 167 // // si la fin est mal definie on prend toute la config par defaut168 // if ( current <= 0 || current > dtmanage_->getBeamLineSize() )169 // {170 // current = dtmanage_->getBeamLineSize();171 // currentString = dtmanage_->getLabelFromElementNumero(current);172 // (*selectedSections_.begin())->fin->setText(currentString);173 // }174 // current++;175 // currentString = dtmanage_->getLabelFromElementNumero(current);176 177 // // traitement des suivantes (on avance d'un cran dans la liste)178 // list<GWt_sectionToExecute*>::iterator itr, itr0;179 // itr0 = selectedSections_.begin();180 // itr0++;181 // for (itr = itr0; itr != selectedSections_.end(); itr++)182 // {183 // // debut184 // if ( current > dtmanage_->getBeamLineSize() )185 // {186 // GWt_dialog warningDialog("PSPA :: verification des sections", " bad section definition !", GWt_dialog::Error,true,true);187 // warningDialog.exec();188 // return;189 // }190 191 // (*itr)->debut->setText(currentString);192 // // fin193 // string finString = (*itr)->fin->text().toUTF8();194 195 // int numeroFin = dtmanage_->getNumeroFromElementLabel( finString);196 197 // if ( numeroFin < current || numeroFin > dtmanage_->getBeamLineSize())198 // {199 // GWt_dialog warningDialog("PSPA : Checking of sections", " bad section definition !", GWt_dialog::Error, true,true);200 // warningDialog.exec();201 // return;202 // }203 204 // // preparation de la ligne suivante205 // current = numeroFin +1;206 // currentString = dtmanage_->getLabelFromElementNumero(current);207 // }208 209 // if (!areDataCoherent()) {210 // GWt_dialog warningDialog("PSPA : verification des sections", " donnees incoherentes !", GWt_dialog::Error,true,true);211 // warningDialog.exec();212 // }213 // else214 // {215 // exec_go_->setDisabled(false);216 217 // // All ok, then put colors on beamLine218 // list<GWt_sectionToExecute*>::iterator itr2;219 // for(itr2 = selectedSections_.begin();itr2 != selectedSections_.end(); itr2++)220 // {221 // string debString = (*itr2)->debut->text().toUTF8();222 // string finString = (*itr2)->fin->text().toUTF8();223 224 225 // int debut = dtmanage_->getNumeroFromElementLabel(debString);226 // int fin = dtmanage_->getNumeroFromElementLabel(finString);227 // /**228 // for (int i=debut; i=<fin; i++) {229 // getBeamLine()->getAbstractElement(i)->setBGColor(230 231 // }232 // nomDeLogiciel prog = nomDeLogiciel ( (*itr)->selection->currentIndex() );233 // dtmanage_->addSectionToExecute(debut,fin,prog);234 // */235 // }236 // }237 238 239 // }240 119 241 120 bool GWt_softwarePanel::updateSectionSelection() … … 435 314 } 436 315 437 438 439 /*440 string GWt_softwarePanel::getSelection()441 {442 list<GWt_sectionToExecute*>::iterator itr = selectedSections_.begin();443 string str = (*itr)->fin->text().toUTF8();444 return str;445 }446 */447 448 316 void GWt_softwarePanel::executer() 449 317 { 450 318 451 319 if (!areDataCoherent()) { 452 // GWt_dialog warningDialog("PSPA : verification des sections", " donnees incoherentes !", GWt_dialog::Error,true,true);453 // warningDialog.exec();454 // exec_go_->setDisabled(true);455 320 return; 456 } 457 458 // GWt_console* console = NULL; 459 // if (static_cast<GWt_console*> (wApp->findWidget ("console"))) { 460 // console = static_cast<GWt_console*> (wApp->findWidget ("console")); 461 // console->addConsoleMessage(string("on va peut etre y arriver")); 462 // } 321 } 463 322 464 323 static_cast<GWt_globalParameters*>(pspa_->getGlobalParam())->updateGlobals();
Note: See TracChangeset
for help on using the changeset viewer.