def _on_open_project(self, info):
     """ Open and load a project
     """
     app = info.object
     project_dir = self._get_current_project_dir(app.project)
     dir_dialog = DirectoryDialog(action='open', default_path=project_dir,
                                  size=(500,400))
     dir_dialog.open()
     if dir_dialog.path != '':
         try:
             app.load_project(dir_dialog.path)
         except IOError, e:
             pyface.error(parent=info.ui.control, message=e)
Пример #2
0
    def _dialog(self, message="Select Folder",  new_directory=True):
        """Creates a directory dialog box for working with

        @param message Message to display in dialog
        @param new_directory True if allowed to create new directory
        @return A directory to be used for the file operation."""
        from enthought.pyface.api import DirectoryDialog, OK
        # Wildcard pattern to be used in file dialogs.

        if isinstance(self.directory, str):
            dirname = self.directory
        else:
            dirname = os.getcwd()
        dlg = DirectoryDialog(action="open",  default_path=dirname,  message=message,  new_directory=new_directory)
        dlg.open()
        if dlg.return_code == OK:
            self.directory = dlg.path
            return self.directory
        else:
            return None
Пример #3
0
 def change_sphinx_static_path(self, info):
     dialog = DirectoryDialog(action='open', title='Select directory')
     result = dialog.open()
     if result == OK and os.path.exists(dialog.path):
         info.object.sphinx_static_path = dialog.path