Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit a02a014

Browse files
committed
now able to grab file path from api
1 parent b6665d3 commit a02a014

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/python_interpreter.cc

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,24 @@ Python::Interpreter::Interpreter(){
2525
auto init_juci_api=[](){
2626
pybind11::module(pygobject_init(-1,-1,-1),false);
2727
pybind11::module api("jucpp","Python bindings for juCi++");
28-
api.def("get_juci_home",[](){return Config::get().juci_home_path().string();})
29-
.def("get_plugin_folder",[](){return Config::get().python.plugin_directory;})
30-
.def("get_current_gtk_source_view",[](){
31-
auto view=Notebook::get().get_current_view();
32-
if(view)
33-
return pyobject_from_gobj(view->gobj());
34-
return pybind11::module(Py_None,false);
35-
})
28+
api
29+
.def("get_juci_home",[](){return Config::get().juci_home_path().string();})
30+
.def("get_plugin_folder",[](){return Config::get().python.plugin_directory;});
31+
api
32+
.def_submodule("editor")
33+
.def("get_current_gtk_source_view",[](){
34+
auto view=Notebook::get().get_current_view();
35+
if(view)
36+
return pyobject_from_gobj(view->gobj());
37+
return pybind11::module(Py_None,false);
38+
})
39+
.def("get_file_path",[](){
40+
auto view=Notebook::get().get_current_view();
41+
if(view)
42+
return view->file_path.string();
43+
return std::string();
44+
});
45+
api
3646
.def("get_gio_plugin_menu",[](){
3747
auto &plugin_menu=Menu::get().plugin_menu;
3848
if(!plugin_menu){

0 commit comments

Comments
 (0)