/
pythonconsolewindowplugin.cpp
186 lines (127 loc) · 5.62 KB
/
pythonconsolewindowplugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://gnu.org/licenses>.
*******************************************************************************/
//==============================================================================
// Python Console window plugin
//==============================================================================
#include "coreguiutils.h"
#include "pythonconsolewindow.h"
#include "pythonconsolewindowplugin.h"
//==============================================================================
#include <QMainWindow>
//==============================================================================
namespace OpenCOR {
namespace PythonConsoleWindow {
//==============================================================================
PLUGININFO_FUNC PythonConsoleWindowPluginInfo()
{
Descriptions descriptions;
descriptions.insert("en", QString::fromUtf8("a plugin to interact with <a href=\"https://python.org/\">Python</a>."));
descriptions.insert("fr", QString::fromUtf8("une extension pour interagir avec <a href=\"https://python.org/\">Python</a>."));
return new PluginInfo(PluginInfo::Category::Miscellaneous, true, false,
{ "Core", "PythonQtSupport" },
descriptions);
}
//==============================================================================
// I18n interface
//==============================================================================
void PythonConsoleWindowPlugin::retranslateUi()
{
// Retranslate our Python Console window action
retranslateAction(mPythonConsoleWindowAction,
tr("Python Console"),
tr("Show/hide the Python Console window"));
// Retranslate our Python Console window
mPythonConsoleWindowWindow->retranslateUi();
}
//==============================================================================
// Plugin interface
//==============================================================================
bool PythonConsoleWindowPlugin::definesPluginInterfaces()
{
// We don't handle this interface...
return false;
}
//==============================================================================
bool PythonConsoleWindowPlugin::pluginInterfacesOk(const QString &pFileName,
QObject *pInstance)
{
Q_UNUSED(pFileName)
Q_UNUSED(pInstance)
// We don't handle this interface...
return false;
}
//==============================================================================
void PythonConsoleWindowPlugin::initializePlugin()
{
// Create an action to show/hide our Python console window
mPythonConsoleWindowAction = Core::newAction(true, Core::mainWindow());
// Create our Python Console window
mPythonConsoleWindowWindow = new PythonConsoleWindow(Core::mainWindow());
}
//==============================================================================
void PythonConsoleWindowPlugin::finalizePlugin()
{
// Delete our Python Console window
delete mPythonConsoleWindowWindow;
}
//==============================================================================
void PythonConsoleWindowPlugin::pluginsInitialized(const Plugins &pLoadedPlugins)
{
Q_UNUSED(pLoadedPlugins)
// We don't handle this interface...
}
//==============================================================================
void PythonConsoleWindowPlugin::loadSettings(QSettings &pSettings)
{
Q_UNUSED(pSettings)
// We don't handle this interface...
}
//==============================================================================
void PythonConsoleWindowPlugin::saveSettings(QSettings &pSettings) const
{
Q_UNUSED(pSettings)
// We don't handle this interface...
}
//==============================================================================
void PythonConsoleWindowPlugin::handleUrl(const QUrl &pUrl)
{
Q_UNUSED(pUrl)
// We don't handle this interface...
}
//==============================================================================
// Window interface
//==============================================================================
Qt::DockWidgetArea PythonConsoleWindowPlugin::windowDefaultDockArea() const
{
// Return our default dock area
return Qt::RightDockWidgetArea;
}
//==============================================================================
QAction * PythonConsoleWindowPlugin::windowAction() const
{
// Return our Python Console window action
return mPythonConsoleWindowAction;
}
//==============================================================================
QDockWidget * PythonConsoleWindowPlugin::windowWidget() const
{
// Return our Python Console window widget
return mPythonConsoleWindowWindow;
}
//==============================================================================
} // namespace PythonConsoleWindow
} // namespace OpenCOR
//==============================================================================
// End of file
//==============================================================================