Пример #1
0
    def _actions_default ( self ):
        actions = [
            Action( image   = '@icons:wireframe?L31',
                    tooltip = 'Show the complete structure of the item',
                    action  = 'item.show_value()' ),
        ]

        item = self.item
        if source_files_for( item ):
            actions.append(
                Action( image   = '@icons2:Link?H66l11S38|L75',
                        tooltip = 'Show the Python source files for the item',
                        action  = 'item.show_implementation()' ),
            )

        if isinstance( item, HasFacets ):
            actions.append(
                Action( image   = '@icons2:Application_1',
                        tooltip = 'Display the default view for the item',
                        action  = 'item.show_view()' )
            )

        if self.is_object( item ):
            actions.append(
                Action( image   = '@facets:shell_view',
                        tooltip = 'Select the object facets to display',
                        action  = 'item.select_attributes()' )
            )

        return actions
    def execute(self):
        """ Displays the source files used to implement an object.
        """
        if self.options == "":
            raise ValueError("An object must be specified.")

        # Get the implementation source files for the specified object:
        file_names = source_files_for(self.evaluate())
        if file_names is None:
            print "No implementation information available."

            return None

        self.shell.status = "%d source files found." % len(file_names)

        # Return PythonFileItem's for all of the source files found:
        hif = self.shell.history_item_for

        return [hif(PythonFileItem, file_name) for file_name in file_names]