Ejemplo n.º 1
0
 def stop_profiler(self):
     """ Stops profiling.
     """
     end_profiling()
     self.file_position = FilePosition(
         file_name=profiler_module.profile_name)
     self.stop.enabled = False
     self.set_start()
Ejemplo n.º 2
0
 def _selected_changed(self, selected):
     """ Handles the 'selected' trait being changed.
     """
     if isinstance(selected, FileNode):
         self.file_name = self.path = selected.path
         self.file_position = FilePosition(file_name=selected.path)
     elif isinstance(selected, FileSpaceRootNode):
         self.directory = self.path = selected.path
Ejemplo n.º 3
0
    def drop(self, object):
        """ Handles the user dropping a specified object on the feature image.
        """
        # Extract the list of FilePositions to be assigned:
        if isinstance(object, FilePosition):
            file_positions = [object]
        elif isinstance(object, HasPayload):
            file_positions = [FilePosition(file_name=object.payload)]
        elif isinstance(object, basestring):
            file_positions = [FilePosition(file_name=object)]
        else:
            file_positions = [
                FilePosition(file_name=file.absolute_path) for file in object
            ]

        # Assign them using the correct 'drop_style':
        getattr(self, '_drop_' + self.drop_style)(file_positions)
Ejemplo n.º 4
0
 def _selected_changed ( self, selected ):
     """ Handles a path/file being selected.
     """
     if isinstance( selected, PathNode ):
         self.directory = selected.file_name
     else:
         self.file_name     = selected.file_name
         self.file_position = FilePosition( file_name = selected.file_name )
     self.path = selected.file_name
Ejemplo n.º 5
0
 def _selected_changed ( self, record ):
     """ Handles a new log record being selected.
     """
     log_record         = record.log_record
     self.file_position = FilePosition( file_name = log_record.pathname,
                                        line      = log_record.lineno )
     msg = self.formatter.format( log_record )
     col = msg.find( '\n' )
     if col >= 0:
         self.traceback = msg[ col + 1: ]
Ejemplo n.º 6
0
    def _selected_changed(self, selected):
        """ Handles a tree node being selected.
        """
        # Read the object's text to force it to calculate the starting
        # line number of number of lines in the text fragment:
        ignore = selected.text

        # Set the file position for the object:
        self.object_source.file_position = FilePosition(
            name=selected.name,
            file_name=selected.path,
            line=selected.line_number + 1,
            lines=selected.lines,
            object=self.object)
Ejemplo n.º 7
0
    def _object_changed ( self, object ):
        """ Handles a tree node being selected.
        """
        # If the selected object has a starting line number, then set up
        # the file position for the text fragment the object corresponds to:
        if hasattr( object, 'line_number' ):

            # Read the object's text to force it to calculate the starting
            # line number of number of lines in the text fragment:
            ignore = object.text

            # Set the file position for the object:
            self.file_position = FilePosition(
                                     name      = object.name,
                                     file_name = object.path,
                                     line      = object.line_number + 1,
                                     lines     = object.lines )
Ejemplo n.º 8
0
    def _selected_changed(self, stats):
        """ Handles the 'selected' trait being changed.
        """
        if stats is None:
            return

        # Update the view's export information:
        self.owner.stats_position = FilePosition(file_name=stats.file_name,
                                                 line=stats.line)

        # Update the selection history:
        file_name = stats.file_name
        line = stats.line
        for stats2 in self.selected_stats.stats:
            if (file_name == stats2.file_name) and (line == stats2.line):
                break
        else:
            self.selected_stats.stats = \
                (self.selected_stats.stats + [ stats ])[-10:]

        # Provide the detailed 'drill-down' information for the selection:
        self.drill_down(stats)
Ejemplo n.º 9
0
 def _selected_changed(self, selected):
     """ Handles the 'selected' trait being changed.
     """
     self.file_position = FilePosition(file_name=selected.file_name,
                                       name=selected.method_name,
                                       line=selected.line)
Ejemplo n.º 10
0
 def _selected_changed(self, entry):
     """ Handles a new traceback entry being selected.
     """
     self.file_position = FilePosition(file_name=entry.file_name,
                                       line=entry.line)
Ejemplo n.º 11
0
    import ImageResource

from apptools.io.api \
    import File

from etsdevtools.developer.api \
    import HasPayload, FilePosition

from feature_metadata \
    import DropFile

#-------------------------------------------------------------------------------
#  Constants:
#-------------------------------------------------------------------------------

a_file_position = FilePosition()

# Valid 'drop styles' and their corresponding types:
valid_types = (('file_positions', [a_file_position]), ('file_position',
                                                       a_file_position),
               ('file_names', ['\\test']), ('file_name', '\\test'))

# Feature images:
feature_images = (ImageResource('drop_file_feature'),
                  ImageResource('drag_file_feature'))

#-------------------------------------------------------------------------------
#  Defines the 'drop_file' metadata filter:
#-------------------------------------------------------------------------------