예제 #1
0
    def _initialize_window(self, parent, wxid):
        """ Initialize the window with the specified Id. """

        window = parent.FindWindowById(wxid)
        sizer = wx.BoxSizer(wx.VERTICAL)
        window.SetSizer(sizer)
        window.SetAutoLayout(True)

        window.SetBackgroundColour('white')
        window.SetWindowStyleFlag(wx.CLIP_CHILDREN)
        window.Refresh()
        image = ImageResource('closed_folder_24x24')
        bitmap = image.create_image().ConvertToBitmap()

        image_widget = ImageWidget(window, bitmap=bitmap)
        image_widget.control.SetBackgroundColour('white')
        sizer.Add(image_widget.control, 0, wx.EXPAND)

        text = wx.StaticText(window, -1, "Blah", style=wx.ALIGN_CENTRE)
        sizer.Add(text, 0, wx.EXPAND)

        # Resize the window to match the sizer's minimum size.
        sizer.Fit(window)

        return
예제 #2
0
    def __init__(self, parent, tool_bar, image_cache, item, controller,
                 show_labels):
        """ Creates a new tool bar tool for an action item. """

        self.item = item
        self.tool_bar = tool_bar

        # Create an appropriate tool depending on the style of the action.
        action = self.item.action

        # If the action has an image then convert it to a bitmap (as required
        # by the toolbar).
        if action.image is not None:
            image = action.image.create_image()
            path = action.image.absolute_path
            bmp = image_cache.get_bitmap(path)

        else:
            from enthought.pyface.api import ImageResource
            image = ImageResource('foo')
            bmp = image.create_bitmap()

        self.control_id = 1
        self.control = None
        if controller is not None:
            self.controller = controller
            controller.add_to_toolbar(self)

        return
예제 #3
0
    def image_resource ( self, image_name ):
        """ Returns the ImageResource object for the specified **image_name**.
        """
        # Get the name of the image file:
        volume_name, file_name = split_image_name( image_name )

        if self.is_zip_file:
            # See if we already have the image file cached in the file system:
            cache_file = self._check_cache( file_name )
            if cache_file is None:
                # If not cached, then create a zip file reference:
                ref = ZipFileReference(
                          resource_factory = resource_manager.resource_factory,
                          zip_file         = self.zip_file,
                          path             = self.path,
                          volume_name      = self.name,
                          file_name        = file_name )
            else:
                # Otherwise, create a cache file reference:
                ref = ImageReference( resource_manager.resource_factory,
                                      filename = cache_file )
        else:
            # Otherwise, create a normal file reference:
            ref = ImageReference( resource_manager.resource_factory,
                                  filename = join( self.path, file_name ) )

        # Create the ImageResource object using the reference (note that the
        # ImageResource class will not allow us to specify the reference in the
        # constructor):
        resource = ImageResource( file_name )
        resource._ref = ref

        # Return the ImageResource:
        return resource
예제 #4
0
    def __init__(self, parent, tool_bar, image_cache, item, controller,
                 show_labels):
        """ Creates a new tool bar tool for an action item. """

        self.item = item
        self.tool_bar = tool_bar

        # Create an appropriate tool depending on the style of the action.
        action  = self.item.action

        # If the action has an image then convert it to a bitmap (as required
        # by the toolbar).
        if action.image is not None:
            image = action.image.create_image()
            path = action.image.absolute_path
            bmp  = image_cache.get_bitmap(path)

        else:
            from enthought.pyface.api import ImageResource
            image = ImageResource('foo')
            bmp  = image.create_bitmap()

        self.control_id = 1
        self.control = None
        if controller is not None:
            self.controller = controller
            controller.add_to_toolbar(self)

        return
예제 #5
0
    def _initialize_window(self, parent, wxid):
        """ Initialize the window with the specified Id. """

        window = parent.FindWindowById(wxid)
        sizer = wx.BoxSizer(wx.VERTICAL)
        window.SetSizer(sizer)
        window.SetAutoLayout(True)

        window.SetBackgroundColour('white')
        window.SetWindowStyleFlag(wx.CLIP_CHILDREN)
        window.Refresh()
        image = ImageResource('closed_folder_24x24')
        bitmap = image.create_image().ConvertToBitmap()

        image_widget = ImageWidget(window, bitmap=bitmap)
        image_widget.control.SetBackgroundColour('white')
        sizer.Add(image_widget.control, 0, wx.EXPAND)

        text = wx.StaticText(window, -1, "Blah", style=wx.ALIGN_CENTRE)
        sizer.Add(text, 0, wx.EXPAND)

        # Resize the window to match the sizer's minimum size.
        sizer.Fit(window)

        return
