Browse Source

Merge branch 'fix-console-paste'

* fix-console-paste:
  BUG: Fixed console paste bug
Jean-Christophe Fillion-Robin 7 years ago
parent
commit
8c4bed5872

+ 2 - 2
Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp

@@ -371,6 +371,7 @@ QStringList ctkAbstractPythonManager::dir_object(PyObject* object,
   return results;
 }
 
+//----------------------------------------------------------------------------
 QStringList ctkAbstractPythonManager::splitByDotOutsideParenthesis(const QString& pythonVariableName)
 {
   QStringList tmpNames;
@@ -420,7 +421,6 @@ QStringList ctkAbstractPythonManager::splitByDotOutsideParenthesis(const QString
   return tmpNames;
 }
 
-
 //----------------------------------------------------------------------------
 QStringList ctkAbstractPythonManager::pythonAttributes(const QString& pythonVariableName,
                                                        const QString& module,
@@ -459,7 +459,7 @@ QStringList ctkAbstractPythonManager::pythonAttributes(const QString& pythonVari
 //    }
 //  Py_INCREF(object);
 
-  PyObject* main_object = object; // save the modue object (usually __main__ or __main__.__builtins__)
+  PyObject* main_object = object; // save the module object (usually __main__ or __main__.__builtins__)
   QString instantiated_class_name = "_ctkAbstractPythonManager_autocomplete_tmp";
   QStringList results; // the list of attributes to return
   QString line_code="";

+ 0 - 27
Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp

@@ -501,18 +501,6 @@ bool ctkPythonConsolePrivate::push(const QString& code)
   return ret_value;
 }
 
-////----------------------------------------------------------------------------
-//void ctkPythonConsolePrivate::resetInputBuffer()
-//{
-//  if (this->InteractiveConsole)
-//    {
-//    //this->MakeCurrent();
-//    const char* code = "__ctkConsole.resetbuffer()\n";
-//    PyRun_SimpleString(code);
-//    //this->ReleaseControl();
-//    }
-//}
-
 //----------------------------------------------------------------------------
 void ctkPythonConsolePrivate::printWelcomeMessage()
 {
@@ -592,20 +580,6 @@ void ctkPythonConsole::initialize(ctkAbstractPythonManager* newPythonManager)
   this->setDisabled(false);
 }
 
-////----------------------------------------------------------------------------
-//void ctkPythonConsole::executeScript(const QString& script)
-//{
-//  Q_D(ctkPythonConsole);
-//  Q_UNUSED(script);
-
-//  d->printOutputMessage("\n");
-//  emit this->executing(true);
-////   d->Interpreter->RunSimpleString(
-////     script.toLatin1().data());
-//  emit this->executing(false);
-//  d->promptForInput();
-//}
-
 //----------------------------------------------------------------------------
 QString ctkPythonConsole::ps1() const
 {
@@ -650,4 +624,3 @@ void ctkPythonConsole::reset()
 
   this->Superclass::reset();
 }
-

+ 1 - 1
Libs/Widgets/ctkConsole.cpp

@@ -1071,8 +1071,8 @@ void ctkConsolePrivate::pasteText(const QString& text)
     {
     this->switchToUserInputTextColor(&textCursor);
     textCursor.insertText(text);
-    this->updateCommandBuffer();
     }
+  this->updateCommandBuffer();
 }
 
 //-----------------------------------------------------------------------------