Exemplo n.º 1
0
    def populate_panel(self):
        """
        Render the entire Toolkit panel.
        """
        # slight hack here but first ensure that the panel is empty
        photoshop.clear_panel()

        # now add the context item on top of the main panel
        self._add_context_buttons()

        # now enumerate all items and create panel objects for them
        panel_items = []
        for (cmd_name, cmd_details) in self._engine.commands.items():
            panel_items.append(AppCommand(cmd_name, cmd_details))

        self._engine.log_debug("panel_items: %s", panel_items)

        # now go through all of the panel items.
        # separate them out into various sections
        commands_by_app = {}

        for cmd in panel_items:
            if cmd.get_type() == "context_menu":
                # context menu!
                cmd.add_button()
            else:
                # normal menu
                app_name = cmd.get_app_name()
                if app_name is None:
                    # un-parented app
                    app_name = "Other Items"
                if not app_name in commands_by_app:
                    commands_by_app[app_name] = []
                commands_by_app[app_name].append(cmd)

        # now add all apps to main panel
        self._add_app_buttons(commands_by_app)
Exemplo n.º 2
0
    def populate_panel(self):
        """
        Render the entire Toolkit panel.
        """
        # slight hack here but first ensure that the panel is empty
        photoshop.clear_panel()

        # now add the context item on top of the main panel
        self._add_context_buttons()

        # now enumerate all items and create panel objects for them
        panel_items = []
        for (cmd_name, cmd_details) in self._engine.commands.items():
             panel_items.append( AppCommand(cmd_name, cmd_details) )

        self._engine.log_debug("panel_items: %s", panel_items)

        # now go through all of the panel items.
        # separate them out into various sections
        commands_by_app = {}

        for cmd in panel_items:
            if cmd.get_type() == "context_menu":
                # context menu!
                cmd.add_button()
            else:
                # normal menu
                app_name = cmd.get_app_name()
                if app_name is None:
                    # un-parented app
                    app_name = "Other Items"
                if not app_name in commands_by_app:
                    commands_by_app[app_name] = []
                commands_by_app[app_name].append(cmd)

        # now add all apps to main panel
        self._add_app_buttons(commands_by_app)
Exemplo n.º 3
0
 def destroy_panel(self):
     photoshop.clear_panel()
Exemplo n.º 4
0
 def destroy_panel(self):
     photoshop.clear_panel()