Browse Source

Can now configure the command used to run python files

merge-requests/382/head
eidheim 8 years ago
parent
commit
8c99e66792
  1. 2
      CMakeLists.txt
  2. 1
      src/config.cc
  3. 1
      src/config.h
  4. 3
      src/files.h
  5. 2
      src/project.cc

2
CMakeLists.txt

@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 2.8.8)
project(juci)
set(JUCI_VERSION "1.4.1")
set(JUCI_VERSION "1.4.1.1")
set(CPACK_PACKAGE_NAME "jucipp")
set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>")

1
src/config.cc

@ -195,6 +195,7 @@ void Config::read(const boost::property_tree::ptree &cfg) {
project.save_on_compile_or_run=cfg.get<bool>("project.save_on_compile_or_run");
project.clear_terminal_on_compile=cfg.get<bool>("project.clear_terminal_on_compile");
project.ctags_command=cfg.get<std::string>("project.ctags_command");
project.python_command=cfg.get<std::string>("project.python_command");
terminal.history_size=cfg.get<int>("terminal.history_size");
terminal.font=cfg.get<std::string>("terminal.font");

1
src/config.h

@ -47,6 +47,7 @@ public:
bool save_on_compile_or_run;
bool clear_terminal_on_compile;
std::string ctags_command;
std::string python_command;
};
class Source {

3
src/files.h

@ -175,7 +175,8 @@ R"RAW(
},
"save_on_compile_or_run": true,
"clear_terminal_on_compile": true,
"ctags_command": "ctags"
"ctags_command": "ctags",
"python_command": "PYTHONUNBUFFERED=1 python"
},
"documentation_searches": {
"clang": {

2
src/project.cc

@ -922,7 +922,7 @@ void Project::Markdown::compile_and_run() {
}
void Project::Python::compile_and_run() {
auto command="PYTHONUNBUFFERED=1 python "+filesystem::escape_argument(filesystem::get_short_path(Notebook::get().get_current_view()->file_path).string());
auto command=Config::get().project.python_command+' '+filesystem::escape_argument(filesystem::get_short_path(Notebook::get().get_current_view()->file_path).string());
Terminal::get().print("Running "+command+"\n");
Terminal::get().async_process(command, Notebook::get().get_current_view()->file_path.parent_path(), [command](int exit_status) {
Terminal::get().async_print(command+" returned: "+std::to_string(exit_status)+'\n');

Loading…
Cancel
Save