From 6e11c52dc933027ca5131bddf999953d1142edda Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 28 Jun 2018 20:38:25 +0200 Subject: make paste work, fix inserting in wrong lines --- 3rdparty/python-console/modified/pyconsole.cc | 30 ++++++++++++++++++++++++++- 3rdparty/python-console/modified/pyconsole.h | 3 +++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/3rdparty/python-console/modified/pyconsole.cc b/3rdparty/python-console/modified/pyconsole.cc index 35f3e930..186d74d2 100644 --- a/3rdparty/python-console/modified/pyconsole.cc +++ b/3rdparty/python-console/modified/pyconsole.cc @@ -52,7 +52,8 @@ void PythonConsole::keyPressEvent( QKeyEvent* e ) if ( ! canGoLeft( ) ) return; } - + if (!cursorIsOnInputLine()) return; + if (textCursor().columnNumber() < PythonConsole::PROMPT.size()) return; QTextEdit::keyPressEvent( e ); } @@ -292,3 +293,30 @@ void PythonConsole::moveCursorToEnd( ) cursor.movePosition( QTextCursor::End ); setTextCursor( cursor ); } + +void PythonConsole::insertFromMimeData(const QMimeData *src) +{ + if (src->hasText()) { + QStringList list = src->text().split("\n",QString::KeepEmptyParts); + bool lastends = src->text().endsWith("\n"); + for (int i=0;i #include +#include #include "ParseHelper.h" #include "ParseListener.h" @@ -47,6 +48,8 @@ class PythonConsole : public QTextEdit, ParseListener virtual void handleReturnKeyPress(); + virtual void insertFromMimeData(const QMimeData *src); + /** Handle a compilable chunk of Python user input. */ -- cgit v1.2.3 From a4f69fba199a035dc017dbe1a998013e2fce9d64 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 29 Jun 2018 08:18:15 +0200 Subject: fix build without python --- gui/CMakeLists.txt | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 2021b7ea..68fd0229 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -1,18 +1,20 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(PYTHON_CONSOLE_SRC - ../3rdparty/python-console/ColumnFormatter.cpp - ../3rdparty/python-console/ParseHelper.cpp - ../3rdparty/python-console/ParseHelper.BlockParseState.cpp - ../3rdparty/python-console/ParseHelper.BracketParseState.cpp - ../3rdparty/python-console/ParseHelper.ContinuationParseState.cpp - ../3rdparty/python-console/ParseMessage.cpp - - ../3rdparty/python-console/modified/pyredirector.cc - ../3rdparty/python-console/modified/pyinterpreter.cc - ../3rdparty/python-console/modified/pyconsole.cc -) +if (BUILD_PYTHON) + set(PYTHON_CONSOLE_SRC + ../3rdparty/python-console/ColumnFormatter.cpp + ../3rdparty/python-console/ParseHelper.cpp + ../3rdparty/python-console/ParseHelper.BlockParseState.cpp + ../3rdparty/python-console/ParseHelper.BracketParseState.cpp + ../3rdparty/python-console/ParseHelper.ContinuationParseState.cpp + ../3rdparty/python-console/ParseMessage.cpp + + ../3rdparty/python-console/modified/pyredirector.cc + ../3rdparty/python-console/modified/pyinterpreter.cc + ../3rdparty/python-console/modified/pyconsole.cc + ) +endif() aux_source_directory(. GUI_SOURCE_FILES) aux_source_directory(${family}/ GUI_SOURCE_FILES) @@ -25,6 +27,10 @@ set(GUI_LIBRARY_FILES_${ufamily} Qt5::Widgets Qt5::OpenGL ${OPENGL_LIBRARIES} Qt add_library(gui_${family} STATIC ${GUI_SOURCE_FILES} ${PYTHON_CONSOLE_SRC} ${GUI_RESOURCE_FILES}) -target_include_directories(gui_${family} PRIVATE ../${family} ${family} ../3rdparty/QtPropertyBrowser/src ../3rdparty/python-console ../3rdparty/python-console/modified) +target_include_directories(gui_${family} PRIVATE ../${family} ${family} ../3rdparty/QtPropertyBrowser/src) +if (BUILD_PYTHON) + target_include_directories(gui_${family} PRIVATE ../3rdparty/python-console ../3rdparty/python-console/modified) +endif() + target_compile_definitions(gui_${family} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} QT_NO_KEYWORDS) target_link_libraries(gui_${family} Qt5::Widgets) -- cgit v1.2.3