join python and info into one tab
This commit is contained in:
parent
98c5948856
commit
5216e48863
@ -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)
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user