Changeset 347 in PSPA for Interface_Web


Ignore:
Timestamp:
Feb 26, 2013, 3:19:15 PM (11 years ago)
Author:
garnier
Message:

Ameliorations pour la sauvegarde des fichiers et autres

Location:
Interface_Web/trunk/pspaWT
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/History

    r341 r347  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     7
     826 février 2013 Laurent Garnier
     9- pspa.css : Ajout de bordures rondes sur les elements et qq autres trucs
     10- beam2moments : Correction d'un warning qui se pourait être un bug
     11- dataManager : saveConfiguration(string folder, string nameOfCase).
     12   Ajout d'un dossiers pour le stockage des fichiers de config
     13- abstractSoftware : Ajout d'une méthode pour retourner la couleur du fond du software.
     14- GWt_elementLigneFaisceau : Coup de rafraihissement visuel
     15- GWt_serverFileSelector : Management des fichiers des sessions utilisateur
     16- PspaApplication : Remise a jour avec l'ajout du dossier en parametre de saveConfiguration()
    717
    81822 février 2013 Guy Le Meur
  • Interface_Web/trunk/pspaWT/htdocs/pspa.css

    r318 r347  
    5555.beamLineIcon {
    5656  width: 32;
     57  background-color: #FFFFFF;
     58  box-shadow: 0 1px 3px rgba(34, 25, 25, 0.4);
     59  font-size: 11px;
     60  padding: 15px 15px 0;
     61  position: absolute;
     62  border-radius: 5px;
    5763}
     64
     65p.css-vertical-text {
     66        color:#333;
     67        border:0px solid red;
     68        writing-mode:tb-rl;
     69        -webkit-transform:rotate(270deg);
     70        -moz-transform:rotate(270deg);
     71        -o-transform: rotate(270deg);
     72        white-space:nowrap;
     73        display:block;
     74        bottom:0;
     75        width:20px;
     76        height:20px;
     77        font-family: ‘Trebuchet MS’, Helvetica, sans-serif;
     78        font-size:24px;
     79        font-weight:normal;
     80        text-shadow: 0px 0px 1px #333;
     81}
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h

    r316 r347  
    3737 virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir) = 0;
    3838
     39    /** Color of the background of this sofware
     40     Should be a valid Css name as FFEEDD
     41     */
     42    virtual string getColor() = 0;
    3943
    4044};
  • Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h

    r344 r347  
    5252  trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic);
    5353  bool executeAll();
    54   void saveConfiguration(string nameOfCase);
    55   bool restoreElements(string inputFileName);
    56   void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor);
    5754  void donneesRmsEnveloppe(string type,unsigned int lineSize,vector<double>& xcor,vector<double>& ycor);
    5855 
    59  private :
     56  /**
     57   Save a configuration file on the server
     58   @param folder
     59   @param filename
     60   */
     61    void saveConfiguration(string folder, string filename);
     62   
     63    bool restoreElements(string inputFileName);
     64   
     65    private :
     66   
    6067
    61   globalParameters globParam_;
    62   particleBeam* currentBeam_;
     68    void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor);
     69    /* inline void setWorkingDir(string wd) { */
     70    /*     workingDir_ = wd; */
     71    /* } */
    6372   
    64   vector<particleBeam> diagnosticBeam_; 
    65   vector<sectionToExecute*> jobList_;
    66  
    67   void removeFile(string nameOfFile);
    68   void clearSectionToExecute();
     73private:
     74    globalParameters globParam_;
     75    particleBeam* currentBeam_;
     76   
     77    vector<particleBeam> diagnosticBeam_;
     78   
     79    vector<sectionToExecute*> jobList_;
     80   
     81    void removeFile(string nameOfFile);
     82    void clearSectionToExecute();
    6983
    7084  PspaApplication* pspa_;
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h

    r316 r347  
    3333  virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir);
    3434
     35    inline string getColor() {
     36        return "#a3c0ed";
     37    }
    3538};
    3639
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h

    r316 r347  
    3333virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir);
    3434
     35    inline string getColor() {
     36        return "#e09bdf";
     37    }
    3538
    3639
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h

    r333 r347  
    3131  virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir);
    3232
     33  inline string getColor() {
     34      return "#ecc38e";
     35  }
    3336};
    3437#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h

    r316 r347  
    2424virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir);
    2525
    26 
     26    inline string getColor() {
     27        return "#c0ea8e";
     28    }
    2729};
    2830#endif
  • Interface_Web/trunk/pspaWT/sources/controler/src/beam2Moments.cc

    r336 r347  
    9090    getline(inp, buf);
    9191    stringstream str(buf);
    92       test = str >> bidon >>  bidString >>  bidon >>  ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString;
     92      if (!(str >> bidon >>  bidString >>  bidon >>  ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString)) {
     93          test = false;
     94      }
    9395    cout << " beam2Moments::readFromTransportOutput TEST= " << test << endl;
    9496  }
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r342 r347  
    99#include "softwareTest.h"
    1010
     11#include <boost/filesystem.hpp>
    1112#include <stdio.h>
    1213#include <fstream>
     
    213214}
    214215
    215 void dataManager::saveConfiguration( string nameOfCase)
    216 {
    217   ofstream outfile;
    218   string name = pspa_->getWorkingDir() + nameOfCase + ".save";
    219   outfile.open(name.c_str(), ios::out);
    220   if (!outfile) {
    221     cerr << " error opening output file for persistency " << name << endl;
     216void dataManager::saveConfiguration(string folder, string nameOfFile)
     217{
     218    ofstream outfile;
     219    string name = pspa_->getWorkingDir()+ folder + "/" + nameOfFile + ".save";
     220
     221    // make dir if not exist
     222    boost::filesystem::create_directories(pspa_->getWorkingDir() + folder + "/");
     223   
     224    outfile.open(name.c_str(), ios::out);
     225    if (!outfile) {
     226        cerr << " error opening output file for persistency " << name << endl;
    222227    }
    223228 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h

    r305 r347  
    3737    ~GWt_elementLigneFaisceau();
    3838    void addElement(GWt_abstractElement* elem);
     39    void setBGColor(const WColor);
    3940   
    4041    inline WText* getElementName() {
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc

    r343 r347  
    8484  gridLayout->addWidget (dropZoneRight_,0,2);
    8585   
    86   // add the image if present
    87  
    88   switch ( eType ) {
    89   case RFgun :
    90     GWt_abstractElement_ = new GWt_rfgun(this);
    91     break;
    92   case drift :
    93     GWt_abstractElement_ = new GWt_drift(this);
    94     break;
    95   case cell  :
    96     GWt_abstractElement_ = new GWt_cell(this);
    97     break;
    98   case bend  :
    99     GWt_abstractElement_ = new GWt_bend(this);
    100     break;
    101   case soleno  :
    102     GWt_abstractElement_ = new GWt_soleno(this);
    103     break;
    104   case beam  :
    105     GWt_abstractElement_ = new GWt_beam(this);
    106     break;
    107   case fit  :
    108     GWt_abstractElement_ = new GWt_fit(this);
    109     break;
    110   case snapshot :
    111     GWt_abstractElement_ = new GWt_snapshot(this);
    112     break;
    113   case inconnu :
    114     GWt_abstractElement_ = NULL;
    115   }
    116 
    117   if (GWt_abstractElement_ != NULL) {
    118     gridLayout->addWidget(GWt_abstractElement_,0,1);
    119     GWt_abstractElement_->setMaximumSize(32,32);
    120     GWt_abstractElement_->setMinimumSize(32,32);
    121   }
    122  
    123   // add second line
     86    // add first line :  initialize arrow and link images
     87    dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(pspa_);
     88    dropZoneRight_ = new GWt_dropZoneLigneFaisceau(pspa_);
     89   
     90    // change object name in order to manage css :
     91    dropZoneLeft_->resize(10,30);
     92    dropZoneRight_->resize(10,30);
     93   
     94    gridLayout->addWidget       (dropZoneLeft_,0,0);
     95    gridLayout->addWidget       (dropZoneRight_,0,2);
     96   
     97    // add the image if present
     98   
     99    switch (  eType ) {
     100        case RFgun :
     101            GWt_abstractElement_ = new GWt_rfgun(this);
     102            break;
     103        case drift :
     104            GWt_abstractElement_ = new GWt_drift(this);
     105            break;
     106        case cell  :
     107            GWt_abstractElement_ = new GWt_cell(this);
     108            break;
     109        case bend  :
     110            GWt_abstractElement_ = new GWt_bend(this);
     111            break;
     112        case soleno  :
     113            GWt_abstractElement_ = new GWt_soleno(this);
     114            break;
     115        case beam  :
     116            GWt_abstractElement_ = new GWt_beam(this);
     117            break;
     118        case fit  :
     119            GWt_abstractElement_ = new GWt_fit(this);
     120            break;
     121        case inconnu :
     122            GWt_abstractElement_ = NULL;
     123    }
     124    if (GWt_abstractElement_ != NULL) {
     125        gridLayout->addWidget   (GWt_abstractElement_,0,1);
     126        GWt_abstractElement_->setMaximumSize(80,80);
     127        GWt_abstractElement_->setMinimumSize(80,80);
     128    }
     129   
     130    // add second line
     131
    124132    if (GWt_abstractElement_ == NULL) {
    125133      elementLabel_ = new WText();
     
    141149{
    142150}
     151
     152void GWt_elementLigneFaisceau::setBGColor(const WColor c) {
     153    decorationStyle().setBackgroundColor (c);
     154}
     155
    143156
    144157void GWt_elementLigneFaisceau::removeDone(GWt_abstractElement* gw)
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r343 r347  
    9292    boutongraphicalAnalysis->setStyleClass("histoButton");
    9393   
    94     boutonSauve->setToolTip ("sauvegarder la config");
    95     boutonRestaure->setToolTip (" restaurer la config");
    96     boutonLoadNew->setToolTip ("upload config");
     94    boutonSauve->setToolTip ("sauvegarder votre configuration");
     95    boutonRestaure->setToolTip (" restaurer la configuration depuis le serveur");
     96    boutonLoadNew->setToolTip ("charger une configuration");
    9797    boutongraphicalAnalysis->setToolTip ("analyse graphique");
    9898   
     
    324324}
    325325
     326
    326327void PspaApplication::sauver()
    327328{
     
    340341}
    341342
     343
    342344void PspaApplication::dialogSaveDone(WDialog::DialogCode code)
    343345{
    344  
    345   if ( code != Wt::WDialog::Accepted ) { console_->addConsoleMessage(" pas de sauvegarde"); return;}
    346   else { console_->addConsoleMessage("sauvegarde sur repertoire : " + workingDir_);}
    347   nameOfCase_ = saveNameEdit_->text().toUTF8();
    348   cout << " PspaApplication::dialogSaveDone() sur fichier = " << nameOfCase_ << endl;
    349   delete dialogSave_;
    350   dialogSave_ = NULL;
    351   GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_);
    352   bibi->updateGlobals();
    353   //  dtmanage_->saveConfiguration(nameOfCase_);
    354   dtmanage_->saveConfiguration( nameOfCase_);
     346    if ( code != Wt::WDialog::Accepted ) {
     347        return;
     348    }
     349    nameOfCase_ = saveNameEdit_->text().toUTF8();
     350    delete dialogSave_;
     351    dialogSave_ = NULL;
     352
     353    GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_);
     354    bibi->updateGlobals();
     355    //  dtmanage_->saveConfiguration(nameOfCase_);
     356    dtmanage_->saveConfiguration(sessionId(),nameOfCase_);
    355357}
    356358
     
    902904  chart->setLegendStyle(chart->legendFont(), WPen(black), WBrush(WColor(0xFF, 0xFA, 0xE5)));
    903905}
     906
     907
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc

    r337 r347  
    1010#include <Wt/WTreeNode>
    1111#include <Wt/WIconPair>
     12#include <Wt/WApplication>
     13
    1214#include <boost/algorithm/string.hpp>
    1315#include <dirent.h>             /* readdir(), etc.                    */
     
    5759   
    5860    buildConfigurationFileTree(treeFileRoot, workingDir_.c_str(), ".save");
    59    
     61
     62    // Add user files
     63    Wt::WTreeNode* userTreeFileRoot = new Wt::WTreeNode("MySession", folderIcon);
     64    buildConfigurationFileTree(treeFileRoot, (workingDir_+WApplication::instance()->sessionId()).c_str(), ".save");
     65
    6066    treeFileRoot->expand();
    6167    WContainerWidget *treeContainer = new WContainerWidget();
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r343 r347  
    180180    {
    181181      exec_go_->setDisabled(false);
    182     }
     182       
     183        // All ok, then put colors on beamLine
     184        list<GWt_sectionToExecute*>::iterator itr2;
     185        for(itr2 = selectedSections_.begin();itr2 != selectedSections_.end(); itr2++)
     186        {
     187            string debString = (*itr)->debut->text().toUTF8();
     188            string finString = (*itr)->fin->text().toUTF8();
     189           
     190           
     191            int debut = dtmanage_->getNumeroFromElementLabel(debString);
     192            int fin = dtmanage_->getNumeroFromElementLabel(finString);
     193/**
     194 for (int i=debut; i=<fin; i++) {
     195                getBeamLine()->getAbstractElement(i)->setBGColor(
     196               
     197            }
     198            nomDeLogiciel prog = nomDeLogiciel ( (*itr)->selection->currentIndex() );
     199            dtmanage_->addSectionToExecute(debut,fin,prog);
     200*/
     201        }
     202    }
     203   
     204
    183205}
    184206
Note: See TracChangeset for help on using the changeset viewer.