Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
This commit is contained in:
commit
1b5c1b028e
@ -54,6 +54,10 @@ find_package(Sanitizers)
|
|||||||
# List of Boost libraries to include
|
# List of Boost libraries to include
|
||||||
set(boost_libs filesystem thread program_options)
|
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)
|
if (BUILD_PYTHON)
|
||||||
# TODO: sensible minimum Python version
|
# TODO: sensible minimum Python version
|
||||||
find_package(PythonInterp 3.5 REQUIRED)
|
find_package(PythonInterp 3.5 REQUIRED)
|
||||||
|
@ -27,10 +27,7 @@
|
|||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#ifndef NO_PYTHON
|
|
||||||
#include "pythontab.h"
|
#include "pythontab.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
|
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
|
||||||
|
|
||||||
@ -45,7 +42,7 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
|
|||||||
log_files.clear();
|
log_files.clear();
|
||||||
log_streams.clear();
|
log_streams.clear();
|
||||||
|
|
||||||
setObjectName(QStringLiteral("BaseMainWindow"));
|
setObjectName("BaseMainWindow");
|
||||||
resize(1024, 768);
|
resize(1024, 768);
|
||||||
|
|
||||||
createMenusAndBars();
|
createMenusAndBars();
|
||||||
@ -74,19 +71,17 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
|
|||||||
connect(designview, SIGNAL(info(std::string)), this, SLOT(writeInfo(std::string)));
|
connect(designview, SIGNAL(info(std::string)), this, SLOT(writeInfo(std::string)));
|
||||||
|
|
||||||
tabWidget = new QTabWidget();
|
tabWidget = new QTabWidget();
|
||||||
#ifndef NO_PYTHON
|
|
||||||
PythonTab *pythontab = new PythonTab();
|
console = new PythonTab();
|
||||||
tabWidget->addTab(pythontab, "Console");
|
tabWidget->addTab(console, "Console");
|
||||||
connect(this, SIGNAL(contextChanged(Context *)), pythontab, SLOT(newContext(Context *)));
|
connect(this, SIGNAL(contextChanged(Context *)), console, SLOT(newContext(Context *)));
|
||||||
#endif
|
|
||||||
info = new InfoTab();
|
|
||||||
tabWidget->addTab(info, "Info");
|
|
||||||
|
|
||||||
centralTabWidget = new QTabWidget();
|
centralTabWidget = new QTabWidget();
|
||||||
FPGAViewWidget *fpgaView = new FPGAViewWidget();
|
FPGAViewWidget *fpgaView = new FPGAViewWidget();
|
||||||
centralTabWidget->addTab(fpgaView, "Graphics");
|
centralTabWidget->addTab(fpgaView, "Graphics");
|
||||||
|
|
||||||
connect(this, SIGNAL(contextChanged(Context *)), fpgaView, SLOT(newContext(Context *)));
|
connect(this, SIGNAL(contextChanged(Context *)), fpgaView, SLOT(newContext(Context *)));
|
||||||
|
connect(designview, SIGNAL(selected(std::vector<DecalXY>)), fpgaView, SLOT(onSelectedArchItem(std::vector<DecalXY>)));
|
||||||
|
|
||||||
splitter_v->addWidget(centralTabWidget);
|
splitter_v->addWidget(centralTabWidget);
|
||||||
splitter_v->addWidget(tabWidget);
|
splitter_v->addWidget(tabWidget);
|
||||||
@ -94,39 +89,31 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
|
|||||||
|
|
||||||
BaseMainWindow::~BaseMainWindow() {}
|
BaseMainWindow::~BaseMainWindow() {}
|
||||||
|
|
||||||
void BaseMainWindow::writeInfo(std::string text) { info->info(text); }
|
void BaseMainWindow::writeInfo(std::string text) { console->info(text); }
|
||||||
|
|
||||||
void BaseMainWindow::createMenusAndBars()
|
void BaseMainWindow::createMenusAndBars()
|
||||||
{
|
{
|
||||||
actionNew = new QAction("New", this);
|
actionNew = new QAction("New", this);
|
||||||
QIcon iconNew;
|
actionNew->setIcon(QIcon(":/icons/resources/new.png"));
|
||||||
iconNew.addFile(QStringLiteral(":/icons/resources/new.png"));
|
|
||||||
actionNew->setIcon(iconNew);
|
|
||||||
actionNew->setShortcuts(QKeySequence::New);
|
actionNew->setShortcuts(QKeySequence::New);
|
||||||
actionNew->setStatusTip("New project file");
|
actionNew->setStatusTip("New project file");
|
||||||
connect(actionNew, SIGNAL(triggered()), this, SLOT(new_proj()));
|
connect(actionNew, SIGNAL(triggered()), this, SLOT(new_proj()));
|
||||||
|
|
||||||
actionOpen = new QAction("Open", this);
|
actionOpen = new QAction("Open", this);
|
||||||
QIcon iconOpen;
|
actionOpen->setIcon(QIcon(":/icons/resources/open.png"));
|
||||||
iconOpen.addFile(QStringLiteral(":/icons/resources/open.png"));
|
|
||||||
actionOpen->setIcon(iconOpen);
|
|
||||||
actionOpen->setShortcuts(QKeySequence::Open);
|
actionOpen->setShortcuts(QKeySequence::Open);
|
||||||
actionOpen->setStatusTip("Open an existing project file");
|
actionOpen->setStatusTip("Open an existing project file");
|
||||||
connect(actionOpen, SIGNAL(triggered()), this, SLOT(open_proj()));
|
connect(actionOpen, SIGNAL(triggered()), this, SLOT(open_proj()));
|
||||||
|
|
||||||
QAction *actionSave = new QAction("Save", this);
|
QAction *actionSave = new QAction("Save", this);
|
||||||
QIcon iconSave;
|
actionSave->setIcon(QIcon(":/icons/resources/save.png"));
|
||||||
iconSave.addFile(QStringLiteral(":/icons/resources/save.png"));
|
|
||||||
actionSave->setIcon(iconSave);
|
|
||||||
actionSave->setShortcuts(QKeySequence::Save);
|
actionSave->setShortcuts(QKeySequence::Save);
|
||||||
actionSave->setStatusTip("Save existing project to disk");
|
actionSave->setStatusTip("Save existing project to disk");
|
||||||
connect(actionSave, SIGNAL(triggered()), this, SLOT(save_proj()));
|
|
||||||
actionSave->setEnabled(false);
|
actionSave->setEnabled(false);
|
||||||
|
connect(actionSave, SIGNAL(triggered()), this, SLOT(save_proj()));
|
||||||
|
|
||||||
QAction *actionExit = new QAction("Exit", this);
|
QAction *actionExit = new QAction("Exit", this);
|
||||||
QIcon iconExit;
|
actionExit->setIcon(QIcon(":/icons/resources/exit.png"));
|
||||||
iconExit.addFile(QStringLiteral(":/icons/resources/exit.png"));
|
|
||||||
actionExit->setIcon(iconExit);
|
|
||||||
actionExit->setShortcuts(QKeySequence::Quit);
|
actionExit->setShortcuts(QKeySequence::Quit);
|
||||||
actionExit->setStatusTip("Exit the application");
|
actionExit->setStatusTip("Exit the application");
|
||||||
connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
|
connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#ifndef BASEMAINWINDOW_H
|
#ifndef BASEMAINWINDOW_H
|
||||||
#define BASEMAINWINDOW_H
|
#define BASEMAINWINDOW_H
|
||||||
|
|
||||||
#include "infotab.h"
|
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@ -32,9 +31,12 @@
|
|||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::string)
|
Q_DECLARE_METATYPE(std::string)
|
||||||
|
Q_DECLARE_METATYPE(NEXTPNR_NAMESPACE_PREFIX DecalXY)
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
class PythonTab;
|
||||||
|
|
||||||
class BaseMainWindow : public QMainWindow
|
class BaseMainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -62,7 +64,7 @@ class BaseMainWindow : public QMainWindow
|
|||||||
std::unique_ptr<Context> ctx;
|
std::unique_ptr<Context> ctx;
|
||||||
QTabWidget *tabWidget;
|
QTabWidget *tabWidget;
|
||||||
QTabWidget *centralTabWidget;
|
QTabWidget *centralTabWidget;
|
||||||
InfoTab *info;
|
PythonTab *console;
|
||||||
|
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QToolBar *mainToolBar;
|
QToolBar *mainToolBar;
|
||||||
|
@ -89,31 +89,26 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net
|
|||||||
propertyEditor->setPropertiesWithoutValueMarked(true);
|
propertyEditor->setPropertiesWithoutValueMarked(true);
|
||||||
|
|
||||||
propertyEditor->show();
|
propertyEditor->show();
|
||||||
|
|
||||||
const QIcon searchIcon(":/icons/resources/zoom.png");
|
|
||||||
QLineEdit *lineEdit = new QLineEdit();
|
QLineEdit *lineEdit = new QLineEdit();
|
||||||
lineEdit->setClearButtonEnabled(true);
|
lineEdit->setClearButtonEnabled(true);
|
||||||
lineEdit->addAction(searchIcon, QLineEdit::LeadingPosition);
|
lineEdit->addAction(QIcon(":/icons/resources/zoom.png"), QLineEdit::LeadingPosition);
|
||||||
lineEdit->setPlaceholderText("Search...");
|
lineEdit->setPlaceholderText("Search...");
|
||||||
|
|
||||||
actionFirst = new QAction("", this);
|
actionFirst = new QAction("", this);
|
||||||
QIcon iconFirst(QStringLiteral(":/icons/resources/resultset_first.png"));
|
actionFirst->setIcon(QIcon(":/icons/resources/resultset_first.png"));
|
||||||
actionFirst->setIcon(iconFirst);
|
|
||||||
actionFirst->setEnabled(false);
|
actionFirst->setEnabled(false);
|
||||||
|
|
||||||
actionPrev = new QAction("", this);
|
actionPrev = new QAction("", this);
|
||||||
QIcon iconPrev(QStringLiteral(":/icons/resources/resultset_previous.png"));
|
actionPrev->setIcon(QIcon(":/icons/resources/resultset_previous.png"));
|
||||||
actionPrev->setIcon(iconPrev);
|
|
||||||
actionPrev->setEnabled(false);
|
actionPrev->setEnabled(false);
|
||||||
|
|
||||||
actionNext = new QAction("", this);
|
actionNext = new QAction("", this);
|
||||||
QIcon iconNext(QStringLiteral(":/icons/resources/resultset_next.png"));
|
actionNext->setIcon(QIcon(":/icons/resources/resultset_next.png"));
|
||||||
actionNext->setIcon(iconNext);
|
|
||||||
actionNext->setEnabled(false);
|
actionNext->setEnabled(false);
|
||||||
|
|
||||||
actionLast = new QAction("", this);
|
actionLast = new QAction("", this);
|
||||||
QIcon iconLast(QStringLiteral(":/icons/resources/resultset_last.png"));
|
actionLast->setIcon(QIcon(":/icons/resources/resultset_last.png"));
|
||||||
actionLast->setIcon(iconLast);
|
|
||||||
actionLast->setEnabled(false);
|
actionLast->setEnabled(false);
|
||||||
|
|
||||||
QToolBar *toolbar = new QToolBar();
|
QToolBar *toolbar = new QToolBar();
|
||||||
@ -160,7 +155,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net
|
|||||||
// Connection
|
// Connection
|
||||||
connect(treeWidget, &QTreeWidget::customContextMenuRequested, this, &DesignWidget::prepareMenu);
|
connect(treeWidget, &QTreeWidget::customContextMenuRequested, this, &DesignWidget::prepareMenu);
|
||||||
|
|
||||||
connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), SLOT(onItemClicked(QTreeWidgetItem *, int)));
|
connect(treeWidget, SIGNAL(itemSelectionChanged()), SLOT(onItemSelectionChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DesignWidget::~DesignWidget() {}
|
DesignWidget::~DesignWidget() {}
|
||||||
@ -325,8 +320,12 @@ void DesignWidget::clearProperties()
|
|||||||
idToProperty.clear();
|
idToProperty.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignWidget::onItemClicked(QTreeWidgetItem *clickItem, int pos)
|
void DesignWidget::onItemSelectionChanged()
|
||||||
{
|
{
|
||||||
|
if (treeWidget->selectedItems().size()== 0) return;
|
||||||
|
|
||||||
|
QTreeWidgetItem *clickItem = treeWidget->selectedItems().at(0);
|
||||||
|
|
||||||
if (!clickItem->parent())
|
if (!clickItem->parent())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -335,10 +334,15 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *clickItem, int pos)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<DecalXY> decals;
|
||||||
|
|
||||||
clearProperties();
|
clearProperties();
|
||||||
if (type == ElementType::BEL) {
|
if (type == ElementType::BEL) {
|
||||||
IdString c = static_cast<IdStringTreeItem *>(clickItem)->getData();
|
IdString c = static_cast<IdStringTreeItem *>(clickItem)->getData();
|
||||||
BelId bel = ctx->getBelByName(c);
|
BelId bel = ctx->getBelByName(c);
|
||||||
|
|
||||||
|
decals.push_back(ctx->getBelDecal(bel));
|
||||||
|
Q_EMIT selected(decals);
|
||||||
|
|
||||||
QtProperty *topItem = groupManager->addProperty("Bel");
|
QtProperty *topItem = groupManager->addProperty("Bel");
|
||||||
addProperty(topItem, "Bel");
|
addProperty(topItem, "Bel");
|
||||||
@ -367,6 +371,9 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *clickItem, int pos)
|
|||||||
IdString c = static_cast<IdStringTreeItem *>(clickItem)->getData();
|
IdString c = static_cast<IdStringTreeItem *>(clickItem)->getData();
|
||||||
WireId wire = ctx->getWireByName(c);
|
WireId wire = ctx->getWireByName(c);
|
||||||
|
|
||||||
|
decals.push_back(ctx->getWireDecal(wire));
|
||||||
|
Q_EMIT selected(decals);
|
||||||
|
|
||||||
QtProperty *topItem = groupManager->addProperty("Wire");
|
QtProperty *topItem = groupManager->addProperty("Wire");
|
||||||
addProperty(topItem, "Wire");
|
addProperty(topItem, "Wire");
|
||||||
|
|
||||||
@ -420,7 +427,7 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *clickItem, int pos)
|
|||||||
portItem->setValue(pinname);
|
portItem->setValue(pinname);
|
||||||
dhItem->addSubProperty(portItem);
|
dhItem->addSubProperty(portItem);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
QtProperty *pipsDownItem = groupManager->addProperty("Pips Downhill");
|
QtProperty *pipsDownItem = groupManager->addProperty("Pips Downhill");
|
||||||
topItem->addSubProperty(pipsDownItem);
|
topItem->addSubProperty(pipsDownItem);
|
||||||
for (const auto &item : ctx->getPipsDownhill(wire)) {
|
for (const auto &item : ctx->getPipsDownhill(wire)) {
|
||||||
@ -436,11 +443,14 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *clickItem, int pos)
|
|||||||
pipItem->setValue(ctx->getPipName(item).c_str(ctx));
|
pipItem->setValue(ctx->getPipName(item).c_str(ctx));
|
||||||
pipsUpItem->addSubProperty(pipItem);
|
pipsUpItem->addSubProperty(pipItem);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} else if (type == ElementType::PIP) {
|
} else if (type == ElementType::PIP) {
|
||||||
IdString c = static_cast<IdStringTreeItem *>(clickItem)->getData();
|
IdString c = static_cast<IdStringTreeItem *>(clickItem)->getData();
|
||||||
PipId pip = ctx->getPipByName(c);
|
PipId pip = ctx->getPipByName(c);
|
||||||
|
|
||||||
|
decals.push_back(ctx->getPipDecal(pip));
|
||||||
|
Q_EMIT selected(decals);
|
||||||
|
|
||||||
QtProperty *topItem = groupManager->addProperty("Pip");
|
QtProperty *topItem = groupManager->addProperty("Pip");
|
||||||
addProperty(topItem, "Pip");
|
addProperty(topItem, "Pip");
|
||||||
|
|
||||||
|
@ -43,10 +43,11 @@ class DesignWidget : public QWidget
|
|||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void info(std::string text);
|
void info(std::string text);
|
||||||
|
void selected(std::vector<DecalXY> decal);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void prepareMenu(const QPoint &pos);
|
void prepareMenu(const QPoint &pos);
|
||||||
void onItemClicked(QTreeWidgetItem *item, int);
|
void onItemSelectionChanged();
|
||||||
void selectObject();
|
void selectObject();
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void newContext(Context *ctx);
|
void newContext(Context *ctx);
|
||||||
|
@ -195,7 +195,7 @@ bool LineShader::compile(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
|
void LineShader::draw(const LineShaderData &line, const QColor &color, float thickness, const QMatrix4x4 &projection)
|
||||||
{
|
{
|
||||||
auto gl = QOpenGLContext::currentContext()->functions();
|
auto gl = QOpenGLContext::currentContext()->functions();
|
||||||
vao_.bind();
|
vao_.bind();
|
||||||
@ -214,8 +214,8 @@ void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
|
|||||||
buffers_.index.allocate(&line.indices[0], sizeof(GLuint) * line.indices.size());
|
buffers_.index.allocate(&line.indices[0], sizeof(GLuint) * line.indices.size());
|
||||||
|
|
||||||
program_->setUniformValue(uniforms_.projection, projection);
|
program_->setUniformValue(uniforms_.projection, projection);
|
||||||
program_->setUniformValue(uniforms_.thickness, line.thickness);
|
program_->setUniformValue(uniforms_.thickness, thickness);
|
||||||
program_->setUniformValue(uniforms_.color, line.color.r, line.color.g, line.color.b, line.color.a);
|
program_->setUniformValue(uniforms_.color, color.redF(), color.greenF(), color.blueF(), color.alphaF());
|
||||||
|
|
||||||
buffers_.position.bind();
|
buffers_.position.bind();
|
||||||
program_->enableAttributeArray("position");
|
program_->enableAttributeArray("position");
|
||||||
@ -240,7 +240,7 @@ void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
|
|||||||
vao_.release();
|
vao_.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), lineShader_(this), zoom_(500.f), ctx_(nullptr)
|
FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), lineShader_(this), zoom_(500.f), ctx_(nullptr), selectedItemsChanged(false)
|
||||||
{
|
{
|
||||||
backgroundColor_ = QColor("#000000");
|
backgroundColor_ = QColor("#000000");
|
||||||
gridColor_ = QColor("#333");
|
gridColor_ = QColor("#333");
|
||||||
@ -248,6 +248,7 @@ FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), lineSha
|
|||||||
gHiddenColor_ = QColor("#606060");
|
gHiddenColor_ = QColor("#606060");
|
||||||
gInactiveColor_ = QColor("#303030");
|
gInactiveColor_ = QColor("#303030");
|
||||||
gActiveColor_ = QColor("#f0f0f0");
|
gActiveColor_ = QColor("#f0f0f0");
|
||||||
|
gSelectedColor_ = QColor("#ff6600");
|
||||||
frameColor_ = QColor("#0066ba");
|
frameColor_ = QColor("#0066ba");
|
||||||
|
|
||||||
auto fmt = format();
|
auto fmt = format();
|
||||||
@ -380,17 +381,17 @@ void FPGAViewWidget::paintGL()
|
|||||||
float thick11Px = mouseToWorldCoordinates(1.1, 0).x();
|
float thick11Px = mouseToWorldCoordinates(1.1, 0).x();
|
||||||
|
|
||||||
// Draw grid.
|
// Draw grid.
|
||||||
auto grid = LineShaderData(thick1Px, gridColor_);
|
auto grid = LineShaderData();
|
||||||
for (float i = -100.0f; i < 100.0f; i += 1.0f) {
|
for (float i = -100.0f; i < 100.0f; i += 1.0f) {
|
||||||
PolyLine(-100.0f, i, 100.0f, i).build(grid);
|
PolyLine(-100.0f, i, 100.0f, i).build(grid);
|
||||||
PolyLine(i, -100.0f, i, 100.0f).build(grid);
|
PolyLine(i, -100.0f, i, 100.0f).build(grid);
|
||||||
}
|
}
|
||||||
lineShader_.draw(grid, matrix);
|
lineShader_.draw(grid, gridColor_, thick1Px, matrix);
|
||||||
|
|
||||||
LineShaderData shaders[4] = {[GraphicElement::G_FRAME] = LineShaderData(thick11Px, gFrameColor_),
|
LineShaderData shaders[4] = {[GraphicElement::G_FRAME] = LineShaderData(),
|
||||||
[GraphicElement::G_HIDDEN] = LineShaderData(thick11Px, gHiddenColor_),
|
[GraphicElement::G_HIDDEN] = LineShaderData(),
|
||||||
[GraphicElement::G_INACTIVE] = LineShaderData(thick11Px, gInactiveColor_),
|
[GraphicElement::G_INACTIVE] = LineShaderData(),
|
||||||
[GraphicElement::G_ACTIVE] = LineShaderData(thick11Px, gActiveColor_)};
|
[GraphicElement::G_ACTIVE] = LineShaderData()};
|
||||||
|
|
||||||
if (ctx_) {
|
if (ctx_) {
|
||||||
// Draw Bels.
|
// Draw Bels.
|
||||||
@ -409,18 +410,29 @@ void FPGAViewWidget::paintGL()
|
|||||||
for (auto group : ctx_->getGroups()) {
|
for (auto group : ctx_->getGroups()) {
|
||||||
drawDecal(shaders, ctx_->getGroupDecal(group));
|
drawDecal(shaders, ctx_->getGroupDecal(group));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
lineShader_.draw(shaders[0], matrix);
|
|
||||||
lineShader_.draw(shaders[1], matrix);
|
|
||||||
lineShader_.draw(shaders[2], matrix);
|
|
||||||
lineShader_.draw(shaders[3], matrix);
|
|
||||||
|
|
||||||
// Draw Frame Graphics.
|
if (selectedItemsChanged)
|
||||||
auto frames = LineShaderData(thick11Px, frameColor_);
|
{
|
||||||
if (ctx_) {
|
selectedItemsChanged = false;
|
||||||
drawDecal(frames, ctx_->getFrameDecal());
|
selectedShader_.clear();
|
||||||
lineShader_.draw(frames, matrix);
|
for (auto decal : selectedItems_) {
|
||||||
|
drawDecal(selectedShader_, decal);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lineShader_.draw(shaders[0], gFrameColor_, thick11Px, matrix);
|
||||||
|
lineShader_.draw(shaders[1], gHiddenColor_, thick11Px, matrix);
|
||||||
|
lineShader_.draw(shaders[2], gInactiveColor_, thick11Px, matrix);
|
||||||
|
lineShader_.draw(shaders[3], gActiveColor_, thick11Px, matrix);
|
||||||
|
lineShader_.draw(selectedShader_, gSelectedColor_, thick11Px, matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FPGAViewWidget::onSelectedArchItem(std::vector<DecalXY> decals)
|
||||||
|
{
|
||||||
|
selectedItems_ = decals;
|
||||||
|
selectedItemsChanged = true;
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FPGAViewWidget::resizeGL(int width, int height) {}
|
void FPGAViewWidget::resizeGL(int width, int height) {}
|
||||||
|
@ -41,18 +41,6 @@ NPNR_PACKED_STRUCT(struct Vertex2DPOD {
|
|||||||
Vertex2DPOD(GLfloat X, GLfloat Y) : x(X), y(Y) {}
|
Vertex2DPOD(GLfloat X, GLfloat Y) : x(X), y(Y) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Vertex2DPOD is a structure of R, G, B, A values that can be passed to OpenGL
|
|
||||||
// directly.
|
|
||||||
NPNR_PACKED_STRUCT(struct ColorPOD {
|
|
||||||
GLfloat r;
|
|
||||||
GLfloat g;
|
|
||||||
GLfloat b;
|
|
||||||
GLfloat a;
|
|
||||||
|
|
||||||
ColorPOD(GLfloat R, GLfloat G, GLfloat B, GLfloat A) : r(R), g(G), b(B), a(A) {}
|
|
||||||
ColorPOD(const QColor &color) : r(color.redF()), g(color.greenF()), b(color.blueF()), a(color.alphaF()) {}
|
|
||||||
});
|
|
||||||
|
|
||||||
// LineShaderData is a built set of vertices that can be rendered by the
|
// LineShaderData is a built set of vertices that can be rendered by the
|
||||||
// LineShader.
|
// LineShader.
|
||||||
// Each LineShaderData can have its' own color and thickness.
|
// Each LineShaderData can have its' own color and thickness.
|
||||||
@ -63,10 +51,15 @@ struct LineShaderData
|
|||||||
std::vector<GLfloat> miters;
|
std::vector<GLfloat> miters;
|
||||||
std::vector<GLuint> indices;
|
std::vector<GLuint> indices;
|
||||||
|
|
||||||
GLfloat thickness;
|
LineShaderData(void) {}
|
||||||
ColorPOD color;
|
|
||||||
|
|
||||||
LineShaderData(GLfloat Thickness, QColor Color) : thickness(Thickness), color(Color) {}
|
void clear(void)
|
||||||
|
{
|
||||||
|
vertices.clear();
|
||||||
|
normals.clear();
|
||||||
|
miters.clear();
|
||||||
|
indices.clear();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// PolyLine is a set of segments defined by points, that can be built to a
|
// PolyLine is a set of segments defined by points, that can be built to a
|
||||||
@ -210,7 +203,7 @@ class LineShader
|
|||||||
bool compile(void);
|
bool compile(void);
|
||||||
|
|
||||||
// Render a LineShaderData with a given M/V/P transformation.
|
// Render a LineShaderData with a given M/V/P transformation.
|
||||||
void draw(const LineShaderData &data, const QMatrix4x4 &projection);
|
void draw(const LineShaderData &data, const QColor &color, float thickness, const QMatrix4x4 &projection);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
||||||
@ -222,6 +215,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|||||||
Q_PROPERTY(QColor gHiddenColor MEMBER gHiddenColor_ DESIGNABLE true)
|
Q_PROPERTY(QColor gHiddenColor MEMBER gHiddenColor_ DESIGNABLE true)
|
||||||
Q_PROPERTY(QColor gInactiveColor MEMBER gInactiveColor_ DESIGNABLE true)
|
Q_PROPERTY(QColor gInactiveColor MEMBER gInactiveColor_ DESIGNABLE true)
|
||||||
Q_PROPERTY(QColor gActiveColor MEMBER gActiveColor_ DESIGNABLE true)
|
Q_PROPERTY(QColor gActiveColor MEMBER gActiveColor_ DESIGNABLE true)
|
||||||
|
Q_PROPERTY(QColor gSelectedColor MEMBER gSelectedColor_ DESIGNABLE true)
|
||||||
Q_PROPERTY(QColor frameColor MEMBER frameColor_ DESIGNABLE true)
|
Q_PROPERTY(QColor frameColor MEMBER frameColor_ DESIGNABLE true)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -250,7 +244,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|||||||
void drawDecal(LineShaderData out[], const DecalXY &decal);
|
void drawDecal(LineShaderData out[], const DecalXY &decal);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void newContext(Context *ctx);
|
void newContext(Context *ctx);
|
||||||
|
void onSelectedArchItem(std::vector<DecalXY> decals);
|
||||||
private:
|
private:
|
||||||
QPoint lastPos_;
|
QPoint lastPos_;
|
||||||
LineShader lineShader_;
|
LineShader lineShader_;
|
||||||
@ -273,7 +267,12 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|||||||
QColor gHiddenColor_;
|
QColor gHiddenColor_;
|
||||||
QColor gInactiveColor_;
|
QColor gInactiveColor_;
|
||||||
QColor gActiveColor_;
|
QColor gActiveColor_;
|
||||||
|
QColor gSelectedColor_;
|
||||||
QColor frameColor_;
|
QColor frameColor_;
|
||||||
|
|
||||||
|
LineShaderData selectedShader_;
|
||||||
|
std::vector<DecalXY> selectedItems_;
|
||||||
|
bool selectedItemsChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -71,61 +71,47 @@ void MainWindow::createMenu()
|
|||||||
QMenu *menu_Design = new QMenu("&Design", menuBar);
|
QMenu *menu_Design = new QMenu("&Design", menuBar);
|
||||||
menuBar->addAction(menu_Design->menuAction());
|
menuBar->addAction(menu_Design->menuAction());
|
||||||
|
|
||||||
actionLoadJSON = new QAction("Open JSON", this);
|
actionLoadJSON = new QAction("Open JSON", this);
|
||||||
QIcon iconLoadJSON;
|
actionLoadJSON->setIcon(QIcon(":/icons/resources/open_json.png"));
|
||||||
iconLoadJSON.addFile(QStringLiteral(":/icons/resources/open_json.png"));
|
|
||||||
actionLoadJSON->setIcon(iconLoadJSON);
|
|
||||||
actionLoadJSON->setStatusTip("Open an existing JSON file");
|
actionLoadJSON->setStatusTip("Open an existing JSON file");
|
||||||
connect(actionLoadJSON, SIGNAL(triggered()), this, SLOT(open_json()));
|
|
||||||
actionLoadJSON->setEnabled(true);
|
actionLoadJSON->setEnabled(true);
|
||||||
|
connect(actionLoadJSON, SIGNAL(triggered()), this, SLOT(open_json()));
|
||||||
|
|
||||||
actionLoadPCF = new QAction("Open PCF", this);
|
actionLoadPCF = new QAction("Open PCF", this);
|
||||||
QIcon iconLoadPCF;
|
actionLoadPCF->setIcon(QIcon(":/icons/resources/open_pcf.png"));
|
||||||
iconLoadPCF.addFile(QStringLiteral(":/icons/resources/open_pcf.png"));
|
|
||||||
actionLoadPCF->setIcon(iconLoadPCF);
|
|
||||||
actionLoadPCF->setStatusTip("Open PCF file");
|
actionLoadPCF->setStatusTip("Open PCF file");
|
||||||
connect(actionLoadPCF, SIGNAL(triggered()), this, SLOT(open_pcf()));
|
|
||||||
actionLoadPCF->setEnabled(false);
|
actionLoadPCF->setEnabled(false);
|
||||||
|
connect(actionLoadPCF, SIGNAL(triggered()), this, SLOT(open_pcf()));
|
||||||
|
|
||||||
actionPack = new QAction("Pack", this);
|
actionPack = new QAction("Pack", this);
|
||||||
QIcon iconPack;
|
actionPack->setIcon(QIcon(":/icons/resources/pack.png"));
|
||||||
iconPack.addFile(QStringLiteral(":/icons/resources/pack.png"));
|
|
||||||
actionPack->setIcon(iconPack);
|
|
||||||
actionPack->setStatusTip("Pack current design");
|
actionPack->setStatusTip("Pack current design");
|
||||||
connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
|
|
||||||
actionPack->setEnabled(false);
|
actionPack->setEnabled(false);
|
||||||
|
connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
|
||||||
|
|
||||||
actionAssignBudget = new QAction("Assign Budget", this);
|
actionAssignBudget = new QAction("Assign Budget", this);
|
||||||
QIcon iconAssignBudget;
|
actionAssignBudget->setIcon(QIcon(":/icons/resources/time_add.png"));
|
||||||
iconAssignBudget.addFile(QStringLiteral(":/icons/resources/time_add.png"));
|
|
||||||
actionAssignBudget->setIcon(iconAssignBudget);
|
|
||||||
actionAssignBudget->setStatusTip("Assign time budget for current design");
|
actionAssignBudget->setStatusTip("Assign time budget for current design");
|
||||||
connect(actionAssignBudget, SIGNAL(triggered()), this, SLOT(budget()));
|
|
||||||
actionAssignBudget->setEnabled(false);
|
actionAssignBudget->setEnabled(false);
|
||||||
|
connect(actionAssignBudget, SIGNAL(triggered()), this, SLOT(budget()));
|
||||||
|
|
||||||
actionPlace = new QAction("Place", this);
|
actionPlace = new QAction("Place", this);
|
||||||
QIcon iconPlace;
|
actionPlace->setIcon(QIcon(":/icons/resources/place.png"));
|
||||||
iconPlace.addFile(QStringLiteral(":/icons/resources/place.png"));
|
|
||||||
actionPlace->setIcon(iconPlace);
|
|
||||||
actionPlace->setStatusTip("Place current design");
|
actionPlace->setStatusTip("Place current design");
|
||||||
connect(actionPlace, SIGNAL(triggered()), this, SLOT(place()));
|
|
||||||
actionPlace->setEnabled(false);
|
actionPlace->setEnabled(false);
|
||||||
|
connect(actionPlace, SIGNAL(triggered()), this, SLOT(place()));
|
||||||
|
|
||||||
actionRoute = new QAction("Route", this);
|
actionRoute = new QAction("Route", this);
|
||||||
QIcon iconRoute;
|
actionRoute->setIcon(QIcon(":/icons/resources/route.png"));
|
||||||
iconRoute.addFile(QStringLiteral(":/icons/resources/route.png"));
|
|
||||||
actionRoute->setIcon(iconRoute);
|
|
||||||
actionRoute->setStatusTip("Route current design");
|
actionRoute->setStatusTip("Route current design");
|
||||||
connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
|
|
||||||
actionRoute->setEnabled(false);
|
actionRoute->setEnabled(false);
|
||||||
|
connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
|
||||||
|
|
||||||
actionSaveAsc = new QAction("Save ASC", this);
|
actionSaveAsc = new QAction("Save ASC", this);
|
||||||
QIcon iconSaveAsc;
|
actionSaveAsc->setIcon(QIcon(":/icons/resources/save_asc.png"));
|
||||||
iconSaveAsc.addFile(QStringLiteral(":/icons/resources/save_asc.png"));
|
|
||||||
actionSaveAsc->setIcon(iconSaveAsc);
|
|
||||||
actionSaveAsc->setStatusTip("Save ASC file");
|
actionSaveAsc->setStatusTip("Save ASC file");
|
||||||
connect(actionSaveAsc, SIGNAL(triggered()), this, SLOT(save_asc()));
|
|
||||||
actionSaveAsc->setEnabled(false);
|
actionSaveAsc->setEnabled(false);
|
||||||
|
connect(actionSaveAsc, SIGNAL(triggered()), this, SLOT(save_asc()));
|
||||||
|
|
||||||
QToolBar *taskFPGABar = new QToolBar();
|
QToolBar *taskFPGABar = new QToolBar();
|
||||||
addToolBar(Qt::TopToolBarArea, taskFPGABar);
|
addToolBar(Qt::TopToolBarArea, taskFPGABar);
|
||||||
@ -146,29 +132,23 @@ void MainWindow::createMenu()
|
|||||||
menu_Design->addAction(actionRoute);
|
menu_Design->addAction(actionRoute);
|
||||||
menu_Design->addAction(actionSaveAsc);
|
menu_Design->addAction(actionSaveAsc);
|
||||||
|
|
||||||
actionPlay = new QAction("Play", this);
|
actionPlay = new QAction("Play", this);
|
||||||
QIcon iconPlay;
|
actionPlay->setIcon(QIcon(":/icons/resources/control_play.png"));
|
||||||
iconPlay.addFile(QStringLiteral(":/icons/resources/control_play.png"));
|
|
||||||
actionPlay->setIcon(iconPlay);
|
|
||||||
actionPlay->setStatusTip("Continue running task");
|
actionPlay->setStatusTip("Continue running task");
|
||||||
connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
|
|
||||||
actionPlay->setEnabled(false);
|
actionPlay->setEnabled(false);
|
||||||
|
connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
|
||||||
|
|
||||||
actionPause = new QAction("Pause", this);
|
actionPause = new QAction("Pause", this);
|
||||||
QIcon iconPause;
|
actionPause->setIcon(QIcon(":/icons/resources/control_pause.png"));
|
||||||
iconPause.addFile(QStringLiteral(":/icons/resources/control_pause.png"));
|
|
||||||
actionPause->setIcon(iconPause);
|
|
||||||
actionPause->setStatusTip("Pause running task");
|
actionPause->setStatusTip("Pause running task");
|
||||||
connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread()));
|
|
||||||
actionPause->setEnabled(false);
|
actionPause->setEnabled(false);
|
||||||
|
connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread()));
|
||||||
|
|
||||||
actionStop = new QAction("Stop", this);
|
actionStop = new QAction("Stop", this);
|
||||||
QIcon iconStop;
|
actionStop->setIcon(QIcon(":/icons/resources/control_stop.png"));
|
||||||
iconStop.addFile(QStringLiteral(":/icons/resources/control_stop.png"));
|
|
||||||
actionStop->setIcon(iconStop);
|
|
||||||
actionStop->setStatusTip("Stop running task");
|
actionStop->setStatusTip("Stop running task");
|
||||||
connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread()));
|
|
||||||
actionStop->setEnabled(false);
|
actionStop->setEnabled(false);
|
||||||
|
connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread()));
|
||||||
|
|
||||||
QToolBar *taskToolBar = new QToolBar();
|
QToolBar *taskToolBar = new QToolBar();
|
||||||
addToolBar(Qt::TopToolBarArea, taskToolBar);
|
addToolBar(Qt::TopToolBarArea, taskToolBar);
|
||||||
@ -253,7 +233,6 @@ void MainWindow::new_proj()
|
|||||||
|
|
||||||
void MainWindow::load_json(std::string filename, std::string pcf)
|
void MainWindow::load_json(std::string filename, std::string pcf)
|
||||||
{
|
{
|
||||||
tabWidget->setCurrentWidget(info);
|
|
||||||
preload_pcf = pcf;
|
preload_pcf = pcf;
|
||||||
disableActions();
|
disableActions();
|
||||||
Q_EMIT task->loadfile(filename);
|
Q_EMIT task->loadfile(filename);
|
||||||
@ -261,8 +240,6 @@ void MainWindow::load_json(std::string filename, std::string pcf)
|
|||||||
|
|
||||||
void MainWindow::load_pcf(std::string filename)
|
void MainWindow::load_pcf(std::string filename)
|
||||||
{
|
{
|
||||||
tabWidget->setCurrentWidget(info);
|
|
||||||
|
|
||||||
disableActions();
|
disableActions();
|
||||||
Q_EMIT task->loadpcf(filename);
|
Q_EMIT task->loadpcf(filename);
|
||||||
}
|
}
|
||||||
@ -271,15 +248,12 @@ void MainWindow::newContext(Context *ctx)
|
|||||||
{
|
{
|
||||||
std::string title = "nextpnr-ice40 - " + ctx->getChipName() + " ( " + chipArgs.package + " )";
|
std::string title = "nextpnr-ice40 - " + ctx->getChipName() + " ( " + chipArgs.package + " )";
|
||||||
setWindowTitle(title.c_str());
|
setWindowTitle(title.c_str());
|
||||||
info->clearBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::open_proj()
|
void MainWindow::open_proj()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, QString("Open Project"), QString(), QString("*.proj"));
|
QString fileName = QFileDialog::getOpenFileName(this, QString("Open Project"), QString(), QString("*.proj"));
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
tabWidget->setCurrentWidget(info);
|
|
||||||
|
|
||||||
std::string fn = fileName.toStdString();
|
std::string fn = fileName.toStdString();
|
||||||
disableActions();
|
disableActions();
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NO_PYTHON
|
|
||||||
|
|
||||||
#include "line_editor.h"
|
#include "line_editor.h"
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
@ -131,5 +129,3 @@ void LineEditor::autocomplete()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // NO_PYTHON
|
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#ifndef LINE_EDITOR_H
|
#ifndef LINE_EDITOR_H
|
||||||
#define LINE_EDITOR_H
|
#define LINE_EDITOR_H
|
||||||
|
|
||||||
#ifndef NO_PYTHON
|
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include "ParseHelper.h"
|
#include "ParseHelper.h"
|
||||||
@ -59,6 +57,4 @@ class LineEditor : public QLineEdit
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // NO_PYTHON
|
|
||||||
|
|
||||||
#endif // LINE_EDITOR_H
|
#endif // LINE_EDITOR_H
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NO_PYTHON
|
|
||||||
|
|
||||||
#include "pyconsole.h"
|
#include "pyconsole.h"
|
||||||
#include "pyinterpreter.h"
|
#include "pyinterpreter.h"
|
||||||
|
|
||||||
@ -68,6 +66,7 @@ void PythonConsole::displayString(QString text)
|
|||||||
setTextColor(NORMAL_COLOR);
|
setTextColor(NORMAL_COLOR);
|
||||||
cursor.insertText(text);
|
cursor.insertText(text);
|
||||||
cursor.movePosition(QTextCursor::EndOfLine);
|
cursor.movePosition(QTextCursor::EndOfLine);
|
||||||
|
moveCursorToEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonConsole::moveCursorToEnd()
|
void PythonConsole::moveCursorToEnd()
|
||||||
@ -78,5 +77,3 @@ void PythonConsole::moveCursorToEnd()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // NO_PYTHON
|
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#ifndef PYCONSOLE_H
|
#ifndef PYCONSOLE_H
|
||||||
#define PYCONSOLE_H
|
#define PYCONSOLE_H
|
||||||
|
|
||||||
#ifndef NO_PYTHON
|
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
@ -53,6 +51,5 @@ class PythonConsole : public QTextEdit, public ParseListener
|
|||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
#endif // NO_PYTHON
|
|
||||||
|
|
||||||
#endif // PYCONSOLE_H
|
#endif // PYCONSOLE_H
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef NO_PYTHON
|
|
||||||
|
|
||||||
#include "pythontab.h"
|
#include "pythontab.h"
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@ -77,7 +76,6 @@ PythonTab::~PythonTab()
|
|||||||
void PythonTab::editLineReturnPressed(QString text)
|
void PythonTab::editLineReturnPressed(QString text)
|
||||||
{
|
{
|
||||||
console->displayString(prompt + text + "\n");
|
console->displayString(prompt + text + "\n");
|
||||||
console->moveCursorToEnd();
|
|
||||||
|
|
||||||
parseHelper.process(text.toStdString());
|
parseHelper.process(text.toStdString());
|
||||||
|
|
||||||
@ -114,6 +112,6 @@ void PythonTab::showContextMenu(const QPoint &pt) { contextMenu->exec(mapToGloba
|
|||||||
|
|
||||||
void PythonTab::clearBuffer() { console->clear(); }
|
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
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#ifndef PYTHONTAB_H
|
#ifndef PYTHONTAB_H
|
||||||
#define PYTHONTAB_H
|
#define PYTHONTAB_H
|
||||||
|
|
||||||
#ifndef NO_PYTHON
|
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
@ -42,10 +40,11 @@ class PythonTab : public QWidget
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void showContextMenu(const QPoint &pt);
|
void showContextMenu(const QPoint &pt);
|
||||||
void clearBuffer();
|
|
||||||
void editLineReturnPressed(QString text);
|
void editLineReturnPressed(QString text);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void newContext(Context *ctx);
|
void newContext(Context *ctx);
|
||||||
|
void info(std::string str);
|
||||||
|
void clearBuffer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PythonConsole *console;
|
PythonConsole *console;
|
||||||
@ -60,6 +59,5 @@ class PythonTab : public QWidget
|
|||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
#endif // NO_PYTHON
|
|
||||||
|
|
||||||
#endif // PYTHONTAB_H
|
#endif // PYTHONTAB_H
|
||||||
|
Loading…
Reference in New Issue
Block a user