예제 #6
0
파일: file_tree.py 프로젝트: sjl421/code-2
class FileTreeModel(TreeModel):
    """ A tree model for local file systems. """

    # The image used to represent folders that are NOT expanded.
    CLOSED_FOLDER = ImageResource('closed_folder')

    # The image used to represent folders that ARE expanded.
    OPEN_FOLDER = ImageResource('open_folder')

    # The image used to represent documents (ie. NON-'folder') nodes.
    DOCUMENT = ImageResource('document')

    #########################################################################
    # 'TreeModel' interface.
    #########################################################################

    def get_children(self, node):
        """ Returns the children of a node. """

        return [join(node, filename) for filename in listdir(node)]

    def has_children(self, node):
        """ Returns True if a node has children, otherwise False. """

        if isdir(node):
            has_children = len(listdir(node)) > 0

        else:
            has_children = False

        return has_children

    def get_image(self, node, selected, expanded):
        """ Returns the label image for a node. """

        if isdir(node):
            if expanded:
                image = self.OPEN_FOLDER

            else:
                image = self.CLOSED_FOLDER

        else:
            image = self.DOCUMENT

        return image

    def get_text(self, node):
        """ Returns the label text for a node. """

        return basename(node)
예제 #7
0
    def _about_dialog_default(self):
        """ Initialize the About Dialog """

        #from vtk import vtkVersion
        #vtk_version = vtkVersion().GetVTKVersion()
        #'VTK version %s' % (vtk_version),
        from cviewer.version import version
        
        adds = ['Connectome Viewer - Version %s' % ( version ),
                '',
                'Copyright © 2009-2011, Ecole Polytechnique Fédérale de Lausanne (EPFL) and',
                'University Hospital Center and University of Lausanne (UNIL-CHUV)',
                '',
                'Author: Stephan Gerhard <em>info [at] connectomics.org</em>',
                'Contributors: <em>see README file</em>',
                '',
                'This program comes with ABSOLUTELY NO WARRANTY',
                'It is licensed under Modified BSD License',
                ]
        
        about_dialog = AboutDialog(
            parent = self.workbench.active_window.control,
            image  = ImageResource('cviewer_about.png',
                                   search_path=self._image_path),
            additions = adds,
        )

        return about_dialog
예제 #8
0
class OpenDataFileAction(Action):
    """ An action that opens a new beam data file """

    #### 'Action' interface ###################################################

    # A longer description of the action.
    description = 'Open a beam data file'

    # The action's name (displayed on menus/tool bar tools etc).
    name = 'Open File'

    # A short description of the action used for tooltip text etc.
    tooltip = 'Open a beam data file'

    image = ImageResource(os.getcwd() + '/radpy/images/open_file.png')

    ###########################################################################
    # 'Action' interface.
    ###########################################################################

    def perform(self, event):
        """ Perform the action. """

        fname = unicode(QFileDialog.getOpenFileName(self.window.control,
            "Choose Scan", USERHOME,
            "RadPy Files (*.dcm *.rfb *.xml)" + \
            ";;Dicom Files (*.dcm);;RFB Files (*.rfb);;XML Files (*.xml)"))

        if fname:

            self.window.active_view.control.load(fname)
예제 #9
0
class NewPlotAction(Action):
    """ An action that creates a new plot window. """

    #### 'Action' interface ###################################################

    # A longer description of the action.
    description = 'Open a new plot window'

    # The action's name (displayed on menus/tool bar tools etc).
    name = 'New Plot'

    # A short description of the action used for tooltip text etc.
    tooltip = 'Open a new plot window'

    image = ImageResource(os.getcwd() + '/radpy/images/window_new.png')

    ###########################################################################
    # 'Action' interface.
    ###########################################################################

    def perform(self, event):
        """ Perform the action. """

        plot = ChacoPlot()
        self.window.workbench.edit(plot, kind=ChacoPlotEditor)

        return
