123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
-
- MENU_ITEM = "&Plugin Manager"
-
-
- class KellerPluginManagerGUI(KellerNukePlugin):
-
- def configurePlugin(self):
- menubar = nuke.menu ('Nuke')
- self.m = menubar.addMenu("Edit")
- self.m.addCommand(MENU_ITEM, 'KellerPluginManagerGUI.showManager();')
-
-
-
- def unconfigurePlugin(self):
- self.m.removeItem(MENU_ITEM)
-
-
-
- MENU_ITEM = "&Plugin Manager"
-
-
-
- MENU_ITEM = "&Plugin Manager"
-
-
-
-
- MENU_ITEM = "&Plugin Manager"
-
-
- try:
-
- class ShapePanel(nukescripts.PythonPanel):
- def __init__(self):
-
-
- nukescripts.PythonPanel.__init__(self, 'Plugin Manager')
-
- self.setMinimumSize(800, 400)
-
- KPM = KellerPluginManager
-
- plugins = KPM.getPlugins()
-
- for plugin in plugins:
-
- k = nuke.PyScript_Knob("Reload")
- k.setLabel("Reload")
- k.setName("Button_" + plugin.getName())
- k.setFlag(nuke.STARTLINE)
- self.addKnob(k)
-
-
-
-
- k = nuke.Boolean_Knob("")
- k.setValue(plugin.getState() == KellerNukePlugin.STATE_ACTIVE)
- k.setName("Checkbox_" + plugin.getName())
- k.setLabel("{0:<30}".format(plugin.getName()))
- k.clearFlag(nuke.STARTLINE)
- #k.setFlag(nuke.STARTLINE)
-
- self.addKnob(k)
-
- k = nuke.String_Knob("Name","")
- k.setValue(plugin.getModule().__file__)
- k.clearFlag(nuke.STARTLINE)
- self.addKnob(k)
-
- #k = nuke.PyScript_Knob("Reload","Reload","reload(\"%s\")"%plugin.getName())
-
-
-
-
-
- #self.addSeparator()
- k = nuke.PyScript_Knob("Reload All")
- k.setLabel("Reload All")
- k.setName("Button_ReloadAll")
- self.addKnob(k)
- k.setFlag(nuke.STARTLINE)
-
- def knobChanged(self, k):
-
- if type(k) == nuke.PyScript_Knob:
-
- if k.name() == "Button_ReloadAll":
- reloadAll()
-
- else:
-
- pluginName = k.name().split("_")[1]
- plugin = KellerPluginManager.getPluginByName(pluginName)
-
- plugin = KellerPluginManager.reloadPlugin(plugin)
-
- kcheck = self.knobs()["Checkbox_%s" % pluginName]
- if kcheck is not None:
- if plugin.getState() == KellerNukePlugin.STATE_ACTIVE:
- kcheck.setValue(1)
- else:
- kcheck.setValue(0)
-
-
-
- if type(k) == nuke.Boolean_Knob:
- pluginName = k.name().split("_")[1]
- stateActive = (k.getValue() == 1)
-
-
- plugin = KellerPluginManager.getPluginByName(pluginName)
-
- if plugin is not None:
-
- if (stateActive) and (plugin.getState() == KellerNukePlugin.STATE_INACTIVE):
- plugin.activate()
- elif (not stateActive) and (plugin.getState() == KellerNukePlugin.STATE_ACTIVE):
- plugin.deactivate()
- except:
- nuke.debug("Cannot initiate PluginManagerGUI")
-
- def reloadAll():
-
- task = nuke.ProgressTask("Reloading...")
-
- plugins = KellerPluginManager.getPlugins()
- i = 0
- for plugin in plugins:
- i = i + 1
- if not task.isCancelled():
- task.setMessage("%s" % plugin.getName())
- KellerPluginManager.reloadPluginByName(plugin.getName())
-
- task.setProgress(int(i * 100 / len(plugins)))
-
- def showManager():
-
- p = ShapePanel()
-
-
- p.show()
-
-
-
-
- #showManager()
|