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 { ...@@ -53,9 +53,6 @@ class PythonInterpreter : public QObject {
/// Log with OUT,WARN or ERR as type /// Log with OUT,WARN or ERR as type
void log(Logtype _type , QString _message ); void log(Logtype _type , QString _message );
/// Default logging as OUT
void log(QString _message );
public: public:
......
...@@ -95,6 +95,9 @@ PythonWidget::PythonWidget(QWidget *parent ) ...@@ -95,6 +95,9 @@ PythonWidget::PythonWidget(QWidget *parent )
} }
PythonInterpreter* interpreter = PythonInterpreter::getInstance(); PythonInterpreter* interpreter = PythonInterpreter::getInstance();
if ( OpenFlipper::Options::gui() )
connect(interpreter,SIGNAL(log(Logtype,QString)) , this, SLOT(slotLocalLog(Logtype,QString)));
QTextEdit* coreInfo = new QTextEdit( infoTab ); QTextEdit* coreInfo = new QTextEdit( infoTab );
infoTab->addTab(coreInfo,"Core"); infoTab->addTab(coreInfo,"Core");
...@@ -126,6 +129,29 @@ void PythonWidget::runScript() { ...@@ -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 ...@@ -56,6 +56,9 @@ class PythonWidget : public QMainWindow, public Ui::PythonWidget
public slots: public slots:
void runScript(); void runScript();
private slots:
void slotLocalLog(Logtype _type,QString _logString);
}; };
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>994</width> <width>994</width>
<height>699</height> <height>659</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -26,11 +26,18 @@ ...@@ -26,11 +26,18 @@
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QTextEdit" name="scriptWidget"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="readOnly"> <item>
<bool>false</bool> <widget class="QTextEdit" name="scriptWidget">
</property> <property name="readOnly">
</widget> <bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="pythonOutput"/>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </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