Пример #1
0
  def newProject(self):

    if self.project:
      # Project already present
      if not self.closeProject():
        # If we don't close the current project do nothing
        return

    name = askString(title='Project name', prompt='Enter project name:',parent=self)

    if name:
      # Make the API Project object
      project = Implementation.MemopsRoot(name=name)
      nmrProject = Nmr.NmrProject(project, name = project.name)
      self.initProject(project)
Пример #2
0
    def setupProject(self, fileName, projectName):

        self.projectFileName = fileName

        try:
            self.ccpnProject = XmlIO.loadProjectFile(fileName)
            print "Read existing CCPN project..."

        except:
            print "Creating new CCPN project..."

            projectName = returnMemopsWord(projectName)
            self.ccpnMemopsRoot = Implementation.MemopsRoot(name=projectName)
            self.nmrProject = Nmr.NmrProject(self.ccpnProject,
                                             name=self.ccpnProject.name)

            #
            # Set the location...
            #

            (path, file) = splitPath(fileName)
            self.ccpnProject.path = file
            self.ccpnProject.url.path = path

            outputPath = os.path.join(path, projectName)

            try:
                os.stat(outputPath)
            except:
                os.mkdir(outputPath)

            for url in self.ccpnProject.urls:
                if url != self.ccpnProject.url:
                    url.path = outputPath

        # TODO: check name of project: if not same CRASH OUT!

        return self.ccpnProject
Пример #3
0
    #

    if not os.path.exists(projectDir):
        os.mkdir(projectDir)

    projectPath = os.path.join(projectDir, projectName)
    if os.path.exists(projectPath):
        shutil.rmtree(projectPath)

    #
    # Create a CCPN Data Model Project (this is the root object within the
    # Data Model)
    #

    ccpnProject = Implementation.MemopsRoot(name=projectName)
    nmrProject = Nmr.NmrProject(ccpnProject, name=ccpnProject.name)

    #
    # Make sure it saves the information in the projectDir
    # To do this on the Python level you have to reset the path
    # for the urls that indicate the directory locations for the
    # saved files...
    #
    # Alternatively create the project in the right directory to
    # start with - see convertCns2Pdb
    #

    for repository in ccpnProject.repositories:

        if repository.name in ('userData', 'backup'):
Пример #4
0
        while 1:
            self.name = askString('Give the name of the experiment',
                                  'Experiment name:',
                                  initial_value=self.expName,
                                  parent=self.parent)

            if (self.name in names):
                showError('Repeated experiment name',
                          'Name already used - choose another.')
            else:
                break

        self.skip = 0

        return True


if __name__ == '__main__':

    root = Tkinter.Tk()

    from memops.api import Implementation
    from ccp.api.nmr import Nmr
    project = Implementation.MemopsRoot(name='test')
    nmrProject = Nmr.NmrProject(project, name=project.name)

    popup = ExperimentCreatePopup(root, project, numDim=2)

    root.mainloop()