Commit c2b81a8b authored by Jan Möbius's avatar Jan Möbius
Browse files

Added sevaral core functions to python interface

parent 447fdc0f
...@@ -387,34 +387,237 @@ PYBIND11_EMBEDDED_MODULE(openflipper, m) { ...@@ -387,34 +387,237 @@ PYBIND11_EMBEDDED_MODULE(openflipper, m) {
core.def("viewerSnapshot", static_cast<void (Core::*)()>(&Core::viewerSnapshot), QCoreApplication::translate("PythonDocCore","Take a snapshot from all viewers").toLatin1().data() ); core.def("viewerSnapshot", static_cast<void (Core::*)()>(&Core::viewerSnapshot), QCoreApplication::translate("PythonDocCore","Take a snapshot from all viewers").toLatin1().data() );
// /// Scriptable snapshot method offering full control // /// Scriptable snapshot method offering full control
// void viewerSnapshot(QString file_name, bool store_comments, // void viewerSnapshot(QString file_name, bool store_comments,
// bool comments_visible_only, bool comments_targeted_only, // bool comments_visible_only, bool comments_targeted_only,
// bool store_material_info, int snapshot_width, int snapshot_height, // bool store_material_info, int snapshot_width, int snapshot_height,
// bool snapshot_transparent, bool hide_coord_sys, // bool snapshot_transparent, bool hide_coord_sys,
// int snapshot_multisampling, bool store_view); // int snapshot_multisampling, bool store_view);
core.def("resizeViewers", &Core::resizeViewers, QCoreApplication::translate("PythonDocCore","Resize the examinerViewer.").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Width").toLatin1().data() ),
py::arg( QCoreApplication::translate("PythonDocCore","Height").toLatin1().data() ) );
core.def("resizeApplication", &Core::resizeApplication, QCoreApplication::translate("PythonDocCore","Resize the whole Application.").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Width").toLatin1().data() ),
py::arg( QCoreApplication::translate("PythonDocCore","Height").toLatin1().data() ) );
core.def("writeVersionNumbers", &Core::writeVersionNumbers, QCoreApplication::translate("PythonDocCore","Write the current versions of all plugins to ini file").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Full path to a file where the versions should be written to.").toLatin1().data() ) );
// /// return the list of available object that has the given selection and type
// QList<int> objectList (QString _selection, QStringList _types);
core.def("blockSceneGraphUpdates", &Core::blockSceneGraphUpdates, QCoreApplication::translate("PythonDocCore","Block the scenegraph updates for improved performance").toLatin1().data() );
core.def("unblockSceneGraphUpdates", &Core::unblockSceneGraphUpdates, QCoreApplication::translate("PythonDocCore","Unblock the scenegraph updates").toLatin1().data() );
core.def("setView", &Core::setView, QCoreApplication::translate("PythonDocCore","Set the encoded view for the primary viewport.").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","The encoded view. (You can obtain one through \"Copy View\" in the context menu of the coordinates.)").toLatin1().data() ) );
core.def("setViewAndWindowGeometry", &Core::setViewAndWindowGeometry, QCoreApplication::translate("PythonDocCore","Set the encoded view for the primary viewport and the full geometry of the application").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","The encoded view. (You can obtain one through \"Copy View\" in the context menu of the coordinates.)").toLatin1().data() ) );
// /** \brief Scripting function to set toolboxes in a view mode
// *
// * @param _modeName Name of the View Mode
// * @param _toolboxList ; separated list of toolboxes in the view mode
// */
// void addViewModeToolboxes(QString _modeName, QString _toolboxList);
// //
// /// resize the examinerViewer // /** \brief Scripting function to set toolbars in a view mode
// void resizeViewers(int _width, int _height ); // *
// * @param _modeName Name of the View Mode
// * @param _toolbarList ; separated list of toolbars in the view mode
// *
// */
// void addViewModeToolbars(QString _modeName, QString _toolbarList);
// //
// /// resize the whole Application // /** \brief Scripting function to set context menus in a view mode
// void resizeApplication(int _width, int _height ); // *
// * @param _modeName Name of the View Mode
// * @param _contextMenuList ; separated list of context menus in the view mode
// */
// void addViewModeContextMenus(QString _modeName, QString _contextMenuList);
// //
// /// write the current versions of all plugins to ini file // /** \brief Scripting function to set an icon for a view mode
// void writeVersionNumbers(QString _filename); // * @param _modeName Name of the View Mode
// * @param _iconName Name of the Icon File. Will be taken from OpenFlippers Icon directory
// */
// void addViewModeIcon(QString _modeName, QString _iconName);
//
// /** \brief Scripting function to set the side of the main window on which the toolbox should be displayed
// *
// * @param _side The desired side (either "left" or "right")
// */
// void setToolBoxSide(QString _side);
//
// /** \brief Scripting function to activate or deactivate a toolbox
// *
// * @param _toolBoxName Name of the toolbox to manipulate
// * @param _active Activate or deactivate
// */
// void setToolBoxActive(QString _toolBoxName, bool _active);
// //
// /// return the list of available object that has the given selection and type
// QList<int> objectList (QString _selection, QStringList _types);
// //
// /// Block the scenegraph updates // /** \brief Load a new Object ( this may also be an ini or ofs file )
// void blockSceneGraphUpdates(); // *
// * This function tries to get the type of data to be loaded from the filename
// * and then load the file.
// *
// * @param _filename Filename of the data
// * @return id of object otherwise -1
// */
// int loadObject ( QString _filename );
// //
// /// Unblock the scenegraph updates // /// Start video capturing
// void unblockSceneGraphUpdates(); // void startVideoCapture(QString _baseName, int _fps, bool _captureViewers);
// //
// void setView(QString view); // /// Stop video capturing
// void setViewAndWindowGeometry(QString view); // void stopVideoCapture();
//
// /** Save object with given id
// * @param _id id of the object
// bool saveObject( int _id, QString _filename );
//
// void saveObject( int _id, QString _filename, int _pluginID );
//
// void saveObjects( IdList _ids, QString _filename, int _pluginID );
//
// /** Show dialog for saving an object to a new location
// * @param _id id of the object
// * @param _filename current filename of the object
// */
// bool saveObjectTo( int _id, QString _filename );
//
// bool saveObjectsTo( IdList _ids, QString _filename );
//
// /// Slot for saving objects from Menu
// void saveAllObjects();
//
// /// Slot for saving objects to a new location
// void saveAllObjectsTo();
//
// /// Save current status to a settings file. Solicit file name through dialog.
// void saveSettings();
//
// /// Save current status to a the provided settings file
// void saveSettings(QString filePath, bool is_saveObjectInfo, bool is_targetOnly, bool is_saveAll,
// bool is_askOverwrite, bool is_saveProgramSettings, bool is_savePluginSettings);
//
// /// Open Load Widget
// void loadObject();
//
// /// Load status from file
// void loadSettings();
//
// /// Load status from file
// void loadSettings(QString _filename);
//
// /// Get object id from filename
// int getObjectId(QString _filename);
//
// /** \brief Serialize material properties
// *
// * @param _objId Id of the object where the material should be deserialized into
// * @param _props A QString containing the serialized material
// */
// void deserializeMaterialProperties(int _objId, QString _props);
//
// /** \brief Serialize material properties
// *
// * @param _objId Id of the object where the material should be serialized
// * @return A Qstring containing the serialized material
// */
// QString serializeMaterialProperties(int _objId);
//
// /// Add a Toolbox from a plugin or from scripting
// void addToolbox(QString _name ,QWidget* _widget);
//
// /// Add a Toolbox from a plugin or from scripting (with icon)
// void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon);
//
// /// Add a Toolbox from a plugin or from scripting (with icon)
// void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon,
// QWidget* _headerAreaWidget);
//
// /**
// * Get a toolbox.
// *
// * @param _pluginName The plugin which the requested toolbox belongs to.
// * @param _toolboxName The name of the requested toolbox.
// * @return A pointer to the requested toolbox widget if it was found, nullptr, otherwise.
// */
// QWidget *getToolbox(QString _pluginName, QString _toolboxName);
//
// void activateToolbox(QString _pluginName, QString _toolboxName, bool activate);
//
//
// /// Save the current options to the standard ini file
// void saveOptions();
core.def("saveOptions", &Core::saveOptions, QCoreApplication::translate("PythonDocCore","Save the current options to the standard ini file").toLatin1().data() );
core.def("applyOptions", &Core::applyOptions, QCoreApplication::translate("PythonDocCore","After ini-files have been loaded and core is up or if options have been changed -> apply Options").toLatin1().data() );
// /** \brief Load information from an ini file
// *
// * This function will open an ini file and load the information in it.
// *
// * @param _filename Name of the ini file
// * @param _coreSettings Load core settings from the file
// * @param _perPluginSettings Load per plugin settings from the file
// * @param _loadObjects Load objects defined in the ini file
// *
// */
// void openIniFile( QString _filename,
// bool _coreSettings ,
// bool _perPluginSettings,
// bool _loadObjects );
//
// /** \brief Create an script object from a ui file
// *
// * This function will load an ui file, set up a qwidget from that and makes it available
// * under _objectName for scripting.
// * @param _objectName The name in scripting environment used for the new object
// * @param _uiFilename ui file to load
// */
// void createWidget(QString _objectName, QString _uiFilename, bool _show = true);
core.def("setViewMode", &Core::setViewMode, QCoreApplication::translate("PythonDocCore","Switch to the given viewmode").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Name of the viewmode to enable").toLatin1().data() ) );
core.def("getCurrentViewMode", &Core::getCurrentViewMode, QCoreApplication::translate("PythonDocCore","Get the name of the current viewMode").toLatin1().data() );
core.def("setViewModeIcon", &Core::setViewModeIcon, QCoreApplication::translate("PythonDocCore","Set an icon for a view Mode").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Name of the mode for the icon").toLatin1().data() ),
py::arg( QCoreApplication::translate("PythonDocCore","Filename of the icon").toLatin1().data() ) );
core.def("moveToolBoxToTop", &Core::moveToolBoxToTop, QCoreApplication::translate("PythonDocCore","Move selected toolbox to the top of side area").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Name of the Toolbox to be moved").toLatin1().data() ) );
core.def("moveToolBoxToBottom", &Core::moveToolBoxToBottom, QCoreApplication::translate("PythonDocCore","Move selected toolbox to the bottom of side area").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Name of the Toolbox to be moved").toLatin1().data() ) );
core.def("showReducedMenuBar", &Core::showReducedMenuBar, QCoreApplication::translate("PythonDocCore","Show only a reduced menubar").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Reduced Menubar?").toLatin1().data() ) );
core.def("executePythonScriptFile", &Core::executePythonScriptFile, QCoreApplication::translate("PythonDocCore","Open the given file and execute its contents as a python script").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Filename of the script").toLatin1().data() ) );
core.def("executePythonScript", &Core::executePythonScript, QCoreApplication::translate("PythonDocCore","Execute a text as a python script").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","The text of the script").toLatin1().data() ) );
core.def("exitApplication", &Core::exitApplication, QCoreApplication::translate("PythonDocCore","Exit the application").toLatin1().data() );
core.def("exitFailure", &Core::exitFailure, QCoreApplication::translate("PythonDocCore","Use this function in unit tests, if you detected a failure. Therefore the test functions will recognize that something went wrong.").toLatin1().data() );
core.def("finishSplash", &Core::finishSplash, QCoreApplication::translate("PythonDocCore","Hide the splash screen").toLatin1().data() );
// emit setSlotDescription("deleteObject(int)", tr("Delete an object from the scene."), QStringList("ObjectId"), QStringList(tr("Id of the object to delete"))); // emit setSlotDescription("deleteObject(int)", tr("Delete an object from the scene."), QStringList("ObjectId"), QStringList(tr("Id of the object to delete")));
...@@ -422,18 +625,8 @@ PYBIND11_EMBEDDED_MODULE(openflipper, m) { ...@@ -422,18 +625,8 @@ PYBIND11_EMBEDDED_MODULE(openflipper, m) {
// //
// emit slotSetSlotDescriptionGlobalFunction("printToFile(QString,QString)", tr("Print a message to a file"), QStringList(QString("Filename;Values").split(";")), QStringList(QString("Filename to print into;Arbitrary number of arguments").split(";"))); // emit slotSetSlotDescriptionGlobalFunction("printToFile(QString,QString)", tr("Print a message to a file"), QStringList(QString("Filename;Values").split(";")), QStringList(QString("Filename to print into;Arbitrary number of arguments").split(";")));
// emit slotSetSlotDescriptionGlobalFunction("help(QString)", tr("Print help about something"), QStringList("Help Entry"), QStringList("help about what?")); // emit slotSetSlotDescriptionGlobalFunction("help(QString)", tr("Print help about something"), QStringList("Help Entry"), QStringList("help about what?"));
//
//
// emit setSlotDescription("exitApplication()", tr("Quit OpenFlipper"), QStringList(), QStringList());
// emit setSlotDescription("resizeViewer(int,int)", tr("Resize the viewer"),
// QString(tr("width,height")).split(","),
// QString(tr("new width for the viewer,new height for the viewer")).split(","));
// emit setSlotDescription("writeVersionNumbers(QString)", tr("write the current versions of all plugins to INI file"),
// QStringList(tr("filename")),
// QStringList(tr("fullpath to a file where the versions should be written to.")));
// //save slots // //save slots
// emit setSlotDescription("saveObject(int,QString)", tr("Save object to file. If the file exists it will be overwritten."), // emit setSlotDescription("saveObject(int,QString)", tr("Save object to file. If the file exists it will be overwritten."),
// QString(tr("object-id,filename")).split(","), // QString(tr("object-id,filename")).split(","),
...@@ -506,8 +699,8 @@ PYBIND11_EMBEDDED_MODULE(openflipper, m) { ...@@ -506,8 +699,8 @@ PYBIND11_EMBEDDED_MODULE(openflipper, m) {
// tr("The plugin which the requested toolbox belongs to.\rThe name of the requested toolbox.").split("\r")); // tr("The plugin which the requested toolbox belongs to.\rThe name of the requested toolbox.").split("\r"));
// //
// emit setSlotDescription("unblockSceneGraphUpdates()", tr("Enable Scenegraph Updates (e.g. before loading or adding a large number of files)"),QStringList(), QStringList());
// emit setSlotDescription("setView", tr("Set the encoded view for the primary viewport."), QStringList(tr("view")), QStringList(tr("The encoded view. (You can obtain one through \"Copy View\" in the context menu of the coordinates.)")));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment