| 272 | using namespace Gui::Dialog; |
| 273 | |
| 274 | PreferencePagePython::PreferencePagePython(const Py::Object& p, QWidget* parent) |
| 275 | : PreferencePage(parent) |
| 276 | , page(p) |
| 277 | { |
| 278 | Base::PyGILStateLocker lock; |
| 279 | Gui::PythonWrapper wrap; |
| 280 | if (wrap.loadCoreModule()) { |
| 281 | |
| 282 | // old style class must have a form attribute while |
| 283 | // new style classes can be the widget itself |
| 284 | Py::Object widget; |
| 285 | if (page.hasAttr(std::string("form"))) { |
| 286 | widget = page.getAttr(std::string("form")); |
| 287 | } |
| 288 | else { |
| 289 | widget = page; |
| 290 | } |
| 291 | |
| 292 | QObject* object = wrap.toQObject(widget); |
| 293 | if (object) { |
| 294 | QWidget* form = qobject_cast<QWidget*>(object); |
| 295 | if (form) { |
| 296 | this->setWindowTitle(form->windowTitle()); |
| 297 | auto layout = new QVBoxLayout; |
| 298 | layout->addWidget(form); |
| 299 | setLayout(layout); |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | PreferencePagePython::~PreferencePagePython() |
| 306 | { |
nothing calls this directly
no test coverage detected