allpy
changeset 23:7dfa2944e94a
compiled
try to format run comand
author | boris <bnagaev@gmail.com> |
---|---|
date | Wed, 15 Sep 2010 00:55:43 +0400 |
parents | 8779707b119d |
children | c4df940ab284 |
files | blocks3d-wt-widget.C blocks3d-wt-widget.h config.C config.h |
diffstat | 4 files changed, 44 insertions(+), 9 deletions(-) [+] |
line diff
1.1 --- a/blocks3d-wt-widget.C Wed Sep 15 00:33:26 2010 +0400 1.2 +++ b/blocks3d-wt-widget.C Wed Sep 15 00:55:43 2010 +0400 1.3 @@ -11,7 +11,8 @@ 1.4 #include <Wt/WMessageBox> 1.5 1.6 #include <fstream> 1.7 -#include <boost/lexical_cast.hpp> 1.8 +#include <fstream> 1.9 +#include <boost/format.hpp> 1.10 1.11 Blocks3DWidget::Blocks3DWidget(Wt::WContainerWidget *parent) : 1.12 Wt::WContainerWidget(parent) 1.13 @@ -92,7 +93,7 @@ 1.14 Wt::WMessageBox::show("Error", "File too large", Wt::Ok); 1.15 } 1.16 1.17 -void Blocks3DWidget::textarea_from_file(Wt::WTextArea* ta, char* file) 1.18 +void Blocks3DWidget::textarea_from_file(Wt::WTextArea* ta, const char* file) 1.19 { 1.20 std::string temp(""); 1.21 std::string total(""); 1.22 @@ -114,15 +115,13 @@ 1.23 1.24 void Blocks3DWidget::alignment_uploaded() 1.25 { 1.26 - textarea_from_file(alignment_textarea, 1.27 - boost::lexical_cast<char*>(alignment_upload->spoolFileName())); 1.28 + textarea_from_file(alignment_textarea, alignment_upload->spoolFileName().c_str()); 1.29 try_to_run(); 1.30 } 1.31 1.32 void Blocks3DWidget::conformity_uploaded() 1.33 { 1.34 - textarea_from_file(conformity_textarea, 1.35 - boost::lexical_cast<char*>(conformity_upload->spoolFileName())); 1.36 + textarea_from_file(conformity_textarea, conformity_upload->spoolFileName().c_str()); 1.37 try_to_run(); 1.38 } 1.39 1.40 @@ -130,7 +129,7 @@ 1.41 { 1.42 std::string alignment = conformity_textarea->text().toUTF8(); 1.43 std::string conformity = conformity_textarea->text().toUTF8(); 1.44 - if (alignment.empty() || conformity.empty()) 1.45 + if (alignment.empty()) 1.46 { 1.47 return; 1.48 } 1.49 @@ -153,6 +152,33 @@ 1.50 1.51 Wt::WMessageBox::show("Ok", "Ok", Wt::Ok); 1.52 1.53 + std::ofstream alignment_file; 1.54 + alignment_file.open(Malakite::tempfile_alignment); 1.55 + alignment_file << alignment; 1.56 + alignment_file.close(); 1.57 + 1.58 + if (!conformity.empty()) 1.59 + { 1.60 + std::ofstream conformity_file; 1.61 + conformity_file.open(Malakite::tempfile_conformity); 1.62 + conformity_file << conformity; 1.63 + conformity_file.close(); 1.64 + } 1.65 + 1.66 + if (conformity.empty()) 1.67 + { 1.68 + std::string conformity_option = ""; 1.69 + } 1.70 + else 1.71 + { 1.72 + std::string conformity_option = 1.73 + str(boost::format("-c ") % Malakite::tempfile_conformity); 1.74 + } 1.75 + 1.76 + //~ std::string cmd = str(boost::format("-i %s %s -H %s -d %s -m %s -t %s -T %s") 1.77 + //~ % Malakite::tempfile_alignment % conformity_option % Malakite::tempfile_html 1.78 + //~ % delta_input->text().toUTF8() % min_block_width_input->text().toUTF8() 1.79 + //~ % timeout_input->text().toUTF8() % timeout2_input->text().toUTF8()); 1.80 1.81 1.82 }
2.1 --- a/blocks3d-wt-widget.h Wed Sep 15 00:33:26 2010 +0400 2.2 +++ b/blocks3d-wt-widget.h Wed Sep 15 00:55:43 2010 +0400 2.3 @@ -36,10 +36,11 @@ 2.4 Wt::WIntValidator *timeout_validator; 2.5 Wt::WIntValidator *timeout2_validator; 2.6 2.7 - void textarea_from_file(Wt::WTextArea* ta, char* file); 2.8 + void textarea_from_file(Wt::WTextArea* ta, const char* file); 2.9 void go_button_click(); 2.10 void alignment_uploaded(); 2.11 void conformity_uploaded(); 2.12 + void fileTooLarge(); 2.13 void try_to_run(); 2.14 - void fileTooLarge(); 2.15 + //~ void execute(); 2.16 };
3.1 --- a/config.C Wed Sep 15 00:33:26 2010 +0400 3.2 +++ b/config.C Wed Sep 15 00:55:43 2010 +0400 3.3 @@ -1,5 +1,6 @@ 3.4 3.5 #include "config.h" 3.6 +#include <boost/format.hpp> 3.7 3.8 3.9 namespace Malakite 3.10 @@ -11,6 +12,9 @@ 3.11 3.12 const char* main_url = "/"; 3.13 3.14 +const char* tempfile_alignment = str(boost::format("%s/%s") % temp_path % "in_al.fasta").c_str(); 3.15 +const char* tempfile_conformity = str(boost::format("%s/%s") % temp_path % "in_conf.fasta").c_str(); 3.16 +const char* tempfile_html = str(boost::format("%s/%s") % temp_path % "out.html").c_str(); 3.17 3.18 namespace defaults 3.19 {
4.1 --- a/config.h Wed Sep 15 00:33:26 2010 +0400 4.2 +++ b/config.h Wed Sep 15 00:55:43 2010 +0400 4.3 @@ -9,6 +9,10 @@ 4.4 4.5 extern const char* main_url; 4.6 4.7 +extern const char* tempfile_alignment; 4.8 +extern const char* tempfile_conformity; 4.9 +extern const char* tempfile_html; 4.10 + 4.11 namespace defaults 4.12 { 4.13