This repository was archived by the owner on Jun 25, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-13
lines changed
Expand file tree Collapse file tree 2 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,19 @@ int Notebook::size() {
6363 return get_n_pages ();
6464}
6565
66- Source::View* Notebook::get_view (int page) {
67- return source_views.at (get_index (page));
66+ Source::View* Notebook::get_view (int page){
67+ size_t index=get_index (page);
68+ if (index!=static_cast <size_t >(-1 ))
69+ return source_views[index];
70+ else
71+ return nullptr ;
6872}
6973
70- size_t Notebook::get_index (int page) {
71- for (size_t c=0 ;c<hboxes.size ();c++) {
72- if (page_num (*hboxes.at (c))==page)
74+ size_t Notebook::get_index (int page){
75+ if (page==-1 )
76+ return -1 ;
77+ for (size_t c=0 ;c<hboxes.size ();c++){
78+ if (page_num (*hboxes[c])==page)
7379 return c;
7480 }
7581 return -1 ;
Original file line number Diff line number Diff line change @@ -24,23 +24,18 @@ PythonInterpreter::PythonInterpreter(){
2424 return api.ptr ();
2525 };
2626 PyImport_AppendInittab (" jucipp" , init_juci_api);
27- Py_Initialize ();
2827 Config::get ().load ();
29-
3028 auto plugin_path=Config::get ().python .plugin_directory ;
3129 add_path (Config::get ().python .site_packages );
3230 add_path (plugin_path);
33-
31+ Py_Initialize ();
3432 boost::filesystem::directory_iterator end_it;
3533 for (boost::filesystem::directory_iterator it (plugin_path);it!=end_it;it++){
3634 auto module_name=it->path ().stem ().string ();
3735 if (module_name!=" __pycache__" ){
3836 auto module =import (module_name);
39- if (!module ){
40- auto err=PythonError ();
41- if (err)
42- std::cerr << std::string (err) << std::endl;
43- }
37+ if (!module )
38+ std::cerr << std::string (PythonError ()) << std::endl;
4439 }
4540 }
4641}
You can’t perform that action at this time.
0 commit comments