43 #include <pybind11/include/pybind11/pybind11.h> 44 #include <pybind11/include/pybind11/embed.h> 47 #include <DataControlPlugin.hh> 49 #include <OpenFlipper/BasePlugin/PythonFunctions.hh> 50 #include <OpenFlipper/PythonInterpreter/PythonTypeConversions.hh> 56 PYBIND11_EMBEDDED_MODULE(DataControl, m) {
58 QObject* pluginPointer = getPluginPointer(
"DataControl");
61 std::cerr <<
"Error Getting plugin pointer for Plugin-DataControl" << std::endl;
68 std::cerr <<
"Error converting plugin pointer for Plugin-DataControl" << std::endl;
74 py::class_< DataControlPlugin,std::unique_ptr<DataControlPlugin, py::nodelete> > data(m,
"DataControl");
79 data.def(py::init([plugin]() {
return plugin; }));
83 QCoreApplication::translate(
"PythonDocDataControl",
"Returns the name of an object with given id.").toLatin1().data(),
84 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object").toLatin1().data()) );
88 QCoreApplication::translate(
"PythonDocDataControl",
"Delete the given object").toLatin1().data(),
89 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object").toLatin1().data()));
91 data.def(
"copyObject",
static_cast<int (
DataControlPlugin::*)(
int)
>( &DataControlPlugin::copyObject),
92 QCoreApplication::translate(
"PythonDocDataControl",
"Create a copy of an object and return the id of the new object").toLatin1().data(),
93 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object to copy").toLatin1().data()));
96 QCoreApplication::translate(
"PythonDocDataControl",
"Returns the id of an object with given name.").toLatin1().data()),
97 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Name of an object").toLatin1().data());
100 QCoreApplication::translate(
"PythonDocDataControl",
"Returns the DataType of the object with the given id.").toLatin1().data()),
101 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object").toLatin1().data());
104 QCoreApplication::translate(
"PythonDocDataControl",
"Hide object with the given id.").toLatin1().data()),
105 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object").toLatin1().data());
108 QCoreApplication::translate(
"PythonDocDataControl",
"Show object with the given id.").toLatin1().data()),
109 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object").toLatin1().data());
112 QCoreApplication::translate(
"PythonDocDataControl",
"Set given object as target.").toLatin1().data()),
113 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object").toLatin1().data()),
114 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Mark as target?").toLatin1().data());
117 QCoreApplication::translate(
"PythonDocDataControl",
"Set given object as source.").toLatin1().data()),
118 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object").toLatin1().data()),
119 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Mark as target?").toLatin1().data());
122 QCoreApplication::translate(
"PythonDocDataControl",
"Set the name of the given object").toLatin1().data()),
123 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"ID of the object").toLatin1().data()),
124 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"New name").toLatin1().data());
127 QCoreApplication::translate(
"PythonDocDataControl",
"Set All objects as targets").toLatin1().data());
130 QCoreApplication::translate(
"PythonDocDataControl",
"Set All objects as source").toLatin1().data());
134 QCoreApplication::translate(
"PythonDocDataControl",
"Clear targets").toLatin1().data());
137 QCoreApplication::translate(
"PythonDocDataControl",
"Clear sources").toLatin1().data());
140 QCoreApplication::translate(
"PythonDocDataControl",
"Show All objects").toLatin1().data());
143 QCoreApplication::translate(
"PythonDocDataControl",
"Hide all objects").toLatin1().data());
146 QCoreApplication::translate(
"PythonDocDataControl",
"Create new empty group. Returns the id of the new group.").toLatin1().data(),
147 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Name of the new group").toLatin1().data()),
148 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Parent group (Defaults to top level)").toLatin1().data() ) = 0) ;
151 QCoreApplication::translate(
"PythonDocDataControl",
"Group objects together. Return id of the new group or -1 on error").toLatin1().data(),
152 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"List of objects to be added to the group").toLatin1().data()),
153 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Name of the new group").toLatin1().data() ) =
"") ;
156 QCoreApplication::translate(
"PythonDocDataControl",
"Add an Object to an existing group").toLatin1().data(),
157 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Id of an object").toLatin1().data()),
158 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Group id").toLatin1().data() ) ) ;
161 QCoreApplication::translate(
"PythonDocDataControl",
"Remove the given object from its group and move it to the top level").toLatin1().data(),
162 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Id of an Object").toLatin1().data()) ) ;
165 QCoreApplication::translate(
"PythonDocDataControl",
"Returns the IdList of all target objects with given DataType.").toLatin1().data(),
166 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"DataType of the target objects").toLatin1().data()) ) ;
169 QCoreApplication::translate(
"PythonDocDataControl",
"Returns the IdList of all source objects with given DataType.").toLatin1().data(),
170 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"DataType of the target objects").toLatin1().data()) ) ;
173 QCoreApplication::translate(
"PythonDocDataControl",
"Returns the number of groups").toLatin1().data() ) ;
176 QCoreApplication::translate(
"PythonDocDataControl",
"Returns a QStringList of all available DataType names.").toLatin1().data() ) ;
179 QCoreApplication::translate(
"PythonDocDataControl",
"Print information about all open objects to the console").toLatin1().data() ) ;
182 QCoreApplication::translate(
"PythonDocDataControl",
"Get all elements of the given group").toLatin1().data(),
183 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Id of a group").toLatin1().data()) ) ;
186 QCoreApplication::translate(
"PythonDocDataControl",
"Show or hide the extended ui interface in the datacontrol toolbox").toLatin1().data(),
187 py::arg(QCoreApplication::translate(
"PythonDocDataControl",
"Show?").toLatin1().data()) ) ;
void hideAll()
Hides all objects.
void showObject(int objectId)
Show the given Object.
int addEmptyGroup(QString _groupName="", int _parentGroupId=0)
Create new empty group.
void setAllSource()
Makes all available objects source.
void showAll()
Shows all objects.
void setTarget(int objectId, bool _target)
set the given Object as target
QString availableDataTypeNames() const
Returns a list of all available DataTypes.
void printObjectInfoToLog()
Print information about all open objects to the console.
void setAllTarget()
Makes all available objects target.
void setSource(int objectId, bool _source)
set the given Object as source
unsigned int groupCount() const
Returns the number of groups.
void setObjectName(int objectId, QString _name)
set the name of the given object
IdList getSourceObjects(DataType _type)
Get all source objects of given type.
int groupObjects(IdList _objectIDs, QString _groupName="")
Group given Objects together.
void showReducedUi(bool reduced)
Show or hide the extended ui interface in the datacontrol toolbox.
void clearAllSource()
remove source selection from all objects
QString getObjectName(int objectId)
Get the Objects name from the id.
bool addObjectToGroup(int _objectId, int _groupId)
add an object to an existing group
void clearAllTarget()
Unselect all objects.
bool unGroupObject(int _id)
IdList getTargetObjects(DataType _type)
Get all target objects of given type.
int getObject(QString _name)
Get the id of an object by its name.
DataType dataType(int objectId)
Get the DataType of a given object.
void objectDelete(int objectId)
Delete the given object.
void hideObject(int objectId)
Hide the given Object.