|
|
|
|
@ -1,31 +1,64 @@
|
|
|
|
|
#include "api.h" |
|
|
|
|
namespace juci_api{ |
|
|
|
|
|
|
|
|
|
void cpp::ReplaceWord(const std::string word) { |
|
|
|
|
//TODO implement api::ReplaceWord / change string to iter?
|
|
|
|
|
std::shared_ptr<Menu::Controller> libjuci::ApiServiceProvider::menu_; |
|
|
|
|
std::shared_ptr<Notebook::Controller> libjuci::ApiServiceProvider::notebook_; |
|
|
|
|
|
|
|
|
|
/////////////////////////////
|
|
|
|
|
//// API ServiceProvider ////
|
|
|
|
|
/////////////////////////////
|
|
|
|
|
libjuci::ApiServiceProvider::ApiServiceProvider( ){ |
|
|
|
|
std::cout << "Apiservice std.ctor" << std::endl; |
|
|
|
|
} |
|
|
|
|
void libjuci::ApiServiceProvider::ReplaceWord(std::string word){ |
|
|
|
|
std::cout << word << std::endl; |
|
|
|
|
} |
|
|
|
|
void libjuci::ApiServiceProvider::ReplaceLine(std::string line){} |
|
|
|
|
|
|
|
|
|
void libjuci::ApiServiceProvider::AddKeybinding() { |
|
|
|
|
|
|
|
|
|
libjuci::ApiServiceProvider::menu_->keybindings_.action_group_menu() |
|
|
|
|
->add(Gtk::Action::create("PluginAddSnippet", |
|
|
|
|
"Add snippet"), |
|
|
|
|
Gtk::AccelKey("<control><alt>space"), |
|
|
|
|
[]() { |
|
|
|
|
std::cout << "ctrl alt space" << std::endl; |
|
|
|
|
libjuci::LoadPlugin("juci_api_test"); |
|
|
|
|
}); |
|
|
|
|
std::cout << "addkeybinding" << std::endl; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///////////////////////
|
|
|
|
|
//// Api to python ////
|
|
|
|
|
///////////////////////
|
|
|
|
|
void libjuci::ReplaceWord(const std::string word_) { |
|
|
|
|
//TODO implement libjuci::ReplaceWord / change string to iter?
|
|
|
|
|
//some_namespace::controller::replaceWord(word_*);
|
|
|
|
|
std::cout << "unimplemented function: 'api::ReplaceWord()' called" |
|
|
|
|
<< std::endl; |
|
|
|
|
//std::cout << "unimplemented function: 'libjuci::ReplaceWord()' called"
|
|
|
|
|
// << std::endl;
|
|
|
|
|
|
|
|
|
|
std::cout << "The string: " << g_test_string << std::endl; |
|
|
|
|
} |
|
|
|
|
//libjuci::ApiServiceProvider::ReplaceWord(word);
|
|
|
|
|
|
|
|
|
|
void cpp::ReplaceLine(const std::string line) { |
|
|
|
|
//TODO implement api::ReplaceLine / change string to iter?
|
|
|
|
|
std::cout << "The string: " << word_ << std::endl; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void libjuci::ReplaceLine(const std::string line) { |
|
|
|
|
//TODO implement libjuci::ReplaceLine / change string to iter?
|
|
|
|
|
//some_namespace::controller::replaceLine(line_);
|
|
|
|
|
std::cout << "unimplemented function: 'api::ReplaceLine()' called" |
|
|
|
|
std::cout << "unimplemented function: 'libjuci::ReplaceLine()' called" |
|
|
|
|
<< std::endl; |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
//////////////////////////////
|
|
|
|
|
//// Boost.Python methods ////
|
|
|
|
|
//////////////////////////////
|
|
|
|
|
|
|
|
|
|
//helpers
|
|
|
|
|
boost::python::api::object py::openPythonScript(const std::string path, |
|
|
|
|
boost::python::api::object libjuci::openPythonScript(const std::string path, |
|
|
|
|
boost::python::api::object python_name_space) { |
|
|
|
|
std::string temp = g_project_root + path + ".py"; |
|
|
|
|
boost::python::str the_path(temp); |
|
|
|
|
return boost::python::exec_file(the_path, python_name_space);//, python_name_space);
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void py::LoadPlugin(const std::string& plugin_name) { |
|
|
|
|
void libjuci::LoadPlugin(const std::string& plugin_name) { |
|
|
|
|
try{ |
|
|
|
|
/* initialize python interpreter */ |
|
|
|
|
Py_Initialize(); |
|
|
|
|
@ -43,5 +76,5 @@ namespace juci_api{
|
|
|
|
|
}catch(boost::python::error_already_set const&) { |
|
|
|
|
PyErr_Print(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|