aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--gui/basewindow.cc16
-rw-r--r--gui/basewindow.h5
-rw-r--r--gui/ice40/mainwindow.cc6
-rw-r--r--gui/line_editor.cc4
-rw-r--r--gui/line_editor.h4
-rw-r--r--gui/pyconsole.cc5
-rw-r--r--gui/pyconsole.h3
-rw-r--r--gui/pythontab.cc6
-rw-r--r--gui/pythontab.h6
10 files changed, 17 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 78c8b5a2..3ca7935e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,10 @@ find_package(Sanitizers)
# List of Boost libraries to include
set(boost_libs filesystem thread program_options)
+if (BUILD_GUI AND NOT BUILD_PYTHON)
+ message(FATAL_ERROR "GUI requires Python to build")
+endif()
+
if (BUILD_PYTHON)
# TODO: sensible minimum Python version
find_package(PythonInterp 3.5 REQUIRED)
diff --git a/gui/basewindow.cc b/gui/basewindow.cc
index b76527e1..04898410 100644
--- a/gui/basewindow.cc
+++ b/gui/basewindow.cc
@@ -27,10 +27,7 @@
#include "jsonparse.h"
#include "log.h"
#include "mainwindow.h"
-
-#ifndef NO_PYTHON
#include "pythontab.h"
-#endif
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
@@ -74,13 +71,10 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
connect(designview, SIGNAL(info(std::string)), this, SLOT(writeInfo(std::string)));
tabWidget = new QTabWidget();
-#ifndef NO_PYTHON
- PythonTab *pythontab = new PythonTab();
- tabWidget->addTab(pythontab, "Console");
- connect(this, SIGNAL(contextChanged(Context *)), pythontab, SLOT(newContext(Context *)));
-#endif
- info = new InfoTab();
- tabWidget->addTab(info, "Info");
+
+ console = new PythonTab();
+ tabWidget->addTab(console, "Console");
+ connect(this, SIGNAL(contextChanged(Context *)), console, SLOT(newContext(Context *)));
centralTabWidget = new QTabWidget();
FPGAViewWidget *fpgaView = new FPGAViewWidget();
@@ -94,7 +88,7 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
BaseMainWindow::~BaseMainWindow() {}
-void BaseMainWindow::writeInfo(std::string text) { info->info(text); }
+void BaseMainWindow::writeInfo(std::string text) { console->info(text); }
void BaseMainWindow::createMenusAndBars()
{
diff --git a/gui/basewindow.h b/gui/basewindow.h
index d2d0505d..ebbe66f0 100644
--- a/gui/basewindow.h
+++ b/gui/basewindow.h
@@ -20,7 +20,6 @@
#ifndef BASEMAINWINDOW_H
#define BASEMAINWINDOW_H
-#include "infotab.h"
#include "nextpnr.h"
#include <QMainWindow>
@@ -35,6 +34,8 @@ Q_DECLARE_METATYPE(std::string)
NEXTPNR_NAMESPACE_BEGIN
+class PythonTab;
+
class BaseMainWindow : public QMainWindow
{
Q_OBJECT
@@ -62,7 +63,7 @@ class BaseMainWindow : public QMainWindow
std::unique_ptr<Context> ctx;
QTabWidget *tabWidget;
QTabWidget *centralTabWidget;
- InfoTab *info;
+ PythonTab *console;
QMenuBar *menuBar;
QToolBar *mainToolBar;
diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc
index bea5fce7..4ade1f1f 100644
--- a/gui/ice40/mainwindow.cc
+++ b/gui/ice40/mainwindow.cc
@@ -253,7 +253,6 @@ void MainWindow::new_proj()
void MainWindow::load_json(std::string filename, std::string pcf)
{
- tabWidget->setCurrentWidget(info);
preload_pcf = pcf;
disableActions();
Q_EMIT task->loadfile(filename);
@@ -261,8 +260,6 @@ void MainWindow::load_json(std::string filename, std::string pcf)
void MainWindow::load_pcf(std::string filename)
{
- tabWidget->setCurrentWidget(info);
-
disableActions();
Q_EMIT task->loadpcf(filename);
}
@@ -271,15 +268,12 @@ void MainWindow::newContext(Context *ctx)
{
std::string title = "nextpnr-ice40 - " + ctx->getChipName() + " ( " + chipArgs.package + " )";
setWindowTitle(title.c_str());
- info->clearBuffer();
}
void MainWindow::open_proj()
{
QString fileName = QFileDialog::getOpenFileName(this, QString("Open Project"), QString(), QString("*.proj"));
if (!fileName.isEmpty()) {
- tabWidget->setCurrentWidget(info);
-
std::string fn = fileName.toStdString();
disableActions();
}
diff --git a/gui/line_editor.cc b/gui/line_editor.cc
index 3c7ebe94..425f2876 100644
--- a/gui/line_editor.cc
+++ b/gui/line_editor.cc
@@ -18,8 +18,6 @@
*
*/
-#ifndef NO_PYTHON
-
#include "line_editor.h"
#include <QKeyEvent>
#include <QToolTip>
@@ -131,5 +129,3 @@ void LineEditor::autocomplete()
}
NEXTPNR_NAMESPACE_END
-
-#endif // NO_PYTHON
diff --git a/gui/line_editor.h b/gui/line_editor.h
index 5a57129b..a779072f 100644
--- a/gui/line_editor.h
+++ b/gui/line_editor.h
@@ -21,8 +21,6 @@
#ifndef LINE_EDITOR_H
#define LINE_EDITOR_H
-#ifndef NO_PYTHON
-
#include <QLineEdit>
#include <QMenu>
#include "ParseHelper.h"
@@ -59,6 +57,4 @@ class LineEditor : public QLineEdit
NEXTPNR_NAMESPACE_END
-#endif // NO_PYTHON
-
#endif // LINE_EDITOR_H
diff --git a/gui/pyconsole.cc b/gui/pyconsole.cc
index 6da06b7e..0ee393ce 100644
--- a/gui/pyconsole.cc
+++ b/gui/pyconsole.cc
@@ -18,8 +18,6 @@
*
*/
-#ifndef NO_PYTHON
-
#include "pyconsole.h"
#include "pyinterpreter.h"
@@ -68,6 +66,7 @@ void PythonConsole::displayString(QString text)
setTextColor(NORMAL_COLOR);
cursor.insertText(text);
cursor.movePosition(QTextCursor::EndOfLine);
+ moveCursorToEnd();
}
void PythonConsole::moveCursorToEnd()
@@ -78,5 +77,3 @@ void PythonConsole::moveCursorToEnd()
}
NEXTPNR_NAMESPACE_END
-
-#endif // NO_PYTHON
diff --git a/gui/pyconsole.h b/gui/pyconsole.h
index 60f10672..9dbd3b95 100644
--- a/gui/pyconsole.h
+++ b/gui/pyconsole.h
@@ -21,8 +21,6 @@
#ifndef PYCONSOLE_H
#define PYCONSOLE_H
-#ifndef NO_PYTHON
-
#include <QColor>
#include <QMimeData>
#include <QTextEdit>
@@ -53,6 +51,5 @@ class PythonConsole : public QTextEdit, public ParseListener
};
NEXTPNR_NAMESPACE_END
-#endif // NO_PYTHON
#endif // PYCONSOLE_H
diff --git a/gui/pythontab.cc b/gui/pythontab.cc
index 5c349d7c..e761128d 100644
--- a/gui/pythontab.cc
+++ b/gui/pythontab.cc
@@ -16,7 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-#ifndef NO_PYTHON
#include "pythontab.h"
#include <QGridLayout>
@@ -77,7 +76,6 @@ PythonTab::~PythonTab()
void PythonTab::editLineReturnPressed(QString text)
{
console->displayString(prompt + text + "\n");
- console->moveCursorToEnd();
parseHelper.process(text.toStdString());
@@ -114,6 +112,6 @@ void PythonTab::showContextMenu(const QPoint &pt) { contextMenu->exec(mapToGloba
void PythonTab::clearBuffer() { console->clear(); }
-NEXTPNR_NAMESPACE_END
+void PythonTab::info(std::string str) { console->displayString(str.c_str()); }
-#endif // NO_PYTHON
+NEXTPNR_NAMESPACE_END
diff --git a/gui/pythontab.h b/gui/pythontab.h
index 3fd12981..134874b6 100644
--- a/gui/pythontab.h
+++ b/gui/pythontab.h
@@ -20,8 +20,6 @@
#ifndef PYTHONTAB_H
#define PYTHONTAB_H
-#ifndef NO_PYTHON
-
#include <QLineEdit>
#include <QMenu>
#include <QPlainTextEdit>
@@ -42,10 +40,11 @@ class PythonTab : public QWidget
private Q_SLOTS:
void showContextMenu(const QPoint &pt);
- void clearBuffer();
void editLineReturnPressed(QString text);
public Q_SLOTS:
void newContext(Context *ctx);
+ void info(std::string str);
+ void clearBuffer();
private:
PythonConsole *console;
@@ -60,6 +59,5 @@ class PythonTab : public QWidget
};
NEXTPNR_NAMESPACE_END
-#endif // NO_PYTHON
#endif // PYTHONTAB_H