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

preparation pour ajouter une maille FODO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.