_CommandPlugins emits added and removed signals
This commit is contained in:
parent
6163371095
commit
74458520db
@ -257,6 +257,7 @@ _currentPluginPathname = None
|
|||||||
|
|
||||||
def _registerClass(cls):
|
def _registerClass(cls):
|
||||||
_pluginClassesByPathname[_currentPluginPathname].append(cls)
|
_pluginClassesByPathname[_currentPluginPathname].append(cls)
|
||||||
|
log.info("Registered class %s of plugin %s", cls, _currentPluginPathname)
|
||||||
|
|
||||||
|
|
||||||
def _unregisterClass(cls):
|
def _unregisterClass(cls):
|
||||||
@ -265,6 +266,7 @@ def _unregisterClass(cls):
|
|||||||
generate.unregisterGeneratePlugin(cls)
|
generate.unregisterGeneratePlugin(cls)
|
||||||
inspector.unregisterBlockInspectorWidget(cls)
|
inspector.unregisterBlockInspectorWidget(cls)
|
||||||
entities.unregisterTileEntityRefClass(cls)
|
entities.unregisterTileEntityRefClass(cls)
|
||||||
|
command.unregisterPluginCommand(cls)
|
||||||
|
|
||||||
# --- Registration functions ---
|
# --- Registration functions ---
|
||||||
|
|
||||||
|
@ -66,9 +66,16 @@ def registerPluginCommand(cls):
|
|||||||
_registeredCommands.append(cls)
|
_registeredCommands.append(cls)
|
||||||
else:
|
else:
|
||||||
raise ValueError("Class %s must inherit from PluginCommand" % cls)
|
raise ValueError("Class %s must inherit from PluginCommand" % cls)
|
||||||
|
|
||||||
|
_CommandPlugins.instance.pluginAdded.emit(cls)
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
|
|
||||||
|
def unregisterPluginCommand(cls):
|
||||||
|
if issubclass(cls, PluginCommand):
|
||||||
|
_CommandPlugins.instance.pluginRemoved.emit(cls)
|
||||||
|
|
||||||
|
|
||||||
class PluginsMenu(QtGui.QMenu):
|
class PluginsMenu(QtGui.QMenu):
|
||||||
def __init__(self, editorSession):
|
def __init__(self, editorSession):
|
||||||
super(PluginsMenu, self).__init__()
|
super(PluginsMenu, self).__init__()
|
||||||
|
Reference in New Issue
Block a user