Skip to content

Commit

Permalink
Fix build option
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
  • Loading branch information
QQxiaoming committed Aug 1, 2024
1 parent aa258bd commit 0977ecb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/internalcommandwindow/internalcommandprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ InternalCommandProcess::~InternalCommandProcess() {
wait();
}

#ifdef ENABLE_PYTHON
void InternalCommandProcess::setPyRun(PyRun *pyRun) {
m_pyRun = pyRun;
}
#endif

void InternalCommandProcess::run(void) {
sendWelcome();
Expand Down Expand Up @@ -290,19 +292,21 @@ void InternalCommandProcess::processLine(const QString &sline) {
fullCommand = command + " " + args.join(' ');
}
if(!matched) {
if(m_pyRun) {
#ifdef ENABLE_PYTHON
if(m_pyRun) {
QString result;
int ret = -1;
m_pyRun->runScriptStr("from quardCRT import crt\r\nprint("+fullCommand+")", &result, &ret);
if(ret == 0) {
result.replace("\n","\r\n");
sendString(result);
} else
#endif
{
} else {
sendLineString("Invalid command!");
}
} else
#endif
{
sendLineString("Invalid command!");
}
}
if((!historyCmdList.isEmpty()) && historyCmdList.last() == fullCommand) {
Expand Down
2 changes: 2 additions & 0 deletions src/internalcommandwindow/internalcommandwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ InternalCommandWindow::~InternalCommandWindow() {
delete ui;
}

#ifdef ENABLE_PYTHON
void InternalCommandWindow::setPyRun(PyRun *pyRun) {
process->setPyRun(pyRun);
}
#endif

void InternalCommandWindow::contextMenuEvent(QContextMenuEvent *event) {
QMenu *menu = new QMenu(this);
Expand Down

0 comments on commit 0977ecb

Please sign in to comment.