예제 #10
0
class OpenDirectoryAction(Action):
    """ An action that opens all files in a directory and its subdirectories"""

    #### 'Action' interface ###################################################

    # A longer description of the action.
    description = 'Open all data files in a directory and its subdirectories'

    # The action's name (displayed on menus/tool bar tools etc).
    name = 'Open Directory'

    # A short description of the action used for tooltip text etc.
    tooltip = 'Open all files in a directory'

    image = ImageResource(os.getcwd() + '/radpy/images/open_directory.png')

    ###########################################################################
    # 'Action' interface.
    ###########################################################################

    def perform(self, event):
        """Perform the action. """

        fname = unicode(
            QFileDialog.getExistingDirectory(self.window.control,
                                             "Choose Directory", USERHOME))

        if fname:

            self.window.active_view.control.load(fname)
예제 #11
0
파일: doc_action.py 프로젝트: sjl421/code-2
class DocImageResource(ImageResource):
    """ Implementation of the ImageResource class to be used for the DocAction 
    class.
    Overrides the '_image_not_found' trait in the base ImageResource class.
    """

    _image_not_found = ImageResource('document')
예제 #12
0
    def _about_dialog_default(self):
        """ Trait initializer. """

        about_dialog = AboutDialog(parent=self.workbench.active_window.control,
                                   image=ImageResource('about'))

        return about_dialog
예제 #13
0
파일: adder_node.py 프로젝트: sjl421/code-2
class DocumentedItem(HasTraits):
    """ Container to hold a name and a documentation for an action.
    """

    # Name of the action
    name = Str

    # Button to trigger the action
    add = ToolbarButton('Add',
                        orientation='horizontal',
                        image=ImageResource('add.ico'))

    # Object the action will apply on
    object = Any

    # Two lines documentation for the action
    documentation = Str

    view = View(
        '_',
        Item('add', style='custom', show_label=False),
        Item('documentation',
             style='readonly',
             editor=TextEditor(multi_line=True),
             resizable=True,
             show_label=False),
    )

    def _add_fired(self):
        """ Trait handler for when the add_source button is clicked in
            one of the sub objects in the list.
        """
        action = getattr(self.object.menu_helper, self.id)
        action()
예제 #14
0
파일: action.py 프로젝트: jcrabtree/godot
class NewDotGraphAction(PyFaceAction):
    """ An action for creating a new Dot graph.
    """

    #--------------------------------------------------------------------------
    #  "Action" interface:
    #--------------------------------------------------------------------------

    # A longer description of the action:
    description = "Create a new Dot graph"

    # The action"s name (displayed on menus/tool bar tools etc):
    name = "Graph"

    # A short description of the action used for tooltip text etc:
    tooltip = "Create a Dot graph"

    # The action's image (displayed on tool bar tools etc):
    image = ImageResource("graph", search_path=[IMAGE_LOCATION])

    #--------------------------------------------------------------------------
    #  "Action" interface:
    #--------------------------------------------------------------------------

    def perform(self, event):
        """ Perform the action.
        """
        wizard = NewDotGraphWizard(parent=self.window.control,
                                   window=self.window,
                                   title="New Graph")

        # Open the wizard
        if wizard.open() == OK:
            wizard.finished = True
예제 #15
0
class PyAVLApplication(WorkbenchApplication):
    id = 'pyavl.ui.envisage'
    icon = ImageResource('pyAVL.ico')
    name = 'pyAVL'

    ###########################################################################
    # 'WorkbenchApplication' interface.
    ###########################################################################

    def _about_dialog_default(self):
        """ Trait initializer. """

        about_dialog = AboutDialog(parent=self.workbench.active_window.control,
                                   image=ImageResource('about'))

        return about_dialog

    def _splash_screen_default(self):
        """ Trait initializer. """

        splash_screen = SplashScreen(image=ImageResource('splash'),
                                     show_log_messages=True,
                                     log_level=DEBUG)

        return splash_screen
예제 #16
0
    def _splash_screen_default(self):
        """ Trait initializer. """

        splash_screen = SplashScreen(image=ImageResource('splash'),
                                     show_log_messages=True,
                                     log_level=DEBUG)

        return splash_screen
예제 #17
0
파일: radpy.py 프로젝트: liq07lzucn/radpy
    def _about_dialog_default(self):
        """ Trait initializer. """

        about_dialog = AboutDialog(
            parent = self.workbench.active_window.control,
            image  = ImageResource('about'),
            additions = ['RadPy version: ' + self.version]
        )

        return about_dialog
