mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Support new pluginpreview interfaces (#130)
This commit is contained in:
@@ -190,8 +190,11 @@ namespace mo2::python {
|
||||
m, "IPluginPreview", py::multiple_inheritance())
|
||||
.def(py::init<>())
|
||||
.def("supportedExtensions", &IPluginPreview::supportedExtensions)
|
||||
.def("supportsArchives", &IPluginPreview::supportsArchives)
|
||||
.def("genFilePreview", &IPluginPreview::genFilePreview, "filename"_a,
|
||||
"max_size"_a);
|
||||
"max_size"_a)
|
||||
.def("genDataPreview", &IPluginPreview::genDataPreview, "file_data"_a,
|
||||
"filename"_a, "max_size"_a);
|
||||
|
||||
py::class_<IPluginModPage, PyPluginModPage, IPlugin,
|
||||
std::unique_ptr<IPluginModPage, py::nodelete>>(
|
||||
|
||||
@@ -179,12 +179,24 @@ namespace mo2::python {
|
||||
supportedExtensions, );
|
||||
}
|
||||
|
||||
bool supportsArchives() const override
|
||||
{
|
||||
PYBIND11_OVERRIDE(bool, IPluginPreview, supportsArchives, );
|
||||
}
|
||||
|
||||
QWidget* genFilePreview(const QString& fileName,
|
||||
const QSize& maxSize) const override
|
||||
{
|
||||
PYBIND11_OVERRIDE_PURE(QWidget*, IPluginPreview, genFilePreview, fileName,
|
||||
maxSize);
|
||||
}
|
||||
|
||||
QWidget* genDataPreview(const QByteArray& fileData, const QString& fileName,
|
||||
const QSize& maxSize) const override
|
||||
{
|
||||
PYBIND11_OVERRIDE(QWidget*, IPluginPreview, genDataPreview, fileData,
|
||||
fileName, maxSize);
|
||||
}
|
||||
};
|
||||
|
||||
class PyPluginModPage : public PyPluginBase<IPluginModPage> {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
@@ -41,6 +42,7 @@
|
||||
// the name of the PyQt6 package containing the class, and is only used for
|
||||
// the python signature
|
||||
|
||||
PYQT_CLASS(QtCore, QByteArray);
|
||||
PYQT_CLASS(QtCore, QDateTime);
|
||||
PYQT_CLASS(QtCore, QDir);
|
||||
PYQT_CLASS(QtCore, QFileInfo);
|
||||
|
||||
Reference in New Issue
Block a user