Skip to content

Commit

Permalink
BUG: Fix Python wrapping of ctkVisualizationVTKWidgets and ctkPathLin…
Browse files Browse the repository at this point in the history
…eEdit
  • Loading branch information
lassoan committed Sep 3, 2019
1 parent 2f4beb4 commit f260a9e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
// CTK includes
#include <ctkVTKChartView.h>
#include <ctkVTKScalarsToColorsView.h>
#include <ctkVTKWidgetsUtils.h>

class vtkImageData;

// NOTE:
//
Expand Down Expand Up @@ -123,11 +126,43 @@ public Q_SLOTS:

};

//-----------------------------------------------------------------------------
class PythonQtWrapper_CTKVisualizationVTKWidgets : public QObject
{
Q_OBJECT
QVTK_OBJECT

public Q_SLOTS:

QImage static_ctkVTKWidgetsUtils_grabVTKWidget(QWidget* widget, QRect rectangle = QRect())
{
return ctk::grabVTKWidget(widget, rectangle);
}

QImage static_ctkVTKWidgetsUtils_vtkImageDataToQImage(vtkImageData* imageData)
{
return ctk::vtkImageDataToQImage(imageData);
}


void static_ctkVTKWidgetsUtils_qImageToVTKImageData(const QImage& image, vtkImageData* imageData)
{
ctk::qImageToVTKImageData(image, imageData);
}

};


//-----------------------------------------------------------------------------
/// \ingroup Widgets
void initCTKVisualizationVTKWidgetsPythonQtDecorators()
{
PythonQt::self()->addDecorators(new ctkVisualizationVTKWidgetsPythonQtDecorators);

// PythonQt doesn't support wrapping a static function and adding it to the top-level
// ctk module. This exposes static functions in ctk.ctkVTKWidgetsUtils, for example
// ctk.ctkVTKWidgetsUtils.qImageToVTKImageData.
PythonQt::self()->registerCPPClass("ctkVTKWidgetsUtils", "", "CTKVisualizationVTKWidgets", PythonQtCreateObject<PythonQtWrapper_CTKVisualizationVTKWidgets>);
}

#endif
1 change: 1 addition & 0 deletions Libs/Widgets/ctkPathLineEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class CTK_WIDGETS_EXPORT ctkPathLineEdit: public QWidget
/// changes when the content changes.
/// The default value is AdjustToContentsOnFirstShow.
Q_PROPERTY(SizeAdjustPolicy sizeAdjustPolicy READ sizeAdjustPolicy WRITE setSizeAdjustPolicy)
Q_ENUMS(SizeAdjustPolicy)

/// This property holds the minimum number of characters that should fit into
/// the path line edit.
Expand Down

0 comments on commit f260a9e

Please sign in to comment.