Changeset 427 in PSPA


Ignore:
Timestamp:
Oct 25, 2013, 3:51:05 PM (11 years ago)
Author:
touze
Message:

preparation pour ajouter une maille FODO

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  
    1313
    1414
    15 GWt_console::GWt_console()
    16 :WContainerWidget()
     15GWt_console::GWt_console() : WContainerWidget()
    1716{
    18     setObjectName("console");
     17  setObjectName("console");
    1918
    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();
    2321   
    24     Wt::WLabel *label = new Wt::WLabel("Search ", searchContainer);
    25     searchLineEdit_ = new Wt::WLineEdit("", searchContainer);
    26     searchLineEdit_->setToolTip("clic here to search a string in the output");
     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");
    2725   
    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);
    5548}
    56 
    5749
    5850GWt_console::~GWt_console()
     
    6052}
    6153
    62 
    6354void 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++;
    6679   
    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);
    7381   
    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);
    8894       
    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;
    122113            }
    123114        } else {
     
    133124
    134125void GWt_console::addConsoleMessage(WString msg) {
    135    
    136     // changes specials caracters
    137     outputOriginal_ += Wt::Utils::htmlEncode (msg.toUTF8(),  Wt::Utils::EncodeNewLines);
    138 
    139     // apply filter, will modify outputCurrent
    140     searchFilter();
    141     /*
    142      * Little javascript trick to make sure we scroll along with new content
    143      */
    144     wApp->doJavaScript(outputCurrent_->jsRef() + ".scrollTop += "
    145                        + outputCurrent_->jsRef() + ".scrollHeight;");
    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 
    147138}
    148139
  • 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>
    53#include <Wt/WLineEdit>
    64#include <Wt/WBreak>
    75#include <Wt/WPushButton>
    86
    9 #include <Wt/WComboBox>
    10 
    11 #include "mixedTools.h"
     7#include "GWt_globalParameters.h"
    128#include "GWt_console.h"
    139
     10#include "dataManager.h"
    1411
    15 GWt_globalParameters::GWt_globalParameters(PspaApplication* ps)
     12GWt_globalParameters::GWt_globalParameters(dataManager* dt)
    1613{
    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;
    8015}
    8116
    82 // void GWt_globalParameters::addSection()
    83 // {
    84 //   unsigned k;
    85 //   //   WComboBox* selectionBox = new WComboBox();
     17GWt_globalParameters::GWt_globalParameters(dataManager* dt,WContainerWidget* wt)
     18{
     19  dt_ = dt;
     20  status_ = new WText("Go ahead...",wt);
     21}
    8622
    87 //     sectionSelection_.push_back(new WComboBox());
     23void GWt_globalParameters::initilializeDialog()
     24{
     25  string* param = dialogBegin();
    8826
    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());
    9040
    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);
    9545
     46  dialog_->finished().connect(this,&GWt_globalParameters::dialogDone);
     47  //dialog_->show();
     48  dialog_->exec(WAnimation(WAnimation::SlideInFromTop));
     49}
    9650
    97 //     contenuSections_->addWidget(sectionSelection_.back());
     51string* 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  }
    9860
    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}
    10377
    104 
    105 void GWt_globalParameters::renew()
     78void GWt_globalParameters::dialogDone(WDialog::DialogCode code)
    10679{
    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;
    12782}
    12883
    12984void GWt_globalParameters::updateGlobals()
    13085{
    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_);
    13894}
    13995
    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++;
     96void GWt_globalParameters::renew()
     97{
     98  string* param = dialogBegin();
    15999
    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}
    161105
    162 // void GWt_globalParameters::addElem()
    163 // {
    164 //     int dernier = pspa_->getDataManager()->beamLineSize();
    165 //     extremiteEdit1_->setText( mixedTools::intToString(dernier) );
    166 // }
     106string* GWt_globalParameters::getGlobalParameters()
     107{
     108  return envoi_;
     109}
    167110
    168 
     111void 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  
    88#include "GWt_softwarePanel.h"
    99#include "GWt_globalParameters.h"
    10 // #include "GWt_dialog.h"
    1110#include "GWt_draggableImage.h"
    1211#include "particleBeam.h"
     
    3635#include <Wt/WRadioButton>
    3736
     37#include <Wt/WPanel>
     38#include <Wt/WMessageBox>
     39
    3840#define HAS_IMAGEMAGIC 1
    3941
     
    7678  useStyleSheet("htdocs/pspa.css");
    7779  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(); 
    8783  WHBoxLayout *toolbarLayout = new WHBoxLayout();
    8884 
     
    10096 
    10197  boutonSauve->setToolTip ("sauvegarder votre configuration");
    102   boutonRestaure->setToolTip (" restaurer la configuration depuis le serveur");
     98  boutonRestaure->setToolTip ("restaurer la configuration depuis le serveur");
    10399  boutonLoadNew->setToolTip ("charger une configuration");
    104100  boutongraphicalAnalysis->setToolTip ("analyse graphique");
     
    118114  boutonSauve->clicked().connect(this, &PspaApplication::sauver);
    119115  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.
    122117  boutonLoadNew->clicked().connect(this, &PspaApplication::openFileSelector);
    123  
    124118  boutongraphicalAnalysis->clicked().connect(this, &PspaApplication::dialogOnGraphics);
    125  
    126119  boutonTrash->clicked().connect(this, &PspaApplication::removeBeamLine);
    127  
    128120  toolbarLayout->addWidget(boutonSauve , 0,Wt::AlignMiddle);
    129121  toolbarLayout->addWidget(boutonRestaure , 0,Wt::AlignMiddle);
     
    140132  mainGridLayout->addWidget(createPalette(), 2, 0, 4, 1);
    141133
    142  
    143134  WScrollArea* scroll = new  WScrollArea();
    144135  scroll->setWidget(createBeamLine());
    145136  scroll->setMinimumSize(300,150);
    146 
    147137  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
    158139  //-----------
     140
    159141  // 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
    163150  graphicsDialog_ = new GWt_dialog("graphical analysis",createDrawingWidget(),false);
    164151  graphicsDialog_->setMinimumSize(400,400);
     
    167154 
    168155  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);
    174158 
    175159  console_ = new GWt_console();
    176 
    177   // manage sizes
    178160  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);
    189166 
    190167  widroot->setLayout(mainGridLayout);
    191 
    192168  // set auto scrollbar if needed
    193169  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
     179WWidget* 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
     213void PspaApplication::messageBox1()
     214{
     215  globalParam_->initilializeDialog();
     216  return;
     217}
     218
     219void PspaApplication::messageBox2()
     220{
     221  return;
    195222}
    196223
     
    203230    new WBreak(palette);
    204231  }
    205 
    206232  return palette; 
    207233}
     
    231257  return beamLine_;
    232258}
    233 
    234 WWidget* PspaApplication::createGlobalParamWidget()
    235 {
    236   WContainerWidget* globalParam = new GWt_globalParameters(this);
    237   globalParam->setMinimumSize(300,100);
    238   return globalParam;
    239 }
    240 
    241259
    242260void PspaApplication::dialogOnGraphics()
     
    639657  new WText(" after element :  " + elementLabel, phaseSpaceDialog->contents());
    640658
    641   for (int k=0 ; k < legende.size(); k++) {
     659  for (int k=0 ; k < (int)legende.size(); k++) {
    642660    new WBreak(phaseSpaceDialog->contents());
    643661    new WText(legende.at(k), phaseSpaceDialog->contents());
     
    10621080  new WText(" after element :  " + elementLabel, w);
    10631081
    1064   for (int k=0 ; k < legende.size(); k++) {
     1082  for (int k=0 ; k < (int)legende.size(); k++) {
    10651083    new WBreak(w);
    10661084    new WText(legende.at(k), w);
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r419 r427  
    1919#include "GWt_globalParameters.h"
    2020#include "GWt_sectionToExecute.h"
    21 
     21#include "GWt_pspaApplication.h"
    2222
    2323GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager,PspaApplication* pspa)
     
    2929  // bouton execute
    3030  exec_go_ = new WPushButton("execute!");
    31   //    exec_go_->setMinimumSize(300,300);
    32   //  exec_go_->setDisabled(true);
    3331  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
    4033  // le panel
    4134  WPanel *panelLogiciels = new WPanel(this);
     
    4336 
    4437  contenuSections_ = new WContainerWidget();
    45   //  contenuSections_->addWidget(exec_ok);
    4638  contenuSections_->addWidget(exec_go_);
    4739  contenuSections_->addWidget(new WBreak());
     
    5648
    5749void GWt_softwarePanel::addSectionToExecuteW()
    58 {   
    59  
     50{     
    6051  abstractElement* premierElement;
    6152  abstractElement* dernierElement;
     
    6354  int premierIndex = 0;
    6455  int dernierIndex = 0;
    65 
    66     // if there is no section
     56 
     57  // if there is no section
    6758  if(sections_.size() == 0) {
    68       premierElement = pspa_->getBeamLine()->getAbstractElement(0);
    69       premierIndex = 0;
    70 
    71   // if this is not the first :
    72   // - first element will be the last of the previous section
    73   // (or the same if it is the last of the beam line)
    74   // - lastElement will be the last of the beam line
    75   // - software will be the first of the list
    76      
     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   
    7768  } else {
    7869    dernierElement = pspa_->getBeamLine()->getAbstractElement(pspa_->getBeamLine()->getBeamLineSize()-1);
    7970    dernierIndex = pspa_->getBeamLine()->getBeamLineSize()-1;
    80 
     71   
    8172    premierElement = dernierElement;
    8273    premierIndex = dernierIndex;
    83    
    84 /*    int indexOfLastElementOfLastSection = dtmanage_->getJobListAt(dtmanage_->getJobListSize()-1)->getLastElementNumberInSection();
    85 
    86    
    87     // if there are still elements at the end
    88     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 element
    93     } else {
    94       premierIndex = indexOfLastElementOfLastSection;
    95       premierElement = pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection);
    96        
    97     }
    98  */
    9974  }
    10075 
     
    10277  dernierIndex = pspa_->getBeamLine()->getBeamLineSize()-1;
    10378  //  cout << "PspaApplication::addSectionToExecute() : " << premierText << " à  " << dernierText << endl;
    104  
    10579 
    10680  //  abstractSoftware* soft = NULL;
     
    140114  // push back on sections vector
    141115  sections_.push_back(newSection);
    142 
    143116  contenuSections_->addWidget(newSection);
    144  
    145117  updateSections();
    146118}
    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 ligne
    160 //   // on impose le depart du calcul au premier element
    161 //   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 defaut
    168 //   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 //       // debut
    184 //       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 //       // fin
    193 //       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 suivante
    205 //       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 //   else
    214 //     {
    215 //       exec_go_->setDisabled(false);
    216        
    217 //         // All ok, then put colors on beamLine
    218 //         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 // }
    240119
    241120bool GWt_softwarePanel::updateSectionSelection()
     
    435314}
    436315
    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 
    448316void GWt_softwarePanel::executer()
    449317{
    450 
     318 
    451319  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);
    455320    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  } 
    463322 
    464323  static_cast<GWt_globalParameters*>(pspa_->getGlobalParam())->updateGlobals();
Note: See TracChangeset for help on using the changeset viewer.