예제 #18
0
class FileSelection(HasTraits):
    """ Object used to display the results.
    """

    fn = File()
    eeg_filename1 = Str
    long_eeg_filename1 = Str
    remove_f1 = Button("Remove")
    eeg_filename2 = Str
    long_eeg_filename2 = Str
    remove_f2 = Button("Remove")

    etm = Instance(EventTableManager, ())

    def _fn_default(self):
        tmp_fn = "/media/Extern/public"
        if not os.path.exists(tmp_fn):
            tmp_fn = "."
        fn = File(tmp_fn, label="File", desc="Select filename")
        return fn

    traits_view = View(
        Item(
            'fn',
            style='custom',
            show_label=False,
        ),
        Group(
            HGroup(
                Item('eeg_filename1',
                     style="readonly",
                     springy=True,
                     label="Main file:"),
                Item('remove_f1',
                     style="custom",
                     image=ImageResource("images/up.png"),
                     width=-100,
                     resizable=False,
                     show_label=False),
            ),
            HGroup(
                Item('eeg_filename2',
                     style="readonly",
                     springy=True,
                     label="Compare to:"),
                Item('remove_f2',
                     width=-100,
                     resizable=False,
                     show_label=False),
            ),
            label="EEG-files",
        ),
        Item('etm', style="custom", show_label=False),
        handler=FileSelectionHandler(),
    )
예제 #19
0
    def _splash_screen_default(self):
        """ Trait initializer. """
        if preference_manager.root.show_splash_screen:
            splash_screen = SplashScreen(
                image=ImageResource('m2_about.jpg', search_path=[IMG_DIR]),
                show_log_messages=True,
            )
        else:
            splash_screen = None

        return splash_screen
예제 #20
0
 def _actions_default(self):
     actions = [ Group(
                 Action(tooltip="View the Mayavi pipeline",
                     image=ImageResource('m2', 
                             search_path=self.image_search_path),
                     on_perform=self.show_engine,
                     ),
                     ),
                     ]
     actions.extend(DecoratedScene._actions_default(self))
     return actions
예제 #21
0
파일: adder_node.py 프로젝트: sjl421/code-2
 def dialog_view(self):
     """ View shown by double-clicking on the node.  Same as in Base().
     """
     view = self.trait_view()
     view.buttons = []
     view.title = self.label
     view.icon = ImageResource('add.ico')
     view.resizable = True
     view.width = 350
     view.height = 650
     return view
예제 #22
0
class FileTableLabelProvider(TableLabelProvider):
    """ A table label provider for local file systems. """

    # The icon used to represent 'folder' elements.
    FOLDER = ImageResource('closed_folder')

    # The icon used to represent 'document' elements.
    DOCUMENT = ImageResource('document')

    ###########################################################################
    # 'TableLabelProvider' interface.
    ###########################################################################

    def get_image(self, viewer, element, column_index=0):
        """ Returns the filename of the label image for an element. """

        if isdir(element):
            image = self.FOLDER

        else:
            image = self.DOCUMENT

        return image

    def get_text(self, viewer, element, column_index=0):
        """ Returns the label text for an element. """

        details = stat(element)

        if column_index == 0:
            label = basename(element)

        elif column_index == 1:
            label = str(int(details.st_size) / 1000) + ' KB'

        else:
            # Format is: mm/dd/yyyy HH:MM AM eg. '12/31/2004 12:00 PM'
            label = strftime('%m/%d/%Y %I:%M %p', localtime(details.st_mtime))

        return label
예제 #23
0
    def _splash_screen_default(self):
        """ Initialize the Splash Screen """

        if preference_manager.cviewerui.show_splash_screen:
            splash_screen = SplashScreen(
                image = ImageResource('cviewer_about.png',
                                        search_path=self._image_path),
                show_log_messages = True,
            )
        else:
            splash_screen = None

        return splash_screen
예제 #24
0
    def _create_contents(self, parent):
        """ Creates the window contents. """

        actions = []
        for i in range(25):
            actions.append(
                Action(name='Foo',
                       style='radio',
                       image=ImageResource('document')))

        tool_palette = ToolPaletteManager(*actions)

        return tool_palette.create_tool_palette(parent).control
