File indexing completed on 2024-05-19 05:42:15

0001 from collections import namedtuple
0002 
0003 Param = namedtuple('param', ['type', 'name'])
0004 Function = namedtuple('Function', ['return_type', 'name', 'params', 'docs', 'bind_f'])
0005 HandlerInfo = namedtuple('HandlerInfo', ['name', 'functions'])
0006 
0007 AS_LAMBDA = 'as_lambda'
0008 NO_BINDINGS = 'no_bindings'
0009 
0010 HANDLERS = [
0011     HandlerInfo("PluginSetupHandler", [
0012         Function('void', 'registerPluginData', [Param('std::string const&', 'id'), Param('void*', 'data')],
0013                  'Register a user-defined plugin data structure, that can be retrieved in other hooks.',
0014                  'pyRegisterPluginData<T>'),
0015         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0016                  'Returns the plugin data previously registered with `registerPluginData`.',
0017                  'pyGetPluginData<T>'),
0018         Function('void', 'unregisterPluginData', [Param('std::string const&', 'id')],
0019                  'Unregister a plugin data. Please make sure you delete the data before calling this, or the resource will leak.',
0020                  'pyUnregisterPluginData<T>'),
0021     ]),
0022 
0023     HandlerInfo("PluginContextMenuActionHandler", [
0024         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0025                  'Returns the plugin data previously registered with `registerPluginData`.',
0026                  'pyGetPluginData<T>'),
0027         Function('std::vector<Entity>', 'getAllEntitiesInCurrentView', [],
0028                  'Returns a vector of a wrapper for the entities in the current view. It is not guarantee that such entities will '
0029                  'be available outside the caller hook scope (So it is adviseable that you do not keep references or copies of '
0030                  'such entities).',
0031                  AS_LAMBDA),
0032         Function('std::optional<Entity>', 'getEntityByQualifiedName', [Param('std::string const&', 'qualifiedName')],
0033                  'Returns one instance of a wrapper for one entity in the current view. It is not guarantee that such entities will '
0034                  'be available outside the caller hook scope (So it is adviseable that you do not keep references or copies of '
0035                  'such entities).',
0036                  AS_LAMBDA),
0037         Function('PluginTreeWidgetHandler', 'getTree', [Param('std::string const&', 'id')],
0038                  '',
0039                  AS_LAMBDA),
0040         Function('PluginDockWidgetHandler', 'getDock', [Param('std::string const&', 'id')],
0041                  '',
0042                  AS_LAMBDA),
0043         Function('std::optional<Edge>', 'getEdgeByQualifiedName', [Param('std::string const&', 'fromQualifiedName'), Param('std::string const&', 'toQualifiedName')],
0044                  '',
0045                  AS_LAMBDA),
0046         Function('void', 'loadEntityByQualifiedName', [Param('std::string const&', 'qualifiedName')],
0047                  '',
0048                  AS_LAMBDA),
0049         Function('std::optional<Edge>', 'addEdgeByQualifiedName', [Param('std::string const&', 'fromQualifiedName'), Param('std::string const&', 'toQualifiedName')],
0050                  'Creates a new edge connecting the entities with the respective qualified names. If any of those entities is not '
0051                  'found, will not create the edge. The edge won\'t be persisted.',
0052                  AS_LAMBDA),
0053         Function('void', 'removeEdgeByQualifiedName', [Param('std::string const&', 'fromQualifiedName'), Param('std::string const&', 'toQualifiedName')],
0054                  'Removes an edge connecting the entities with the respective qualified names. If connection or entities are not '
0055                  'found, nothing is done. This action is not persisted.',
0056                  AS_LAMBDA),
0057         Function('bool', 'hasEdgeByQualifiedName', [Param('std::string const&', 'fromQualifiedName'), Param('std::string const&', 'toQualifiedName')],
0058                  'Check if there\'s an edge between the entities with the respective qualified name currently on the scene. '
0059                  'Note that this doesn\'t necessarily mean that they have or they have not an actual dependency, since it could be '
0060                  'a plugin dependency.',
0061                  AS_LAMBDA),
0062         Function('RawDBRows', 'runQueryOnDatabase', [Param('std::string const&', 'query')],
0063                  'Run a query in the active database and return it\'s results',
0064                  AS_LAMBDA),
0065     ]),
0066 
0067     HandlerInfo("PluginTreeItemHandler", [
0068         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0069                  'Returns the plugin data previously registered with `registerPluginData`.',
0070                  'pyGetPluginData<T>'),
0071         Function('PluginTreeItemHandler', 'addChild', [Param('std::string const&', 'label')],
0072                  '',
0073                  AS_LAMBDA),
0074         Function('void', 'addUserData', [Param('std::string const&', 'dataId'), Param('void *', 'userData')],
0075                  '',
0076                  NO_BINDINGS),
0077         Function('void*', 'getUserData', [Param('std::string const&', 'dataId')],
0078                  '',
0079                  NO_BINDINGS),
0080         Function('void', 'addOnClickAction', [Param('std::function<void(PluginTreeItemClickedActionHandler *selectedItem)> const&', 'action')],
0081                  '',
0082                  NO_BINDINGS),
0083     ]),
0084 
0085     HandlerInfo("PluginTreeItemClickedActionHandler", [
0086         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0087                  'Returns the plugin data previously registered with `registerPluginData`.',
0088                  'pyGetPluginData<T>'),
0089         Function('PluginTreeItemHandler', 'getItem', [],
0090                  '',
0091                  NO_BINDINGS),
0092         Function('PluginGraphicsViewHandler', 'getGraphicsView', [],
0093                  '',
0094                  NO_BINDINGS),
0095     ]),
0096 
0097     HandlerInfo("PluginTreeWidgetHandler", [
0098         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0099                  'Returns the plugin data previously registered with `registerPluginData`.',
0100                  'pyGetPluginData<T>'),
0101         Function('PluginTreeItemHandler', 'addRootItem', [Param('std::string const&', 'label')],
0102                  '',
0103                  NO_BINDINGS),
0104         Function('void', 'clear', [],
0105                  '',
0106                  NO_BINDINGS),
0107     ]),
0108 
0109     HandlerInfo("PluginGraphicsViewHandler", [
0110         Function('std::optional<Entity>', 'getEntityByQualifiedName', [Param('std::string const&', 'qualifiedName')],
0111                  '',
0112                  AS_LAMBDA),
0113         Function('std::vector<Entity>', 'getVisibleEntities', [],
0114                  '',
0115                  AS_LAMBDA),
0116         Function('std::optional<Edge>', 'getEdgeByQualifiedName', [Param('std::string const&', 'fromQualifiedName'), Param('std::string const&', 'toQualifiedName')],
0117                  '',
0118                  AS_LAMBDA),
0119     ]),
0120 
0121     HandlerInfo("PluginActiveSceneChangedHandler", [
0122         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0123                  'Returns the plugin data previously registered with `registerPluginData`.',
0124                  'pyGetPluginData<T>'),
0125         Function('std::string', 'getSceneName', [],
0126                  '',
0127                  AS_LAMBDA),
0128     ]),
0129 
0130     HandlerInfo("PluginGraphChangedHandler", [
0131         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0132                  'Returns the plugin data previously registered with `registerPluginData`.',
0133                  'pyGetPluginData<T>'),
0134         Function('std::string', 'getSceneName', [],
0135                  '',
0136                  AS_LAMBDA),
0137         Function('std::vector<Entity>', 'getVisibleEntities', [],
0138                  '',
0139                  AS_LAMBDA),
0140         Function('std::optional<Edge>', 'getEdgeByQualifiedName', [Param('std::string const&', 'fromQualifiedName'), Param('std::string const&', 'toQualifiedName')],
0141                  '',
0142                  AS_LAMBDA),
0143         Function('ProjectData', 'getProjectData', [],
0144                  '',
0145                  AS_LAMBDA),
0146     ]),
0147 
0148     HandlerInfo("PluginContextMenuHandler", [
0149         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0150                  'Returns the plugin data previously registered with `registerPluginData`.',
0151                  'pyGetPluginData<T>'),
0152         Function('std::vector<Entity>', 'getAllEntitiesInCurrentView', [],
0153                  'Returns a vector of a wrapper for the entities in the current view. It is not guarantee that such entities will '
0154                  'be available outside the caller hook scope (So it is adviseable that you do not keep references or copies of '
0155                  'such entities).',
0156                  AS_LAMBDA),
0157         Function('std::optional<Entity>', 'getEntityByQualifiedName', [Param('std::string const&', 'qualifiedName')],
0158                  'Returns one instance of a wrapper for one entity in the current view. It is not guarantee that such entities will '
0159                  'be available outside the caller hook scope (So it is adviseable that you do not keep references or copies of '
0160                  'such entities).',
0161                  AS_LAMBDA),
0162         Function('void', 'registerContextMenu', [Param('std::string const&', 'title'), Param('std::function<void(PluginContextMenuActionHandler *)> const&', 'action')],
0163                  '',
0164                  AS_LAMBDA),
0165         Function('std::optional<Edge>', 'getEdgeByQualifiedName', [Param('std::string const&', 'fromQualifiedName'), Param('std::string const&', 'toQualifiedName')],
0166                  '',
0167                  AS_LAMBDA),
0168     ]),
0169 
0170     HandlerInfo("PluginSetupDockWidgetHandler", [
0171         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0172                  'Returns the plugin data previously registered with `registerPluginData`.',
0173                  'pyGetPluginData<T>'),
0174         Function('PluginDockWidgetHandler', 'createNewDock', [Param('std::string const&', 'dockId'), Param('std::string const&', 'title')],
0175                  'Creates a new dock in the GUI.',
0176                  AS_LAMBDA),
0177     ]),
0178     HandlerInfo("PluginDockWidgetHandler", [
0179         Function('void', 'addDockWdgTextField', [Param('std::string const&', 'title'), Param('std::string&', 'dataModel')],
0180                  'Adds a text field in the dock widget. When the field is changed, the dataModel will be automatically updated. '
0181                  'Make sure to manage the lifetime of the dataModel to ensure it\'s available outside the hook function\'s scope.',
0182                  NO_BINDINGS),
0183         Function('void', 'addTree', [Param('std::string const&', 'treeId')],
0184                  'Create a new tree in the dock widget.',
0185                  AS_LAMBDA),
0186         Function('void', 'setVisible', [Param('bool', 'visible')],
0187                  'Set the dock visibility.',
0188                  AS_LAMBDA),
0189     ]),
0190 
0191     HandlerInfo("PluginEntityReportHandler", [
0192         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0193                  'Returns the plugin data previously registered with `registerPluginData`.',
0194                  'pyGetPluginData<T>'),
0195         Function('Entity', 'getEntity', [],
0196                  'Returns the active entity.',
0197                  AS_LAMBDA),
0198         Function('void', 'addReport', [Param('std::string const&', 'contextMenuTitle'), Param('std::string const&', 'reportTitle'), Param('std::function<void(PluginEntityReportActionHandler *)>', 'action')],
0199                  'Setup and add a new report action in the entity context menu.',
0200                  AS_LAMBDA),
0201     ]),
0202 
0203     HandlerInfo("PluginEntityReportActionHandler", [
0204         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0205                  'Returns the plugin data previously registered with `registerPluginData`.',
0206                  'pyGetPluginData<T>'),
0207         Function('Entity', 'getEntity', [],
0208                  '',
0209                  AS_LAMBDA),
0210         Function('void', 'setReportContents', [Param('std::string const&', 'contentsHTML')],
0211                  'Set the contents of the generated report after the user clicks in the context menu action.',
0212                  AS_LAMBDA),
0213     ]),
0214 
0215     HandlerInfo("PluginPhysicalParserOnHeaderFoundHandler", [
0216         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0217                  'Returns the plugin data previously registered with `registerPluginData`.',
0218                  'pyGetPluginData<T>'),
0219         Function('std::string', 'getSourceFile', [],
0220                  '',
0221                  AS_LAMBDA),
0222         Function('std::string', 'getIncludedFile', [],
0223                  '',
0224                  AS_LAMBDA),
0225         Function('unsigned', 'getLineNo', [],
0226                  '',
0227                  AS_LAMBDA),
0228     ]),
0229 
0230     HandlerInfo("PluginLogicalParserOnCppCommentFoundHandler", [
0231         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0232                  'Returns the plugin data previously registered with `registerPluginData`.',
0233                  'pyGetPluginData<T>'),
0234         Function('std::string', 'getFilename', [],
0235                  '',
0236                  AS_LAMBDA),
0237         Function('std::string', 'getBriefText', [],
0238                  '',
0239                  AS_LAMBDA),
0240         Function('unsigned', 'getStartLine', [],
0241                  '',
0242                  AS_LAMBDA),
0243         Function('unsigned', 'getEndLine', [],
0244                  '',
0245                  AS_LAMBDA),
0246     ]),
0247 
0248     HandlerInfo("PluginParseCompletedHandler", [
0249         Function('void*', 'getPluginData', [Param('std::string const&', 'id')],
0250                  'Returns the plugin data previously registered with `registerPluginData`.',
0251                  'pyGetPluginData<T>'),
0252         Function('RawDBRows', 'runQueryOnDatabase', [Param('std::string const&', 'query')],
0253                  'Run a query in the active database and return it\'s results',
0254                  AS_LAMBDA),
0255     ]),
0256 ]