Gui: Fix header uniformity, whitespace, and doxygen fixes
This commit is contained in:
@@ -186,7 +186,7 @@ void InteractiveInterpreter::setPrompt()
|
||||
|
||||
/**
|
||||
* Compile a command and determine whether it is incomplete.
|
||||
*
|
||||
*
|
||||
* The source string may contain line feeds and/or carriage returns. \n
|
||||
* Return value / exceptions raised:
|
||||
* - Return a code object if the command is complete and valid
|
||||
@@ -222,7 +222,7 @@ PyObject* InteractiveInterpreter::compile(const char* source) const
|
||||
|
||||
/**
|
||||
* Compile a command and determine whether it is incomplete.
|
||||
*
|
||||
*
|
||||
* The source string may contain line feeds and/or carriage returns. \n
|
||||
* Return value:
|
||||
* - Return 1 if the command is incomplete
|
||||
@@ -264,17 +264,17 @@ int InteractiveInterpreter::compileCommand(const char* source) const
|
||||
*
|
||||
* One several things can happen:
|
||||
*
|
||||
* - The input is incorrect; compile() raised an exception (SyntaxError or OverflowError).
|
||||
* - The input is incorrect; compile() raised an exception (SyntaxError or OverflowError).
|
||||
* A syntax traceback will be printed by calling Python's PyErr_Print() method to the redirected stderr.
|
||||
*
|
||||
* - The input is incomplete, and more input is required; compile() returned 'None'.
|
||||
* - The input is incomplete, and more input is required; compile() returned 'None'.
|
||||
* Nothing happens.
|
||||
*
|
||||
* - The input is complete; compile() returned a code object. The code is executed by calling
|
||||
* - The input is complete; compile() returned a code object. The code is executed by calling
|
||||
* runCode() (which also handles run-time exceptions, except for SystemExit).
|
||||
* .
|
||||
* The return value is True if the input is incomplete, False in the other cases (unless
|
||||
* an exception is raised). The return value can be used to decide whether to use sys.ps1
|
||||
* an exception is raised). The return value can be used to decide whether to use sys.ps1
|
||||
* or sys.ps2 to prompt the next line.
|
||||
*/
|
||||
bool InteractiveInterpreter::runSource(const char* source) const
|
||||
@@ -316,10 +316,10 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const
|
||||
Base::PyGILStateLocker lock;
|
||||
PyObject *module, *dict, *presult; /* "exec code in d, d" */
|
||||
module = PyImport_AddModule("__main__"); /* get module, init python */
|
||||
if (module == NULL)
|
||||
if (module == NULL)
|
||||
throw Base::PyException(); /* not incref'd */
|
||||
dict = PyModule_GetDict(module); /* get dict namespace */
|
||||
if (dict == NULL)
|
||||
if (dict == NULL)
|
||||
throw Base::PyException(); /* not incref'd */
|
||||
|
||||
// It seems that the return value is always 'None' or Null
|
||||
@@ -425,7 +425,7 @@ void InteractiveInterpreter::clearBuffer()
|
||||
/* TRANSLATOR Gui::PythonConsole */
|
||||
|
||||
/**
|
||||
* Constructs a PythonConsole which is a child of 'parent'.
|
||||
* Constructs a PythonConsole which is a child of 'parent'.
|
||||
*/
|
||||
PythonConsole::PythonConsole(QWidget *parent)
|
||||
: TextEdit(parent), WindowParameter( "Editor" ), _sourceDrain(NULL)
|
||||
@@ -434,7 +434,7 @@ PythonConsole::PythonConsole(QWidget *parent)
|
||||
d->interactive = false;
|
||||
|
||||
// create an instance of InteractiveInterpreter
|
||||
try {
|
||||
try {
|
||||
d->interpreter = new InteractiveInterpreter();
|
||||
} catch (const Base::Exception& e) {
|
||||
setPlainText(QString::fromLatin1(e.what()));
|
||||
@@ -456,7 +456,7 @@ PythonConsole::PythonConsole(QWidget *parent)
|
||||
|
||||
QFont serifFont(QLatin1String("Courier"), 10, QFont::Normal);
|
||||
setFont(serifFont);
|
||||
|
||||
|
||||
// set colors and font from settings
|
||||
ParameterGrp::handle hPrefGrp = getWindowParameter();
|
||||
hPrefGrp->Attach( this );
|
||||
@@ -503,10 +503,10 @@ PythonConsole::~PythonConsole()
|
||||
delete d;
|
||||
}
|
||||
|
||||
/** Set new font and colors according to the parameters. */
|
||||
/** Set new font and colors according to the parameters. */
|
||||
void PythonConsole::OnChange( Base::Subject<const char*> &rCaller,const char* sReason )
|
||||
{
|
||||
Q_UNUSED(rCaller);
|
||||
Q_UNUSED(rCaller);
|
||||
ParameterGrp::handle hPrefGrp = getWindowParameter();
|
||||
|
||||
bool pythonWordWrap = App::GetApplication().GetUserParameter().
|
||||
@@ -521,7 +521,7 @@ void PythonConsole::OnChange( Base::Subject<const char*> &rCaller,const char* sR
|
||||
if (strcmp(sReason, "FontSize") == 0 || strcmp(sReason, "Font") == 0) {
|
||||
int fontSize = hPrefGrp->GetInt("FontSize", 10);
|
||||
QString fontFamily = QString::fromLatin1(hPrefGrp->GetASCII("Font", "Courier").c_str());
|
||||
|
||||
|
||||
QFont font(fontFamily, fontSize);
|
||||
setFont(font);
|
||||
QFontMetrics metric(font);
|
||||
@@ -580,8 +580,8 @@ void PythonConsole::keyPressEvent(QKeyEvent * e)
|
||||
e->matches(QKeySequence::SelectAll)) {
|
||||
TextEdit::keyPressEvent(e);
|
||||
}
|
||||
else if (!e->text().isEmpty() &&
|
||||
(e->modifiers() == Qt::NoModifier ||
|
||||
else if (!e->text().isEmpty() &&
|
||||
(e->modifiers() == Qt::NoModifier ||
|
||||
e->modifiers() == Qt::ShiftModifier)) {
|
||||
this->moveCursor(QTextCursor::End);
|
||||
TextEdit::keyPressEvent(e);
|
||||
@@ -688,7 +688,7 @@ void PythonConsole::keyPressEvent(QKeyEvent * e)
|
||||
{ TextEdit::keyPressEvent(e); }
|
||||
} break;
|
||||
|
||||
default:
|
||||
default:
|
||||
{
|
||||
TextEdit::keyPressEvent(e);
|
||||
} break;
|
||||
@@ -730,8 +730,8 @@ void PythonConsole::onFlush()
|
||||
}
|
||||
|
||||
/** Prints the ps1 prompt (>>> ) for complete and ps2 prompt (... ) for
|
||||
* incomplete commands to the console window.
|
||||
*/
|
||||
* incomplete commands to the console window.
|
||||
*/
|
||||
void PythonConsole::printPrompt(PythonConsole::Prompt mode)
|
||||
{
|
||||
// write normal messages
|
||||
@@ -791,7 +791,7 @@ void PythonConsole::appendOutput(const QString& output, int state)
|
||||
QTextCursor cursor = textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
int pos = cursor.position() + 1;
|
||||
|
||||
|
||||
// delay rehighlighting
|
||||
cursor.beginEditBlock();
|
||||
appendPlainText(output);
|
||||
@@ -827,7 +827,7 @@ void PythonConsole::runSource(const QString& line)
|
||||
PySys_SetObject("stdout", d->_stdoutPy);
|
||||
PySys_SetObject("stderr", d->_stderrPy);
|
||||
d->interactive = true;
|
||||
|
||||
|
||||
try {
|
||||
d->history.markScratch(); //< mark current history position ...
|
||||
// launch the command now
|
||||
@@ -916,7 +916,7 @@ void PythonConsole::printStatement( const QString& cmd )
|
||||
QTextCursor cursor = textCursor();
|
||||
QStringList statements = cmd.split(QLatin1String("\n"));
|
||||
for (QStringList::Iterator it = statements.begin(); it != statements.end(); ++it) {
|
||||
// go to the end before inserting new text
|
||||
// go to the end before inserting new text
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
cursor.insertText( *it );
|
||||
d->history.append( *it );
|
||||
@@ -1000,7 +1000,7 @@ void PythonConsole::dropEvent (QDropEvent * e)
|
||||
QPlainTextEdit::dropEvent(e);
|
||||
}
|
||||
|
||||
/** Dragging of action objects is allowed. */
|
||||
/** Dragging of action objects is allowed. */
|
||||
void PythonConsole::dragMoveEvent( QDragMoveEvent *e )
|
||||
{
|
||||
const QMimeData* mimeData = e->mimeData();
|
||||
@@ -1010,7 +1010,7 @@ void PythonConsole::dragMoveEvent( QDragMoveEvent *e )
|
||||
QPlainTextEdit::dragMoveEvent(e);
|
||||
}
|
||||
|
||||
/** Dragging of action objects is allowed. */
|
||||
/** Dragging of action objects is allowed. */
|
||||
void PythonConsole::dragEnterEvent (QDragEnterEvent * e)
|
||||
{
|
||||
const QMimeData* mimeData = e->mimeData();
|
||||
@@ -1096,7 +1096,7 @@ QTextCursor PythonConsole::inputBegin(void) const
|
||||
QMimeData * PythonConsole::createMimeDataFromSelection () const
|
||||
{
|
||||
QMimeData* mime = new QMimeData();
|
||||
|
||||
|
||||
switch (d->type) {
|
||||
case PythonConsoleP::Normal:
|
||||
{
|
||||
@@ -1138,9 +1138,9 @@ void PythonConsole::runSourceFromMimeData(const QString& source)
|
||||
// When inserting a big text block we must break it down into several command
|
||||
// blocks instead of processing the text block as a whole or each single line.
|
||||
// If we processed the complete block as a whole only the first valid Python
|
||||
// command would be executed and the rest would be ignored. However, if we
|
||||
// processed each line separately the interpreter might be confused that a block
|
||||
// is complete but it might be not. This is for instance, if a class or method
|
||||
// command would be executed and the rest would be ignored. However, if we
|
||||
// processed each line separately the interpreter might be confused that a block
|
||||
// is complete but it might be not. This is for instance, if a class or method
|
||||
// definition contains several empty lines which leads to error messages (almost
|
||||
// indentation errors) later on.
|
||||
QString text = source;
|
||||
@@ -1202,7 +1202,7 @@ void PythonConsole::runSourceFromMimeData(const QString& source)
|
||||
nextline = lines[k];
|
||||
k++;
|
||||
}
|
||||
|
||||
|
||||
int ret = d->interpreter->compileCommand(nextline.toUtf8());
|
||||
|
||||
// If the line is valid, i.e. complete or incomplete the previous block
|
||||
@@ -1486,8 +1486,8 @@ void PythonConsoleHighlighter::highlightBlock(const QString& text)
|
||||
|
||||
void PythonConsoleHighlighter::colorChanged(const QString& type, const QColor& col)
|
||||
{
|
||||
Q_UNUSED(type);
|
||||
Q_UNUSED(col);
|
||||
Q_UNUSED(type);
|
||||
Q_UNUSED(col);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -1517,7 +1517,7 @@ bool ConsoleHistory::more()
|
||||
* While searching the next item, the routine respects the search prefix set by prev().
|
||||
* @return true if the pointer was switched to a later item, false otherwise.
|
||||
*/
|
||||
bool ConsoleHistory::next()
|
||||
bool ConsoleHistory::next()
|
||||
{
|
||||
bool wentNext = false;
|
||||
|
||||
@@ -1550,7 +1550,7 @@ bool ConsoleHistory::prev( const QString &prefix )
|
||||
// store prefix if it's the first history access
|
||||
if (_it == _history.end())
|
||||
{ _prefix = prefix; }
|
||||
|
||||
|
||||
// while we didn't go back or reach history's begin ...
|
||||
while (!wentPrev && _it != _history.begin())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user