From 81045486fd6b9090be0ec31166c7ad5474272f24 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 14 May 2013 15:20:00 +0200 Subject: [PATCH] 0000826: reading from the python console for using pdb -- code cleanup --- src/Gui/PythonConsole.cpp | 66 ------------------------------------- src/Gui/PythonConsole.h | 23 ------------- src/Gui/PythonConsolePy.cpp | 8 ----- src/Gui/PythonConsolePy.h | 3 -- 4 files changed, 100 deletions(-) diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 8783922fa..a8306d693 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -1417,70 +1417,4 @@ void ConsoleHistory::doScratch( void ) // ----------------------------------------------------- -/* TRANSLATOR Gui::PythonInputField */ - -PythonInputField::PythonInputField(QWidget* parent) - : QWidget(parent) -{ - QGridLayout* gridLayout = new QGridLayout(this); - gridLayout->setSpacing(6); - gridLayout->setMargin(9); - - editField = new PythonEditor(this); - gridLayout->addWidget(editField, 0, 0, 1, 1); - setFocusProxy(editField); - - QHBoxLayout* hboxLayout = new QHBoxLayout(); - hboxLayout->setSpacing(6); - hboxLayout->setMargin(0); - - QSpacerItem* spacerItem = new QSpacerItem(131, 31, QSizePolicy::Expanding, QSizePolicy::Minimum); - hboxLayout->addItem(spacerItem); - - okButton = new QPushButton(this); - hboxLayout->addWidget(okButton); - clearButton = new QPushButton(this); - hboxLayout->addWidget(clearButton); - gridLayout->addLayout(hboxLayout, 1, 0, 1, 1); - - - this->setWindowTitle(Gui::PythonConsole::tr("Python Input Dialog")); - okButton->setText(tr("OK")); - clearButton->setText(tr("Clear")); - - QObject::connect(okButton, SIGNAL(clicked()), this, SIGNAL(textEntered())); - QObject::connect(clearButton, SIGNAL(clicked()), editField, SLOT(clear())); -} - -PythonInputField::~PythonInputField() -{ -} - -QString PythonInputField::getText() const -{ - return editField->toPlainText(); -} - -void PythonInputField::clear() -{ - return editField->clear(); -} - -void PythonInputField::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) { - this->setWindowTitle(Gui::PythonConsole::tr("Python Input Dialog")); - okButton->setText(tr("OK")); - clearButton->setText(tr("Clear")); - } - else { - QWidget::changeEvent(e); - } -} - -void PythonInputField::showEvent(QShowEvent* e) -{ - editField->setFocus(); -} - #include "moc_PythonConsole.cpp" diff --git a/src/Gui/PythonConsole.h b/src/Gui/PythonConsole.h index b949894d9..13efa1f45 100644 --- a/src/Gui/PythonConsole.h +++ b/src/Gui/PythonConsole.h @@ -181,29 +181,6 @@ protected: void colorChanged(const QString& type, const QColor& col); }; -class GuiExport PythonInputField : public QWidget -{ - Q_OBJECT - -public: - PythonInputField(QWidget* parent=0); - ~PythonInputField(); - QString getText() const; - void clear(); - -protected: - void changeEvent(QEvent *e); - void showEvent(QShowEvent* e); - -Q_SIGNALS: - void textEntered(); - -private: - QPushButton* okButton; - QPushButton* clearButton; - QPlainTextEdit* editField; -}; - } // namespace Gui #endif // GUI_PYTHONCONSOLE_H diff --git a/src/Gui/PythonConsolePy.cpp b/src/Gui/PythonConsolePy.cpp index b9fe2a5f0..fe28a0c6f 100644 --- a/src/Gui/PythonConsolePy.cpp +++ b/src/Gui/PythonConsolePy.cpp @@ -292,19 +292,11 @@ void PythonStdin::init_type() PythonStdin::PythonStdin(PythonConsole *pc) : pyConsole(pc) { - editField = new PythonInputField(/*getMainWindow()*/); - timer = new QTimer(); - timer->setInterval(250); - QObject::connect(timer, SIGNAL(timeout()), - editField, SLOT(hide())); console = getMainWindow()->findChild(); } PythonStdin::~PythonStdin() { - // call deleteLater() because deleting immediately causes problems - editField->deleteLater(); - timer->deleteLater(); } Py::Object PythonStdin::repr() diff --git a/src/Gui/PythonConsolePy.h b/src/Gui/PythonConsolePy.h index 63cc34284..b1ad4fcfa 100644 --- a/src/Gui/PythonConsolePy.h +++ b/src/Gui/PythonConsolePy.h @@ -30,7 +30,6 @@ class QTimer; namespace Gui { class PythonConsole; -class PythonInputField; /** * Python class for redirection of stdout to FreeCAD's Python @@ -141,9 +140,7 @@ public: Py::Object readline(const Py::Tuple&); private: - PythonInputField* editField; PythonConsole* console; - QTimer* timer; }; } // namespace Gui