| 769 | } |
| 770 | |
| 771 | bool TaskDialogPython::tryLoadForm() |
| 772 | { |
| 773 | if (dlg.hasAttr(std::string("form"))) { |
| 774 | Py::Object f(dlg.getAttr(std::string("form"))); |
| 775 | Py::List widgets; |
| 776 | if (f.isList()) { |
| 777 | widgets = f; |
| 778 | } |
| 779 | else { |
| 780 | widgets.append(f); |
| 781 | } |
| 782 | |
| 783 | Gui::PythonWrapper wrap; |
| 784 | if (wrap.loadCoreModule()) { |
| 785 | for (Py::List::iterator it = widgets.begin(); it != widgets.end(); ++it) { |
| 786 | QObject* object = wrap.toQObject(*it); |
| 787 | if (object) { |
| 788 | QWidget* form = qobject_cast<QWidget*>(object); |
| 789 | if (form) { |
| 790 | appendForm(form, form->windowIcon().pixmap(32)); |
| 791 | } |
| 792 | } |
| 793 | } |
| 794 | } |
| 795 | |
| 796 | return true; |
| 797 | } |
| 798 | |
| 799 | return false; |
| 800 | } |
| 801 | |
| 802 | void TaskDialogPython::appendForm(QWidget* form, const QPixmap& icon) |
| 803 | { |