pluginmanager: Create PluginManager to handle plugins and extensions
ClosedPublic

Authored by cfoch on Jun 2 2017, 8:28 PM.

Diff Detail

Repository
rPTV Pitivi
Branch
pluginmanager
cfoch created this revision.Jun 2 2017, 8:28 PM
aleb requested changes to this revision.Jun 29 2017, 6:02 AM
aleb added inline comments.
pitivi/pluginmanager.py
38

add a pydoc about where to get elements for this list?

47

Do we really need this method? :) Better integrate it in __init__, it doesn't even have a pydoc :P

50

This is not used anywhere, and it does not do much. Do you want it?

58
67

This one also does not do much, integrate it in __init__?

74

This can raise an exception! If it's missing, just don't add it as a search path?

83

Strange that we need to call activate/deactivate ourselves.

This revision now requires changes to proceed.Jun 29 2017, 6:02 AM
cfoch updated this revision to Diff 6082.Jul 20 2017, 5:15 PM
cfoch marked 6 inline comments as done.
cfoch edited the summary of this revision. (Show Details)
aleb requested changes to this revision.Jul 21 2017, 1:08 PM
aleb added inline comments.
pitivi/pluginmanager.py
30

newline above, for consistency

38

Add a comment about where to get possible values for this list.

44

comment not useful, can be removed

51

If you want you could make it a plugins @property so it does not start to look like Java code :)

65

why is this needed?

79

Does not really matter, but you can also make it @static since cls is also not used.

This revision now requires changes to proceed.Jul 21 2017, 1:08 PM
cfoch marked 6 inline comments as not done.Jul 23 2017, 4:55 PM
cfoch added inline comments.
pitivi/pluginmanager.py
65

Because that is the callback that gets executed as soon you activate a plugin. In that callback function I call to extension.activate() to execute the plugin's code that activates the plugin. Because it is handling only Peas.Activatable extension types, it makes sense to call only extension.activate(). In the case the plugin implements more interfaces (imagine they have vfuncs do_load, do_open) in that callback I would call extension.load(); extension.open(); extension.activate().

aleb added inline comments.Jul 23 2017, 5:34 PM
pitivi/pluginmanager.py
65

Hm, ok, so an extension is a plugin.
It's surprising that Peas does not activate the plugin itself. Any idea why?
I see the example in https://developer.gnome.org/libpeas/stable/PeasExtensionSet.html#PeasExtensionSet.description is the same..

cfoch added inline comments.Jul 23 2017, 5:39 PM
pitivi/pluginmanager.py
65

Because not all extensions necessarily implement Peas.Activatable. So "activate"/"do_activate" vfunc may not exist.

aleb added inline comments.Jul 23 2017, 5:41 PM
pitivi/pluginmanager.py
65

Ah, yes, I see Peas.Activatable now above. Thanks :)

aleb requested changes to this revision.Aug 14 2017, 3:23 AM
aleb added inline comments.
pitivi/pluginmanager.py
41

nitpick:
The current description does not say much. You could rename it to DEFAULT_LOADERS and add a comment so it's easy to find the possible values:

// For possible values see https://developer.gnome.org/libpeas/stable/PeasEngine.html#peas-engine-enable-loader
This revision now requires changes to proceed.Aug 14 2017, 3:23 AM
aleb accepted this revision.Aug 15 2017, 10:42 PM
This revision is now accepted and ready to land.Aug 15 2017, 10:42 PM
This revision was automatically updated to reflect the committed changes.