예제 #25
0
class FileTreeLabelProvider(TreeLabelProvider):
    """ A tree label provider for local file systems. """

    # The image used to represent folders that are NOT expanded.
    CLOSED_FOLDER = ImageResource('closed_folder')

    # The image used to represent folders that ARE expanded.
    OPEN_FOLDER = ImageResource('open_folder')

    # The image used to represent documents (ie. NON-'folder') elements.
    DOCUMENT = ImageResource('document')

    ###########################################################################
    # 'TreeLabelProvider' interface.
    ###########################################################################

    def get_image(self, viewer, element):
        """ Returns the filename of the label image for an element. """

        selected = viewer.is_selected(element)
        expanded = viewer.is_expanded(element)

        if isdir(element):
            if expanded:
                image = self.OPEN_FOLDER

            else:
                image = self.CLOSED_FOLDER

        else:
            image = self.DOCUMENT

        return image

    def get_text(self, viewer, element):
        """ Returns the label text for an element. """

        return basename(element)
예제 #26
0
class UserAction(Action):

    #### 'Action' interface ###################################################

    # A longer description of the action.
    description = 'Renormalize a scan to dmax or central axis'

    # The action's name (displayed on menus/tool bar tools etc).
    name = 'Quick Renormalize'

    # A short description of the action used for tooltip text etc.
    tooltip = 'Quick Renormalize'

    # The keyboard accelerator to use (e.g. 'Ctrl+Q')
    # See http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qkeysequence.html
    # for a list of standard shortcuts and a discussion of cross-platform
    # key definitions.
    accelerator = None

    # Image to use for toolbar menu buttons.
    image = ImageResource(os.getcwd() + '/radpy/images/renormalize.png')

    #### BeamAnalysis metadata#################################################

    # The paths in which this action should show up.

    menubar_path = None
    toolbar_path = 'ToolBar/Beam Analysis'

    ###########################################################################
    # 'Action' interface.
    ###########################################################################

    def perform(self, event):
        beam = event.window.active_editor.obj.selected_beam
        x = beam.Data_Abscissa

        scan_type = beam.get_scan_type()
        if scan_type == "Depth Dose":
            beam.Data_Ordinate = \
                100*beam.Data_Ordinate/numpy.max(beam.Data_Ordinate)

        elif scan_type.endswith('Profile'):
            y = beam.Data_Ordinate
            tck = interpolate.splrep(x, y, s=0)
            beam.Data_Ordinate = (100. * beam.Data_Ordinate /
                                  interpolate.splev(0, tck))

        event.window.active_editor.obj.selected_plot.value.set_data(
            beam.Data_Ordinate)
예제 #27
0
class PreferenceManagerView(PreferencesManager):
    """ A preference manager UI for Mayavi, to be used outside of
        Envisage.
    """

    # Path used to search for images
    _image_path = [join(resource_path(), 'images'), ]

    # The icon of the dialog
    icon = ImageResource('preferences.ico', search_path=_image_path)

    # The preference pages displayed
    pages = List(PreferencesPage)

    def _pages_default(self):
        return [
                MayaviRootPreferencesPage(
                    preferences=preference_manager.root.preferences),
                MayaviMlabPreferencesPage(
                    preferences=preference_manager.mlab.preferences),
                ]

    def dialog_view(self):
        """ Poor-man's subclassing of view to overload size.
        """
        view = self.trait_view()
        view.width = 0.7
        view.height = 0.5
        view.title = 'Mayavi preferences'
        view.icon = self.icon
        ui = self.edit_traits(
                view=view,
                scrollable=True,
                id='enthought.mayavi.preferences.preference_view')
        return ui

    def _get_root(self):
        """ Subclass the root getter, to work outside of envisage, with
            no well-defined root.
        """
        root = PreferencesNode(page=self.pages[0])
        for page in self.pages:
            root.append(PreferencesNode(page=page))
        return root

    def apply(self):
        super(PreferenceManagerView, self).apply()
        for page in self.pages:
            page.preferences.save()
예제 #28
0
    def _about_dialog_default(self):
        """ Trait initializer. """
        from enthought.mayavi import api
        from vtk import vtkVersion
        vtk_version = vtkVersion().GetVTKVersion()
        about_dialog = AboutDialog(
            parent=self.workbench.active_window.control,
            image=ImageResource('m2_about.jpg', search_path=[IMG_DIR]),
            additions=[
                'Authors: Prabhu Ramachandran', 'and Gael Varoquaux', '',
                'Mayavi version %s \t - \t VTK version %s' %
                (api.__version__, vtk_version)
            ],
        )

        return about_dialog
