From 12fee35d782072af7c5727e033fa45f7501d8d05 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 30 Jul 2023 13:32:46 -0400 Subject: [PATCH] fix bugs and typos --- tools/lammps-gui/CMakeLists.txt | 11 ++++++----- tools/lammps-gui/codeeditor.cpp | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt index 4cc20d820c..8d1958a66b 100644 --- a/tools/lammps-gui/CMakeLists.txt +++ b/tools/lammps-gui/CMakeLists.txt @@ -135,7 +135,7 @@ if(APPLE) ) # additional steps to populate the bundle tree and create the .dmg image file set(APP_CONTENTS ${CMAKE_BINARY_DIR}/lammps-gui.app/Contents) - set_custom_target(complete-bundle ALL + add_custom_target(complete-bundle ALL ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/bin COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lmp ${APP_CONTENTS}/bin/ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/msi2lmp ${APP_CONTENTS}/bin/ @@ -145,12 +145,13 @@ if(APPLE) COMMAND ${CMAKE_COMMAND} -E create_symlink ../MacOS/lammps-gui ${APP_CONTENTS}/bin/lammps-gui COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/Resources COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/README.macos ${APP_CONTENTS}/Resources/README.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/lammps.icns ${APP_CONTENTS}/Resources COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/LAMMPS_DMG_Background.png ${APP_CONTENTS}/Resources COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps/man/man1 - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${LAMMPS_DIR}/potentials ${APP_CONTENTS}/share/lammps/ - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${LAMMPS_DIR}/bench ${APP_CONTENTS}/share/lammps/ - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${LAMMPS_DIR}/tools/msi2lmp/frc_files ${APP_CONTENTS}/share/lammps/ + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/potentials ${APP_CONTENTS}/share/lammps/potentials + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/bench ${APP_CONTENTS}/share/lammps/bench + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/tools/msi2lmp/frc_files ${APP_CONTENTS}/share/lammps/frc_files COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/ COMMAND ${CMAKE_COMMAND} -E create_symlink lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/lmp.1 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/msi2lmp.1 ${APP_CONTENTS}/share/lammps/man/man1 @@ -158,7 +159,7 @@ if(APPLE) COMMENT "Copying additional files into macOS app bundle tree" WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) - set_custom_target(build-dmg ALL + add_custom_target(build-dmg ALL COMMAND ${LAMMPS_DIR}/cmake/packaging/build-macos-dmg-with-gui.sh DEPENDS complete-bundle COMMENT "Create Drag-n-Drop installer disk image from app bundle" diff --git a/tools/lammps-gui/codeeditor.cpp b/tools/lammps-gui/codeeditor.cpp index adac225298..827a6bb7d3 100644 --- a/tools/lammps-gui/codeeditor.cpp +++ b/tools/lammps-gui/codeeditor.cpp @@ -72,8 +72,8 @@ bool CodeEditor::canInsertFromMimeData(const QMimeData *source) const void CodeEditor::dropEvent(QDropEvent *event) { - event->acceptProposedAction(); if (event->mimeData()->hasUrls()) { + event->accept(); auto file = event->mimeData()->urls()[0].url().remove("file://"); auto gui = dynamic_cast(parent()); if (gui) { @@ -81,10 +81,10 @@ void CodeEditor::dropEvent(QDropEvent *event) gui->open_file(file); } } else if (event->mimeData()->hasText()) { + event->accept(); fprintf(stderr, "Drag - Drop for text block not yet implemented: text=%s\n", event->mimeData()->text().toStdString().c_str()); - } - QPlainTextEdit::dropEvent(event); + } else event->ignore(); } void CodeEditor::resizeEvent(QResizeEvent *e)