Skip to content

Commit

Permalink
Python: renamed our PythonQtConsoleWindow plugin to `PythonConsoleW…
Browse files Browse the repository at this point in the history
…indow`.
  • Loading branch information
agarny committed Oct 15, 2019
1 parent 7884231 commit 4667101
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 89 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -894,7 +894,7 @@ if(USE_PREBUILT_QTWEBKIT_PACKAGE)
miscellaneous/Core
miscellaneous/HelpWindow
miscellaneous/JupyterKernel
miscellaneous/PythonQtConsoleWindow
miscellaneous/PythonConsoleWindow
miscellaneous/PythonShell
miscellaneous/WebBrowserWindow

Expand Down
@@ -1,18 +1,18 @@
PROJECT(PythonQtConsoleWindowPlugin)
PROJECT(PythonConsoleWindowPlugin)

# Add the plugin

ADD_PLUGIN(PythonQtConsoleWindow
ADD_PLUGIN(PythonConsoleWindow
SOURCES
../../i18ninterface.cpp
../../plugininfo.cpp
../../plugininterface.cpp
../../windowinterface.cpp

src/pythonqtconsolewindowplugin.cpp
src/pythonqtconsolewindow.cpp
src/pythonconsolewindowplugin.cpp
src/pythonconsolewindow.cpp
UIS
src/pythonqtconsolewindow.ui
src/pythonconsolewindow.ui
PLUGINS
Core
PythonQtSupport
Expand Down
Expand Up @@ -18,28 +18,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// An dockable iPython console window for Qt
// Python Console window
//==============================================================================
// Note: to debug the Python code, use `import pdb; pdb.set_trace()` to set a
// breakpoint and start OpenCOR from the command line...
//==============================================================================

/*
* To debug the Python code, use `import pdb; pdb.set_trace()` to set
* a breakpoint and start OpenCOR from the command line
*/

#include "borderedwidget.h"

//==============================================================================

#include "pythonbegin.h"

#include "pythonqtconsolewindow.h"
#include "pythonconsolewindow.h"
#include "pythonqtsupport.h"

#include "PythonQt/PythonQt.h"

//==============================================================================

#include "ui_pythonqtconsolewindow.h"
#include "ui_pythonconsolewindow.h"

//==============================================================================

Expand All @@ -48,13 +46,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//==============================================================================

namespace OpenCOR {
namespace PythonQtConsoleWindow {
namespace PythonConsoleWindow {

//==============================================================================

// An IPython console

static QString PythonQtConsole = R"PYTHON(
static QString PythonConsole = R"PYTHON(
import logging
import sys
Expand Down Expand Up @@ -117,9 +115,9 @@ def create_ipython_widget():

//==============================================================================

PythonQtConsoleWindow::PythonQtConsoleWindow(QWidget *pParent) :
PythonConsoleWindow::PythonConsoleWindow(QWidget *pParent) :
Core::WindowWidget(pParent),
mGui(new Ui::PythonQtConsoleWindow)
mGui(new Ui::PythonConsoleWindow)
{
// Set up the GUI

Expand All @@ -131,7 +129,7 @@ PythonQtConsoleWindow::PythonQtConsoleWindow(QWidget *pParent) :

// Create a Python module to setup the console

PythonQtObjectPtr qtConsoleModule = pythonQtInstance->createModuleFromScript("opencor.qtconsole", PythonQtConsole);
PythonQtObjectPtr qtConsoleModule = pythonQtInstance->createModuleFromScript("opencor.qtconsole", PythonConsole);
if (qtConsoleModule == nullptr) {
if (PyErr_Occurred()) {
PyErr_Print(); // This goes to stderr; should error be reported as a plugin load error??
Expand All @@ -157,17 +155,17 @@ PythonQtConsoleWindow::PythonQtConsoleWindow(QWidget *pParent) :
return;
}

mPythonQtConsoleWidget = static_cast<QWidget*>(widgetWrapper->_objPointerCopy);
mPythonConsoleWidget = static_cast<QWidget*>(widgetWrapper->_objPointerCopy);

this->setFocusProxy(mPythonQtConsoleWidget);
this->setFocusProxy(mPythonConsoleWidget);

// Add the widget to our window

#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
mGui->layout->addWidget(new Core::BorderedWidget(mPythonQtConsoleWidget,
mGui->layout->addWidget(new Core::BorderedWidget(mPythonConsoleWidget,
true, true, true, true));
#elif defined(Q_OS_MAC)
mGui->layout->addWidget(new Core::BorderedWidget(mPythonQtConsoleWidget,
mGui->layout->addWidget(new Core::BorderedWidget(mPythonConsoleWidget,
true, false, false, false));
#else
#error Unsupported platform
Expand All @@ -176,7 +174,7 @@ PythonQtConsoleWindow::PythonQtConsoleWindow(QWidget *pParent) :

//==============================================================================

PythonQtConsoleWindow::~PythonQtConsoleWindow()
PythonConsoleWindow::~PythonConsoleWindow()
{
// Delete the GUI

Expand All @@ -185,7 +183,7 @@ PythonQtConsoleWindow::~PythonQtConsoleWindow()

//==============================================================================

} // namespace PythonQtConsoleWindow
} // namespace PythonConsoleWindow
} // namespace OpenCOR

//==============================================================================
Expand Down
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// An dockable iPython console window for Qt
// Python Console window
//==============================================================================

#pragma once
Expand All @@ -35,33 +35,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//==============================================================================

namespace Ui {
class PythonQtConsoleWindow;
class PythonConsoleWindow;
}

//==============================================================================

namespace OpenCOR {
namespace PythonQtConsoleWindow {
namespace PythonConsoleWindow {

//==============================================================================

class PythonQtConsoleWindow : public Core::WindowWidget
class PythonConsoleWindow : public Core::WindowWidget
{
Q_OBJECT

public:
explicit PythonQtConsoleWindow(QWidget *pParent);
~PythonQtConsoleWindow();
explicit PythonConsoleWindow(QWidget *pParent);
~PythonConsoleWindow();

private:
Ui::PythonQtConsoleWindow *mGui;
Ui::PythonConsoleWindow *mGui;

QWidget *mPythonQtConsoleWidget;
QWidget *mPythonConsoleWidget;
};

//==============================================================================

} // namespace PythonQtConsoleWindow
} // namespace PythonConsoleWindow
} // namespace OpenCOR

//==============================================================================
Expand Down
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PythonQtConsoleWindow</class>
<widget class="QDockWidget" name="PythonQtConsoleWindow">
<class>PythonConsoleWindow</class>
<widget class="QDockWidget" name="PythonConsoleWindow">
<property name="geometry">
<rect>
<x>0</x>
Expand Down

0 comments on commit 4667101

Please sign in to comment.