Skip to content
Permalink
Browse files
fix #1376
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9532 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 24, 2008
1 parent b182a5e commit b564b8cd2b0d699c2b805872c5d69320b2deae86
Showing with 48 additions and 3 deletions.
  1. +42 −1 src/app/qgspythondialog.cpp
  2. +6 −2 src/app/qgspythondialog.h
@@ -30,6 +30,8 @@ QgsPythonDialog::QgsPythonDialog( QgisInterface* pIface, QgsPythonUtils* pythonU
#endif
mIface = pIface;
mPythonUtils = pythonUtils;

pos = 0;
}

QgsPythonDialog::~QgsPythonDialog()
@@ -41,11 +43,50 @@ QString QgsPythonDialog::escapeHtml( QString text )
return text.replace( "<", "&lt;" ).replace( ">", "&gt;" );
}

void QgsPythonDialog::keyPressEvent( QKeyEvent *ev )
{
switch( ev->key() )
{
case Qt::Key_Up:
{
if(pos>0)
{
if( pos==history.size() )
history << edtCmdLine->text();
else
history[pos] = edtCmdLine->text();
pos--;
edtCmdLine->setText(history[pos]);
}
}
break;
case Qt::Key_Down:
{
if( pos<history.size()-1 )
{
history[pos] = edtCmdLine->text();
pos++;
edtCmdLine->setText(history[pos]);
}
}
break;
default:
QWidget::keyPressEvent(ev);
break;
}
}

void QgsPythonDialog::on_edtCmdLine_returnPressed()
{
QString command = edtCmdLine->text();
QString output;

if( !command.isEmpty() )
{
history << command;
pos = history.size();
}

QString output;

// when using Py_single_input the return value will be always null
// we're using custom hooks for output and exceptions to show output in console
@@ -41,13 +41,17 @@ class QgsPythonDialog : public QDialog, private Ui::QgsPythonDialog

protected:

void closeEvent( QCloseEvent* event );
void showEvent( QShowEvent* event );
void keyPressEvent( QKeyEvent *event );
void closeEvent( QCloseEvent *event );
void showEvent( QShowEvent *event );

private:

QgisInterface* mIface;
QgsPythonUtils* mPythonUtils;

QStringList history;
int pos;
};

#endif

0 comments on commit b564b8c

Please sign in to comment.