Skip to content

Commit

Permalink
Improve layout of Python command palette
Browse files Browse the repository at this point in the history
  • Loading branch information
sthenic committed May 29, 2024
1 parent 6dd930b commit 2c00616
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,17 +1203,25 @@ void Ui::RenderDigitizerSelection(const ImVec2 &position, const ImVec2 &size)

void Ui::RenderPythonCommandPalette(bool enable)
{
ImGui::Text("Script Directory");
const auto BUTTON_SIZE = ImVec2(ImGui::CalcTextSize("Copy").x + 2 * ImGui::GetStyle().FramePadding.x, 0);
if (ImGui::Button("Copy", BUTTON_SIZE))
{
ImGui::LogToClipboard();
ImGui::LogText("%s", m_persistent_directories.GetPythonDirectory().c_str());
ImGui::LogFinish();
}
ImGui::SameLine();
ImGui::Text(m_persistent_directories.GetPythonDirectory());

if (!enable)
ImGui::BeginDisabled();

ImGui::Separator();
if (ImGui::Button("Add"))
ImGui::Text("Scripts");
if (ImGui::Button("Add", BUTTON_SIZE))
m_popup_add_python_script = true;

ImGui::Separator();

int i = 0;
for (const auto &path : m_python_files)
{
Expand All @@ -1237,7 +1245,7 @@ void Ui::RenderPythonCommandPalette(bool enable)
/* Context menu for the button. */
if (ImGui::BeginPopupContextItem())
{
if (ImGui::MenuItem("Copy filename"))
if (ImGui::MenuItem("Copy path"))
{
ImGui::LogToClipboard();
ImGui::LogText("%s", path.string().c_str());
Expand Down

0 comments on commit 2c00616

Please sign in to comment.