Commit 6cdb88d8 authored by Jan Möbius's avatar Jan Möbius

Added python output textedit to python widget

parent b86bdb3c
......@@ -53,9 +53,6 @@ class PythonInterpreter : public QObject {
/// Log with OUT,WARN or ERR as type
void log(Logtype _type , QString _message );
/// Default logging as OUT
void log(QString _message );
public:
......
......@@ -95,6 +95,9 @@ PythonWidget::PythonWidget(QWidget *parent )
}
PythonInterpreter* interpreter = PythonInterpreter::getInstance();
if ( OpenFlipper::Options::gui() )
connect(interpreter,SIGNAL(log(Logtype,QString)) , this, SLOT(slotLocalLog(Logtype,QString)));
QTextEdit* coreInfo = new QTextEdit( infoTab );
infoTab->addTab(coreInfo,"Core");
......@@ -126,6 +129,29 @@ void PythonWidget::runScript() {
}
void PythonWidget::slotLocalLog(Logtype _type ,QString _logString) {
switch (_type) {
case LOGINFO:
pythonOutput->setTextColor( QColor(Qt::darkGreen) );
break;
case LOGOUT:
pythonOutput->setTextColor( QPalette{}.windowText().color() );
break;
case LOGWARN:
pythonOutput->setTextColor( QColor(160,160,0) );
break;
case LOGERR:
pythonOutput->setTextColor( QColor(Qt::red) );
break;
case LOGSTATUS:
pythonOutput->setTextColor( QColor(Qt::blue) );
break;
}
pythonOutput->append(_logString);
}
......
......@@ -56,6 +56,9 @@ class PythonWidget : public QMainWindow, public Ui::PythonWidget
public slots:
void runScript();
private slots:
void slotLocalLog(Logtype _type,QString _logString);
};
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>994</width>
<height>699</height>
<height>659</height>
</rect>
</property>
<property name="windowTitle">
......@@ -26,11 +26,18 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTextEdit" name="scriptWidget">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTextEdit" name="scriptWidget">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="pythonOutput"/>
</item>
</layout>
</item>
</layout>
</widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment