Display nets and cells as well
This commit is contained in:
parent
2dd7c77abd
commit
6b904aefd3
@ -69,6 +69,7 @@ BaseMainWindow::BaseMainWindow(QWidget *parent) : QMainWindow(parent), ctx(nullp
|
||||
splitter_h->addWidget(designview);
|
||||
|
||||
connect(this, SIGNAL(contextChanged(Context *)), designview, SLOT(newContext(Context *)));
|
||||
connect(this, SIGNAL(updateTreeView()), designview, SLOT(updateTree()));
|
||||
|
||||
connect(designview, SIGNAL(info(std::string)), this, SLOT(writeInfo(std::string)));
|
||||
|
||||
|
@ -55,6 +55,7 @@ class BaseMainWindow : public QMainWindow
|
||||
|
||||
Q_SIGNALS:
|
||||
void contextChanged(Context *ctx);
|
||||
void updateTreeView();
|
||||
|
||||
protected:
|
||||
Context *ctx;
|
||||
|
@ -83,7 +83,7 @@ class PipTreeItem : public ElementTreeItem
|
||||
IdString data;
|
||||
};
|
||||
|
||||
DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
|
||||
DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), nets_root(nullptr), cells_root(nullptr)
|
||||
{
|
||||
|
||||
treeWidget = new QTreeWidget();
|
||||
@ -217,6 +217,56 @@ void DesignWidget::newContext(Context *ctx)
|
||||
for (auto pip : pip_items.toStdMap()) {
|
||||
pip_root->addChild(pip.second);
|
||||
}
|
||||
|
||||
// Add nets to tree
|
||||
nets_root = new QTreeWidgetItem(treeWidget);
|
||||
nets_root->setText(0, QString("Nets"));
|
||||
treeWidget->insertTopLevelItem(0, nets_root);
|
||||
|
||||
// Add cells to tree
|
||||
cells_root = new QTreeWidgetItem(treeWidget);
|
||||
cells_root->setText(0, QString("Cells"));
|
||||
treeWidget->insertTopLevelItem(0, cells_root);
|
||||
|
||||
}
|
||||
|
||||
void DesignWidget::updateTree()
|
||||
{
|
||||
delete nets_root;
|
||||
delete cells_root;
|
||||
|
||||
// Add nets to tree
|
||||
nets_root = new QTreeWidgetItem(treeWidget);
|
||||
QMap<QString, QTreeWidgetItem *> nets_items;
|
||||
nets_root->setText(0, QString("Nets"));
|
||||
treeWidget->insertTopLevelItem(0, nets_root);
|
||||
if (ctx) {
|
||||
for (auto& item : ctx->nets) {
|
||||
auto id = item.first;
|
||||
QString name = QString(id.c_str(ctx));
|
||||
nets_items.insert(name,new ElementTreeItem(ElementType::NONE, name, nullptr));
|
||||
}
|
||||
}
|
||||
for (auto item : nets_items.toStdMap()) {
|
||||
nets_root->addChild(item.second);
|
||||
}
|
||||
|
||||
// Add cells to tree
|
||||
cells_root = new QTreeWidgetItem(treeWidget);
|
||||
QMap<QString, QTreeWidgetItem *> cells_items;
|
||||
cells_root->setText(0, QString("Cells"));
|
||||
treeWidget->insertTopLevelItem(0, cells_root);
|
||||
if (ctx) {
|
||||
for (auto& item : ctx->cells) {
|
||||
auto id = item.first;
|
||||
QString name = QString(id.c_str(ctx));
|
||||
cells_items.insert(name,new ElementTreeItem(ElementType::NONE, name, nullptr));
|
||||
}
|
||||
}
|
||||
for (auto item : cells_items.toStdMap()) {
|
||||
cells_root->addChild(item.second);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DesignWidget::addProperty(QtVariantProperty *property, const QString &id)
|
||||
|
@ -49,6 +49,7 @@ class DesignWidget : public QWidget
|
||||
void selectObject();
|
||||
public Q_SLOTS:
|
||||
void newContext(Context *ctx);
|
||||
void updateTree();
|
||||
|
||||
private:
|
||||
Context *ctx;
|
||||
@ -62,6 +63,8 @@ class DesignWidget : public QWidget
|
||||
|
||||
QMap<QtProperty *, QString> propertyToId;
|
||||
QMap<QString, QtVariantProperty *> idToProperty;
|
||||
QTreeWidgetItem *nets_root;
|
||||
QTreeWidgetItem *cells_root;
|
||||
};
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
@ -272,6 +272,7 @@ void MainWindow::loadfile_finished(bool status)
|
||||
log("Loading design successful.\n");
|
||||
actionLoadPCF->setEnabled(true);
|
||||
actionPack->setEnabled(true);
|
||||
Q_EMIT updateTreeView();
|
||||
} else {
|
||||
log("Loading design failed.\n");
|
||||
}
|
||||
@ -303,6 +304,7 @@ void MainWindow::pack_finished(bool status)
|
||||
disableActions();
|
||||
if (status) {
|
||||
log("Packing design successful.\n");
|
||||
Q_EMIT updateTreeView();
|
||||
actionPlace->setEnabled(true);
|
||||
actionAssignBudget->setEnabled(true);
|
||||
} else {
|
||||
@ -326,6 +328,7 @@ void MainWindow::place_finished(bool status)
|
||||
disableActions();
|
||||
if (status) {
|
||||
log("Placing design successful.\n");
|
||||
Q_EMIT updateTreeView();
|
||||
actionRoute->setEnabled(true);
|
||||
} else {
|
||||
log("Placing design failed.\n");
|
||||
@ -336,6 +339,7 @@ void MainWindow::route_finished(bool status)
|
||||
disableActions();
|
||||
if (status) {
|
||||
log("Routing design successful.\n");
|
||||
Q_EMIT updateTreeView();
|
||||
actionSaveAsc->setEnabled(true);
|
||||
} else
|
||||
log("Routing design failed.\n");
|
||||
|
Loading…
Reference in New Issue
Block a user