Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/5c5f811cff36
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 00:33:04 2012
Кодировка: UTF-8
allpy: 5c5f811cff36

allpy

changeset 1008:5c5f811cff36

pair-cores/web: add Reset and Refresh buttons Refresh button is used in HTML mode.
author Boris Nagaev <bnagaev@gmail.com>
date Sun, 04 Mar 2012 18:55:59 +0400
parents 2a651e494c3b
children e92b82094511
files pair_cores/web/approot/locales/pair-cores-web.xml pair_cores/web/approot/locales/pair-cores-web_ru.xml pair_cores/web/pair-cores.cpp
diffstat 3 files changed, 23 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/pair_cores/web/approot/locales/pair-cores-web.xml	Sun Mar 04 02:03:31 2012 +0400
     1.2 +++ b/pair_cores/web/approot/locales/pair-cores-web.xml	Sun Mar 04 18:55:59 2012 +0400
     1.3 @@ -20,6 +20,8 @@
     1.4      </message>
     1.5  
     1.6      <message id='pair.main.Header'><h1>PairCores</h1></message>
     1.7 +    <message id='pair.main.Refresh'>Refresh</message>
     1.8 +    <message id='pair.main.Reset'>Reset</message>
     1.9      <message id='pair.main.Example'>
    1.10          Here is an example of an alignment for input for the program:
    1.11      </message>
     2.1 --- a/pair_cores/web/approot/locales/pair-cores-web_ru.xml	Sun Mar 04 02:03:31 2012 +0400
     2.2 +++ b/pair_cores/web/approot/locales/pair-cores-web_ru.xml	Sun Mar 04 18:55:59 2012 +0400
     2.3 @@ -26,6 +26,8 @@
     2.4          Пропускать ядра, входящие в один элемент вторичной структуры
     2.5      </message>
     2.6  
     2.7 +    <message id='pair.main.Refresh'>Обновить</message>
     2.8 +    <message id='pair.main.Reset'>Сбросить</message>
     2.9      <message id='pair.main.Example'>
    2.10          Пример входного выравнивания для программы:
    2.11      </message>
     3.1 --- a/pair_cores/web/pair-cores.cpp	Sun Mar 04 02:03:31 2012 +0400
     3.2 +++ b/pair_cores/web/pair-cores.cpp	Sun Mar 04 18:55:59 2012 +0400
     3.3 @@ -1,12 +1,14 @@
     3.4  #include <boost/bind.hpp>
     3.5  
     3.6  #include <Wt/WApplication>
     3.7 +#include <Wt/WEnvironment>
     3.8  #include <Wt/WIntValidator>
     3.9  #include <Wt/WDoubleValidator>
    3.10  #include <Wt/WLineEdit>
    3.11  #include <Wt/WCheckBox>
    3.12  #include <Wt/WTemplate>
    3.13  #include <Wt/WFileUpload>
    3.14 +#include <Wt/WPushButton>
    3.15  
    3.16  #include "wc/src/Wbi.hpp"
    3.17  
    3.18 @@ -44,6 +46,12 @@
    3.19  public:
    3.20      PairCoresApp(const WEnvironment& env);
    3.21  
    3.22 +private:
    3.23 +    void reset_contents();
    3.24 +
    3.25 +    void do_nothing()
    3.26 +    { }
    3.27 +
    3.28      static Wt::WString tr(const char* key) {
    3.29          return Wt::WString::tr(key);
    3.30      }
    3.31 @@ -57,8 +65,19 @@
    3.32      messageResourceBundle().use(Wt::WApplication::appRoot() +
    3.33                                  "locales/pair-cores-web");
    3.34      useStyleSheet("css/pair-cores.css");
    3.35 +    reset_contents();
    3.36 +}
    3.37 +
    3.38 +void PairCoresApp::reset_contents() {
    3.39 +    root()->clear();
    3.40      //
    3.41      new Wt::WTemplate(tr("pair.main.Header"), root());
    3.42 +    if (!environment().ajax()) {
    3.43 +        WPushButton* refresh = new WPushButton(tr("pair.main.Refresh"), root());
    3.44 +        refresh->clicked().connect(this, &PairCoresApp::do_nothing);
    3.45 +    }
    3.46 +    WPushButton* reset = new WPushButton(tr("pair.main.Reset"), root());
    3.47 +    reset->clicked().connect(this, &PairCoresApp::reset_contents);
    3.48      //
    3.49      TableTask* task = new TableTask(root());
    3.50      //