예제 #29
0
파일: wizard.py 프로젝트: jcrabtree/godot
class NewDotWizardExtension(WizardExtension):
    """ Contributes a new Dot graph creation wizard.
    """
    # The wizard contribution's globally unique identifier.
    id = "godot.new_dot_wizard"

    # Human readable identifier
    name = "Dot Graph"

    # The wizards's image (displayed on selection etc)
    image = ImageResource("graph", search_path=[IMAGE_LOCATION])

    # The class of contributed wizard
    wizard_class = "godot.plugin.wizard:NewDotGraphWizard"

    # A longer description of the wizard's function
    description = "Create a new Dot graph resource"
예제 #30
0
def _test():
    import doctest, numpy
    from enthought.pyface.api import GUI, ApplicationWindow, SplashScreen, ImageResource
    splash_screen = SplashScreen(image=ImageResource('splash'))
    splash_screen = SplashScreen()
    gui = GUI(splash_screen=splash_screen)
    #doctest.testmod()
    x = numpy.linspace(0, 100)
    y = numpy.linspace(0, 100) + numpy.random.randn(50)
    t = FitFunction(name='general.linear')
    t.configure_traits()
    data = FitData(x=x, y=y)
    #t = DataFitterPanel(data = data, category = 'general', function_name = 'linear')
    t = DataFitter(data=data, function=t)
    #t.fit()
    #t.plotter.savefig('test.png')
    gui.start_event_loop()
    t.configure_traits()
예제 #31
0
파일: adder_node.py 프로젝트: sjl421/code-2
class SceneAdderNode(AdderNode):
    """ Subclass for adding Scene nodes to a Mayavi Engine node.
    """

    # String to be shown in the TreeEditor.
    label = Str('Add a new scene')

    # Button for the View.
    add_scene = Button('Add a new scene', image=ImageResource('add_scene.png'))

    # Trait view to show in the Mayavi current object panel.
    view = View(
        Group(Item('add_scene', show_label=False, style='custom'),
              label='Add a scene'))

    def _add_scene_fired(self):
        """ Trait handler for when the add_scene button is clicked.
        """
        self.object.new_scene()
예제 #32
0
class SaveDataFileAction(Action):
    """ An action that saves the currently selected beam data file """

    #### 'Action' interface ###################################################

    # A longer description of the action.
    description = 'Save a beam data file into BDML format'

    # The action's name (displayed on menus/tool bar tools etc).
    name = 'Save File'

    # A short description of the action used for tooltip text etc.
    tooltip = 'Save a beam data file'

    image = ImageResource(os.getcwd() + '/radpy/images/file_save.png')

    ###########################################################################
    # 'Action' interface.
    ###########################################################################

    def perform(self, event):
        """ Perform the action. """

        widget = self.window.active_view.control
        file_root = widget.model().nodeFromIndex(
            widget.currentIndex()).getFileBranch()
        filename = file_root.filename
        extension = os.path.basename(filename).split('.')[1]
        if extension != 'xml':
            filename = unicode(
                QFileDialog.getSaveFileName(self.window.control,
                                            "Choose Save Filename", USERHOME,
                                            "XML Files *.xml"))

        beam_list = file_root.asRecord()
        progress = QProgressBar()
        progress.setWindowTitle('Saving...')
        progress.setMinimum(0)
        progress.setMaximum(len(beam_list))
        progress.show()
        bdml_export(beam_list, filename, progress)
예제 #33
0
파일: adder_node.py 프로젝트: sjl421/code-2
class SourceAdderNode(ListAdderNode):
    """ Tree node that presents a view to the user to add a scene source.
    """

    # Button for adding a data file, with automatic format checking.
    open_file = ToolbarButton('Load data from file',
                              orientation='horizontal',
                              image=ImageResource('file.png'))

    # A reference to the registry, to generate this list.
    items_list_source = [
        source for source in registry.sources if len(source.extensions) == 0
    ]

    # The string to display on the icon in the TreeEditor.
    label = 'Add Data Source'

    # The icon of the displayed objects
    icon_name = Str('source.ico')

    # Trait view to show in the Mayavi current object panel.
    def default_traits_view(self):
        return View(
            Group(Group(Item('open_file', style='custom'),
                        show_labels=False,
                        show_border=False),
                  Item('items_list',
                       style='readonly',
                       editor=ListEditor(style='custom')),
                  show_labels=False,
                  label='Add a data source'))

    def _open_file_fired(self):
        """ Trait handler for when the open_file button is clicked.
        """
        self.object.menu_helper.open_file_action()

    def _is_action_suitable(self, object, src):
        return True