summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-09-17 13:05:29 -0700
committeryum <yum.food.vr@gmail.com>2023-09-17 13:05:29 -0700
commitb037e158065bec98d91231c0c6443b63f45ec7ea (patch)
treec5c91a0d7eadcb402877b16ca131c27649b335e4
parentd4c85f4ac4cb627e2611359d18615d76eda29c90 (diff)
Add UI for process priority
Default is normal prio.
-rw-r--r--GUI/GUI/GUI/Config.cpp3
-rw-r--r--GUI/GUI/GUI/Config.h1
-rw-r--r--GUI/GUI/GUI/Frame.cpp62
-rw-r--r--GUI/GUI/GUI/Frame.h1
-rw-r--r--GUI/GUI/GUI/PythonWrapper.cpp78
-rw-r--r--GUI/GUI/GUI/PythonWrapper.h21
6 files changed, 118 insertions, 48 deletions
diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp
index 53e292c..573238f 100644
--- a/GUI/GUI/GUI/Config.cpp
+++ b/GUI/GUI/GUI/Config.cpp
@@ -68,6 +68,7 @@ AppConfig::AppConfig(wxTextCtrl* out)
model("base.en"),
model_translation("nllb-200-distilled-600M"),
button("left joystick"),
+ prio("normal"),
enable_local_beep(true),
enable_browser_src(false),
@@ -114,6 +115,7 @@ bool AppConfig::Serialize(const std::filesystem::path& path) {
cm.Set("model", model);
cm.Set("model_translation", model_translation);
cm.Set("button", button);
+ cm.Set("prio", prio);
cm.Set("enable_local_beep", enable_local_beep);
cm.Set("enable_browser_src", enable_browser_src);
@@ -173,6 +175,7 @@ bool AppConfig::Deserialize(const std::filesystem::path& path) {
cm.Get("model", c.model);
cm.Get("model_translation", c.model_translation);
cm.Get("button", c.button);
+ cm.Get("prio", c.prio);
cm.Get("enable_local_beep", c.enable_local_beep);
cm.Get("enable_browser_src", c.enable_browser_src);
diff --git a/GUI/GUI/GUI/Config.h b/GUI/GUI/GUI/Config.h
index bcbc2dc..ede21d6 100644
--- a/GUI/GUI/GUI/Config.h
+++ b/GUI/GUI/GUI/Config.h
@@ -54,6 +54,7 @@ public:
std::string model;
std::string model_translation;
std::string button;
+ std::string prio;
bool enable_local_beep;
bool enable_browser_src;
diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp
index 0d30809..30ccbde 100644
--- a/GUI/GUI/GUI/Frame.cpp
+++ b/GUI/GUI/GUI/Frame.cpp
@@ -58,6 +58,7 @@ namespace {
ID_PY_APP_CHARS_PER_SYNC,
ID_PY_APP_BYTES_PER_CHAR,
ID_PY_APP_BUTTON,
+ ID_PY_APP_PRIO,
ID_PY_APP_MODEL_PANEL,
ID_PY_APP_ENABLE_LOCAL_BEEP,
ID_PY_APP_ENABLE_BROWSER_SRC,
@@ -517,6 +518,17 @@ namespace {
const size_t kNumButtons = sizeof(kButton) / sizeof(kButton[0]);
constexpr int kButtonDefault = 0;
+ const wxString kPrio[] = {
+ "idle",
+ "below normal",
+ "normal",
+ "above normal",
+ "high",
+ "realtime",
+ };
+ const size_t kNumPrios = sizeof(kPrio) / sizeof(kPrio[0]);
+ constexpr int kPrioDefault = 0;
+
const wxString kDecodeMethods[] = {
"greedy",
"beam",
@@ -733,6 +745,13 @@ Frame::Frame()
"for anything else!");
py_app_button_ = py_app_button;
+ auto* py_app_prio = new wxChoice(py_app_config_panel_pairs,
+ ID_PY_APP_PRIO, wxDefaultPosition,
+ wxDefaultSize, kNumPrios, kPrio);
+ py_app_prio->SetToolTip(
+ "The priority level at which the transcription process runs.");
+ py_app_prio_ = py_app_prio;
+
auto* py_app_rows = new wxTextCtrl(py_app_config_panel_pairs,
ID_PY_APP_ROWS, std::to_string(app_c_->rows),
wxDefaultPosition, wxDefaultSize, /*style=*/0);
@@ -852,6 +871,11 @@ Frame::Frame()
/*flags=*/wxEXPAND);
sizer->Add(new wxStaticText(py_app_config_panel_pairs,
+ wxID_ANY, /*label=*/"Process priority:"));
+ sizer->Add(py_app_prio, /*proportion=*/0,
+ /*flags=*/wxEXPAND);
+
+ sizer->Add(new wxStaticText(py_app_config_panel_pairs,
wxID_ANY, /*label=*/"Desktop keybind:"));
sizer->Add(py_app_keybind, /*proportion=*/0,
/*flags=*/wxEXPAND);
@@ -1572,6 +1596,11 @@ void Frame::ApplyConfigToInputFields()
kNumButtons, app_c_->button, kButtonDefault);
py_app_button->SetSelection(button_idx);
+ auto* py_app_prio = static_cast<wxChoice*>(FindWindowById(ID_PY_APP_PRIO));
+ int prio_idx = GetDropdownChoiceIndex(kPrio,
+ kNumPrios, app_c_->prio, kPrioDefault);
+ py_app_prio->SetSelection(prio_idx);
+
auto* py_app_desktop_keybind = static_cast<wxTextCtrl*>(FindWindowById(ID_PY_APP_KEYBIND));
py_app_desktop_keybind->Clear();
py_app_desktop_keybind->AppendText(app_c_->keybind);
@@ -1785,11 +1814,12 @@ void Frame::EnsureVirtualEnv(bool block, bool force)
Log(transcribe_out_, "{}", out);
Log(transcribe_out_, "{}", err);
};
- if (!PythonWrapper::InvokeWithArgs({
- "-u", // Unbuffered output
- "-m pip",
- "install",
- "-r Resources/Scripts/requirements_frozen.txt",
+ if (!PythonWrapper::InvokeWithArgs(*app_c_,
+ {
+ "-u", // Unbuffered output
+ "-m pip",
+ "install",
+ "-r Resources/Scripts/requirements_frozen.txt",
}, std::move(out_cb))) {
Log(transcribe_out_, "Failed to launch environment setup thread!\n");
return false;
@@ -2053,13 +2083,13 @@ void Frame::OnUnityAutoRefreshStop(wxCommandEvent& event) {
void Frame::OnListPip(wxCommandEvent& event)
{
Log(debug_out_, "Listing pip packages... ");
- PythonWrapper::InvokeWithArgs({
+ PythonWrapper::InvokeWithArgs(*app_c_, {
"-m pip",
"list",
}, "Failed to list pip packages", debug_out_);
Log(debug_out_, "Listing pip cache... ");
- PythonWrapper::InvokeWithArgs({
+ PythonWrapper::InvokeWithArgs(*app_c_, {
"-m pip",
"cache",
"list",
@@ -2069,7 +2099,7 @@ void Frame::OnListPip(wxCommandEvent& event)
void Frame::OnClearPip(wxCommandEvent& event)
{
Log(debug_out_, "Clearing pip cache... ");
- PythonWrapper::InvokeWithArgs({
+ PythonWrapper::InvokeWithArgs(*app_c_, {
"-m pip",
"cache",
"purge",
@@ -2103,7 +2133,7 @@ void Frame::OnResetVenv(wxCommandEvent& event)
};
auto in_cb = [&](std::string& in) {};
Log(debug_out_, "Freezing packages...\n");
- if (!PythonWrapper::InvokeWithArgs({ "-m pip freeze" }, out_cb, in_cb)) {
+ if (!PythonWrapper::InvokeWithArgs(*app_c_, { "-m pip freeze" }, out_cb, in_cb)) {
Log(debug_out_, "failed!\n");
return;
}
@@ -2132,7 +2162,7 @@ void Frame::OnResetVenv(wxCommandEvent& event)
};
auto in_cb = [&](std::string& in) {};
Log(debug_out_, "Uninstalling packages...\n");
- if (!PythonWrapper::InvokeWithArgs({ "-m pip uninstall -y -r venv_pkgs.txt" }, out_cb, in_cb)) {
+ if (!PythonWrapper::InvokeWithArgs(*app_c_, { "-m pip uninstall -y -r venv_pkgs.txt" }, out_cb, in_cb)) {
Log(debug_out_, "failed!\n");
return;
}
@@ -2347,7 +2377,11 @@ void Frame::OnAppStart(wxCommandEvent& event) {
}
int button_idx = py_app_button_->GetSelection();
if (button_idx == wxNOT_FOUND) {
- button_idx = kBytesDefault;
+ button_idx = kButtonDefault;
+ }
+ int prio_idx = py_app_prio_->GetSelection();
+ if (prio_idx == wxNOT_FOUND) {
+ prio_idx = kPrioDefault;
}
const bool enable_local_beep = py_app_enable_local_beep_->GetValue();
@@ -2384,6 +2418,7 @@ void Frame::OnAppStart(wxCommandEvent& event) {
app_c_->chars_per_sync = chars_per_sync;
app_c_->bytes_per_char = bytes_per_char;
app_c_->button = kButton[button_idx].ToStdString();
+ app_c_->prio = kPrio[prio_idx].ToStdString();
app_c_->rows = rows;
app_c_->cols = cols;
app_c_->enable_local_beep = enable_local_beep;
@@ -2466,8 +2501,9 @@ void Frame::OnAppStart(wxCommandEvent& event) {
return true;
});
const std::string config_path(AppConfig::kConfigPath);
- py_app_ = std::move(PythonWrapper::StartApp(config_path, transcribe_out_,
- std::move(out_cb), std::move(in_cb), std::move(run_cb),
+ py_app_ = std::move(PythonWrapper::StartApp(*app_c_,
+ config_path, transcribe_out_,
+ std::move(out_cb), std::move(in_cb), std::move(run_cb),
std::move(prestart_cb)));
Log(transcribe_out_, "py app valid: {}\n", py_app_.valid());
}
diff --git a/GUI/GUI/GUI/Frame.h b/GUI/GUI/GUI/Frame.h
index 31ec375..468a650 100644
--- a/GUI/GUI/GUI/Frame.h
+++ b/GUI/GUI/GUI/Frame.h
@@ -62,6 +62,7 @@ private:
wxChoice* py_app_chars_per_sync_;
wxChoice* py_app_bytes_per_char_;
wxChoice* py_app_button_;
+ wxChoice* py_app_prio_;
wxChoice* unity_chars_per_sync_;
wxChoice* unity_bytes_per_char_;
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp
index d551965..765a283 100644
--- a/GUI/GUI/GUI/PythonWrapper.cpp
+++ b/GUI/GUI/GUI/PythonWrapper.cpp
@@ -98,7 +98,9 @@ std::string DrainWin32Pipe(const HANDLE pipe) {
return oss.str();
}
-bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd,
+bool PythonWrapper::InvokeCommandWithArgs(
+ const AppConfig& app_c,
+ const std::string& cmd,
std::vector<std::string>&& args,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
const std::function<void(std::string& in)>&& in_cb,
@@ -281,17 +283,21 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd,
CloseHandle(pi.hThread);
});
- // Set spawned process priority to low, to avoid lagging things like OBS.
- // TODO(yum) make a toggle for this.
-#if 0
- if (!SetPriorityClass(pi.hProcess, BELOW_NORMAL_PRIORITY_CLASS)) {
+ std::map<std::string, int> prio_stoi = {
+ {"above normal", ABOVE_NORMAL_PRIORITY_CLASS},
+ {"below normal", BELOW_NORMAL_PRIORITY_CLASS},
+ {"normal", NORMAL_PRIORITY_CLASS},
+ {"idle", IDLE_PRIORITY_CLASS},
+ {"high", HIGH_PRIORITY_CLASS},
+ {"realtime", REALTIME_PRIORITY_CLASS},
+ };
+ if (!SetPriorityClass(pi.hProcess, prio_stoi[app_c.prio])) {
std::ostringstream err_oss;
err_oss << "Error while executing python command \"" << cmd_oss.str()
<< "\": Failed to reduce priority class: " << GetWin32ErrMsg();
out_cb("", err_oss.str());
return false;
}
-#endif
// While the process is running, drain output and send input every 10 ms.
DWORD timeout_ms = 10;
@@ -356,6 +362,7 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd,
}
bool PythonWrapper::InvokeCommandWithArgs(
+ const AppConfig& app_c,
const std::string& cmd,
std::vector<std::string>&& args,
std::string* py_stdout, std::string* py_stderr) {
@@ -365,7 +372,7 @@ bool PythonWrapper::InvokeCommandWithArgs(
out_oss << out;
err_oss << err;
};
- bool ret = InvokeCommandWithArgs(cmd, std::move(args), std::move(out_cb));
+ bool ret = InvokeCommandWithArgs(app_c, cmd, std::move(args), std::move(out_cb));
if (py_stderr) {
*py_stderr = err_oss.str();
}
@@ -373,17 +380,21 @@ bool PythonWrapper::InvokeCommandWithArgs(
return ret;
}
-bool PythonWrapper::InvokeWithArgs(std::vector<std::string>&& args,
+bool PythonWrapper::InvokeWithArgs(
+ const AppConfig& app_c,
+ std::vector<std::string>&& args,
std::string* py_stdout, std::string* py_stderr) {
- return InvokeCommandWithArgs("Resources/Python/python.exe",
+ return InvokeCommandWithArgs(app_c, "Resources/Python/python.exe",
std::move(args), py_stdout, py_stderr);
}
-bool PythonWrapper::InvokeWithArgs(std::vector<std::string>&& args,
+bool PythonWrapper::InvokeWithArgs(
+ const AppConfig& app_c,
+ std::vector<std::string>&& args,
const std::string&& err_msg,
wxTextCtrl* const out) {
std::string py_stdout, py_stderr;
- if (InvokeWithArgs(std::move(args), &py_stdout, &py_stderr)) {
+ if (InvokeWithArgs(app_c, std::move(args), &py_stdout, &py_stderr)) {
Log(out, "success!\n");
Log(out, py_stdout.c_str());
if (!py_stdout.empty()) {
@@ -402,18 +413,21 @@ bool PythonWrapper::InvokeWithArgs(std::vector<std::string>&& args,
}
}
-bool PythonWrapper::InvokeWithArgs(std::vector<std::string>&& args,
+bool PythonWrapper::InvokeWithArgs(
+ const AppConfig& app_c,
+ std::vector<std::string>&& args,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
const std::function<void(std::string& in)>&& in_cb,
const std::function<bool()>&& run_cb) {
- return InvokeCommandWithArgs("Resources/Python/python.exe",
+ return InvokeCommandWithArgs(app_c,
+ "Resources/Python/python.exe",
std::move(args), std::move(out_cb), std::move(in_cb), std::move(run_cb));
}
std::string PythonWrapper::GetVersion() {
std::string py_stdout, py_stderr;
- bool ok = InvokeWithArgs({ "--version" }, &py_stdout, &py_stderr);
+ bool ok = InvokeWithArgs(AppConfig(nullptr), { "--version" }, &py_stdout, &py_stderr);
if (!ok) {
wxLogError("Failed to get python version: %s", py_stderr.c_str());
}
@@ -423,7 +437,7 @@ std::string PythonWrapper::GetVersion() {
std::string PythonWrapper::DumpMics() {
std::string py_stdout, py_stderr;
const std::string dump_mics_path = "Resources/Scripts/dump_mic_devices.py";
- bool ok = InvokeWithArgs({ dump_mics_path }, &py_stdout, &py_stderr);
+ bool ok = InvokeWithArgs(AppConfig(nullptr), { dump_mics_path }, &py_stdout, &py_stderr);
if (!ok) {
wxLogError("Failed to dump mic devices: %s", py_stderr.c_str());
}
@@ -455,7 +469,7 @@ bool PythonWrapper::InstallPip(
}
std::string pip_path = "Resources/Python/get-pip.py";
- if (!InvokeWithArgs({ pip_path }, std::move(out_cb), std::move(in_cb),
+ if (!InvokeWithArgs(AppConfig(nullptr), { pip_path }, std::move(out_cb), std::move(in_cb),
std::move(run_cb))) {
return false;
}
@@ -468,6 +482,7 @@ bool PythonWrapper::InstallPip(
}
std::future<bool> PythonWrapper::StartApp(
+ const AppConfig& app_c,
const std::string& config_path,
wxTextCtrl *out,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
@@ -477,6 +492,7 @@ std::future<bool> PythonWrapper::StartApp(
return std::move(std::async(std::launch::async,
[](
+ const AppConfig app_c,
const std::string config_path,
wxTextCtrl *out,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
@@ -487,7 +503,9 @@ std::future<bool> PythonWrapper::StartApp(
Log(out, "DEBUG::{}:: config_path: {}\n", __func__, config_path);
- return InvokeWithArgs({
+ return InvokeWithArgs(
+ app_c,
+ {
"-u", // Unbuffered output
"Resources/Scripts/transcribe_v2.py",
"--config", config_path,
@@ -495,7 +513,7 @@ std::future<bool> PythonWrapper::StartApp(
std::move(out_cb),
std::move(in_cb),
std::move(run_cb));
- }, config_path, out, std::move(out_cb), std::move(in_cb),
+ }, app_c, config_path, out, std::move(out_cb), std::move(in_cb),
std::move(run_cb), std::move(prestart_cb)));
}
@@ -554,7 +572,7 @@ bool PythonWrapper::GenerateAnimator(
const int texture_cols = (config.bytes_per_char == 1 ? 16 : 128);
{
Log(out, "Generating shader for {}x{} board (pass 0)...", config.rows, config.cols);
- if (!InvokeWithArgs({ generate_shader_path,
+ if (!InvokeWithArgs(AppConfig(nullptr), { generate_shader_path,
"--bytes_per_char", std::to_string(config.bytes_per_char),
"--board_rows", std::to_string(config.rows),
"--board_cols", std::to_string(config.cols),
@@ -570,7 +588,7 @@ bool PythonWrapper::GenerateAnimator(
Log(out, "Generating shader for {}x{} board (pass 1)...", config.rows, config.cols);
std::string py_stdout, py_stderr;
- if (!InvokeWithArgs({ generate_shader_path,
+ if (!InvokeWithArgs(AppConfig(nullptr), { generate_shader_path,
"--bytes_per_char", std::to_string(config.bytes_per_char),
"--board_rows", std::to_string(config.rows),
"--board_cols", std::to_string(config.cols),
@@ -587,7 +605,7 @@ bool PythonWrapper::GenerateAnimator(
Log(out, "Generating emotes... ");
std::string py_stdout, py_stderr;
- if (InvokeWithArgs({ generate_emotes_path,
+ if (InvokeWithArgs(AppConfig(nullptr), { generate_emotes_path,
"Resources/Fonts/Emotes/",
/*board_aspect_ratio=*/ std::to_string(6),
/*texture_aspect_ratio=*/ std::to_string(2),
@@ -649,7 +667,7 @@ bool PythonWrapper::GenerateAnimator(
std::string prefab_path = (std::filesystem::path(tastt_assets_path) / "World Constraint.prefab").string();
Log(out, "Remove audio sources from prefab at {}\n", prefab_path);
Log(out, "Removing audio sources from prefab... ");
- if (!InvokeWithArgs({ remove_audio_srcs_path,
+ if (!InvokeWithArgs(AppConfig(nullptr), { remove_audio_srcs_path,
"--prefab", Quote(prefab_path)
},
"Failed to remove audio sources", out)) {
@@ -766,7 +784,7 @@ bool PythonWrapper::GenerateAnimator(
Log(out, "Entry get {}\n", entry.path().string());
Log(out, "Setting size to {}\n", config.texture_sz);
if (entry.is_regular_file() && entry.path().extension() == ".meta") {
- if (!InvokeWithArgs({ set_texture_sz_path,
+ if (!InvokeWithArgs(AppConfig(nullptr), { set_texture_sz_path,
"--meta", Quote(entry.path().string()),
"--size", std::to_string(config.texture_sz)},
"Failed to set texture size", out)) {
@@ -778,7 +796,7 @@ bool PythonWrapper::GenerateAnimator(
}
{
Log(out, "Generating guid.map... ");
- if (!InvokeWithArgs({ libunity_path, "guid_map",
+ if (!InvokeWithArgs(AppConfig(nullptr), { libunity_path, "guid_map",
"--project_root", Quote(config.assets_path),
"--save_to", Quote(guid_map_path), },
"Failed to generate guid.map", out)) {
@@ -787,7 +805,7 @@ bool PythonWrapper::GenerateAnimator(
}
{
Log(out, "Generating animations... ");
- if (!InvokeWithArgs({ libtastt_path, "gen_anims",
+ if (!InvokeWithArgs(AppConfig(nullptr), { libtastt_path, "gen_anims",
"--gen_anim_dir", Quote(tastt_animations_path),
"--guid_map", Quote(guid_map_path),
"--config", Quote(config_path) },
@@ -797,7 +815,7 @@ bool PythonWrapper::GenerateAnimator(
}
{
Log(out, "Generating FX layer... ");
- if (!InvokeWithArgs({ libtastt_path, "gen_fx",
+ if (!InvokeWithArgs(AppConfig(nullptr), { libtastt_path, "gen_fx",
"--fx_dest", Quote(tastt_fx0_path),
"--gen_anim_dir", Quote(tastt_animations_path),
"--guid_map", Quote(guid_map_path),
@@ -808,7 +826,7 @@ bool PythonWrapper::GenerateAnimator(
}
{
Log(out, "Merging with user animator... ");
- if (!InvokeWithArgs({ libunity_path, "merge",
+ if (!InvokeWithArgs(AppConfig(nullptr), { libunity_path, "merge",
"--fx0", Quote(config.fx_path),
"--fx1", Quote(tastt_fx0_path),
"--fx_dest", Quote(tastt_fx1_path), },
@@ -818,7 +836,7 @@ bool PythonWrapper::GenerateAnimator(
}
{
Log(out, "Setting noop animations... ");
- if (!InvokeWithArgs({ libunity_path, "set_noop_anim",
+ if (!InvokeWithArgs(AppConfig(nullptr), { libunity_path, "set_noop_anim",
"--fx0", Quote(tastt_fx1_path),
"--fx_dest", Quote(tastt_animator_path),
"--gen_anim_dir", Quote(tastt_animations_path),
@@ -829,7 +847,7 @@ bool PythonWrapper::GenerateAnimator(
}
{
Log(out, "Generating avatar parameters... ");
- if (!InvokeWithArgs({ generate_params_path,
+ if (!InvokeWithArgs(AppConfig(nullptr), { generate_params_path,
"--old_params", Quote(config.params_path),
"--new_params", Quote(tastt_params_path),
"--config", Quote(config_path) },
@@ -839,7 +857,7 @@ bool PythonWrapper::GenerateAnimator(
}
{
Log(out, "Generating avatar menu... ");
- if (!InvokeWithArgs({ generate_menu_path,
+ if (!InvokeWithArgs(AppConfig(nullptr), { generate_menu_path,
"--old_menu", Quote(config.menu_path),
"--new_menu", Quote(tastt_menu_path) },
"Failed to generate avatar menu", out)) {
diff --git a/GUI/GUI/GUI/PythonWrapper.h b/GUI/GUI/GUI/PythonWrapper.h
index 0f370a2..31c571e 100644
--- a/GUI/GUI/GUI/PythonWrapper.h
+++ b/GUI/GUI/GUI/PythonWrapper.h
@@ -28,14 +28,18 @@ namespace PythonWrapper
// Invoke a command on the shell with arguments.
// On error, sets `out` to an error message and returns false.
- bool InvokeCommandWithArgs(const std::string& cmd,
+ bool InvokeCommandWithArgs(
+ const AppConfig& app_c,
+ const std::string& cmd,
std::vector<std::string>&& args,
std::string* py_stdout,
std::string* py_stderr = NULL);
// Invoke a command on the shell with arguments.
// On error, sets `out` to an error message and returns false.
- bool InvokeCommandWithArgs(const std::string& cmd,
+ bool InvokeCommandWithArgs(
+ const AppConfig& app_c,
+ const std::string& cmd,
std::vector<std::string>&& args,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
const std::function<void(std::string& in)>&& in_cb = [](std::string&) {},
@@ -43,13 +47,19 @@ namespace PythonWrapper
// Invoke the interpreter with arguments.
// On error, sets `out` to an error message and returns false.
- bool InvokeWithArgs(std::vector<std::string>&& args, std::string* py_stdout,
+ bool InvokeWithArgs(
+ const AppConfig& app_c,
+ std::vector<std::string>&& args, std::string* py_stdout,
std::string* py_stderr = NULL);
- bool InvokeWithArgs(std::vector<std::string>&& args,
+ bool InvokeWithArgs(
+ const AppConfig& app_c,
+ std::vector<std::string>&& args,
const std::string&& err_msg, wxTextCtrl* out);
- bool InvokeWithArgs(std::vector<std::string>&& args,
+ bool InvokeWithArgs(
+ const AppConfig& app_c,
+ std::vector<std::string>&& args,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
const std::function<void(std::string& in)>&& in_cb = [](std::string&) {},
const std::function<bool()>&& run_cb = []() { return true; });
@@ -72,6 +82,7 @@ namespace PythonWrapper
// parameters. We could persist those files so settings would persist across
// app restarts.
std::future<bool> StartApp(
+ const AppConfig& app_c,
const std::string& config_path,
wxTextCtrl *out,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,