Пример #1
0
  def selectShiftList(self, shiftListSerial=None):
  
    self.shiftList = None
    
    shiftLists = list(self.ccpnProject.currentNmrProject.findAllMeasurementLists(className='ShiftList'))
    
    if shiftLists:
      if len(shiftLists) == 1:
        self.shiftList = shiftLists[0]
      elif shiftListSerial != None:
        self.shiftList = self.ccpnProject.currentNmrProject.findFirstMeasurementList(className='ShiftList',serial=shiftListSerial)
      
      if not self.shiftList:

        (selectionList,selectionDict) = createSelection(shiftLists)

        interaction = self.multiDialog.SelectionList(

                           self.guiParent,
                           selectionList,
                           selectionDict = selectionDict,
                           title = "Project '%s': " % self.ccpnProject.name + 'Select shift list',
                           text = "Existing shift lists:"
                           )

        if interaction.isSelected:
          self.shiftList = interaction.selection
        
    if not self.shiftList:
      raise self.VascoReferenceCheckError("No shift list available in, or selected from, project - cannot run VASCO without chemical shifts.")
Пример #2
0
  def selectStructureEnsemble(self, structureEnsembleId=None):
    
    self.structureEnsemble = None
    
    if self.ccpnProject.structureEnsembles:
      if len(self.ccpnProject.structureEnsembles) == 1:
        self.structureEnsemble = self.ccpnProject.findFirstStructureEnsemble()
      elif structureEnsembleId != None:
        self.structureEnsemble = self.ccpnProject.findFirstStructureEnsemble(ensembleId=structureEnsembleId)
      
      if not self.structureEnsemble:

        (selectionList,selectionDict) = createSelection(self.ccpnProject.sortedStructureEnsembles())

        interaction = self.multiDialog.SelectionList(

                           self.guiParent,
                           selectionList,
                           selectionDict = selectionDict,
                           title = "Project '%s': " % self.ccpnProject.name + 'Select structure ensemble for coordinates',
                           text = "Existing structure ensembles:"
                           )

        if interaction.isSelected:
          self.structureEnsemble = interaction.selection
        
      
    if not self.structureEnsemble:
      raise self.VascoReferenceCheckError("No structures available in, or selected from, project - cannot run VASCO without coordinates.")
Пример #3
0
    def selectShiftList(self, shiftListSerial=None):

        self.shiftList = None

        shiftLists = list(
            self.ccpnProject.currentNmrProject.findAllMeasurementLists(
                className='ShiftList'))

        if shiftLists:
            if len(shiftLists) == 1:
                self.shiftList = shiftLists[0]
            elif shiftListSerial != None:
                self.shiftList = self.ccpnProject.currentNmrProject.findFirstMeasurementList(
                    className='ShiftList', serial=shiftListSerial)

            if not self.shiftList:

                (selectionList, selectionDict) = createSelection(shiftLists)

                interaction = self.multiDialog.SelectionList(
                    self.guiParent,
                    selectionList,
                    selectionDict=selectionDict,
                    title="Project '%s': " % self.ccpnProject.name +
                    'Select shift list',
                    text="Existing shift lists:")

                if interaction.isSelected:
                    self.shiftList = interaction.selection

        if not self.shiftList:
            raise self.VascoReferenceCheckError(
                "No shift list available in, or selected from, project - cannot run VASCO without chemical shifts."
            )
Пример #4
0
    def selectStructureEnsemble(self, structureEnsembleId=None):

        self.structureEnsemble = None

        if self.ccpnProject.structureEnsembles:
            if len(self.ccpnProject.structureEnsembles) == 1:
                self.structureEnsemble = self.ccpnProject.findFirstStructureEnsemble(
                )
            elif structureEnsembleId != None:
                self.structureEnsemble = self.ccpnProject.findFirstStructureEnsemble(
                    ensembleId=structureEnsembleId)

            if not self.structureEnsemble:

                (selectionList, selectionDict) = createSelection(
                    self.ccpnProject.sortedStructureEnsembles())

                interaction = self.multiDialog.SelectionList(
                    self.guiParent,
                    selectionList,
                    selectionDict=selectionDict,
                    title="Project '%s': " % self.ccpnProject.name +
                    'Select structure ensemble for coordinates',
                    text="Existing structure ensembles:")

                if interaction.isSelected:
                    self.structureEnsemble = interaction.selection

        if not self.structureEnsemble:
            raise self.VascoReferenceCheckError(
                "No structures available in, or selected from, project - cannot run VASCO without coordinates."
            )
Пример #5
0
    def tagCcpnObjectForExternalExec(self, ccpnObject, softwareName):

        tagCcpnObjectForExternalExec(ccpnObject, softwareName,
                                     self.getFileTimeString())

        if self.verbose:
            (selectionList, selectionDict) = createSelection([ccpnObject])
            print "  Tagging %s object %s" % (ccpnObject.className,
                                              selectionList[0])
Пример #6
0
    def selectMolSystem(self, resonanceList=None):

        #
        # If minimalPrompts, just select any available molSystem
        #

        if self.minimalPrompts and len(self.project.molSystems) == 1:
            self.molSystem = self.project.findFirstMolSystem()
        elif not hasattr(self, 'molSystem'):
            self.molSystem = None

        #
        # If resonance info is given, try to determine from to-atom link
        #

        if resonanceList:
            for resonance in resonanceList:
                resonanceSet = resonance.resonanceSet
                if resonanceSet:
                    refAtom = resonanceSet.findFirstAtomSet().findFirstAtom()
                    self.molSystem = refAtom.residue.chain.molSystem
                    break

        #
        # Try to select from list
        #

        if not self.molSystem:

            (selectionList,
             selectionDict) = createSelection(self.project.sortedMolSystems())

            if selectionList:

                while (not self.molSystem):

                    interaction = self.multiDialog.SelectionList(
                        self.guiParent,
                        selectionList,
                        selectionDict=selectionDict,
                        title="Project '%s': " % self.project.name +
                        'Select molecular system',
                        text='Existing molecular system codes:',
                        urlFile='SelectMolSystem')

                    if interaction.isSelected:
                        self.molSystem = interaction.selection

        #
        # If nothing, create new
        #

        if not self.molSystem:

            molSysExists = 1
            molSysCode = 'My_molecular_system'

            while (molSysExists):

                molSysCode = self.dataEntry.askString(
                    "Molecular system name", "Code for new molecular system:",
                    molSysCode, self.guiParent)

                if self.project.findFirstMolSystem(name=molSysCode):
                    self.messageReporter.showError(
                        "Error",
                        "Name for molecular system already exists - select another.",
                        parent=self.guiParent)

                elif ' ' in molSysCode:
                    self.messageReporter.showError(
                        "Error",
                        "Name for molecular system cannot have spaces.",
                        parent=self.guiParent)

                else:
                    molSysExists = 0

            self.molSystem = MolSystem.MolSystem(self.project,
                                                 code=molSysCode,
                                                 name=molSysCode)
Пример #7
0
def setIoInfo(master,setupInfo,project,fileDefs,forceCreation = False, appendNone = False):
  
  (widgetType,IOkeywd,labelText,IOdefault,extraDefs) = setupInfo
  
  label = Label(master, text = labelText)
  widget = None
  selectionDict = None
  
  if widgetType[-5:] == 'Entry':
    
    addKeywds = {}
    if extraDefs and extraDefs.has_key('width'):
      addKeywds['width'] = extraDefs['width']
      
    widget = Entry(master, text='%s' % str(IOdefault),**addKeywds)
    
  elif widgetType == 'CheckButton':
  
    widget = CheckButton(master)
    widget.setSelected(IOdefault)
    
  elif widgetType[:13] == 'SelectionList' or widgetType[:18] == 'MultiSelectionList':

    if IOdefault[:7] == 'project':
       
      ccpnObjects = getCcpnObjects(project,IOdefault)

      (selectionList,selectionDict) = createSelection(ccpnObjects)
      
      if (selectionList or forceCreation) and widgetType[-8:] == 'WithNone':
        if appendNone:
          selectionList.append('None')
        else:
          selectionList.insert(0,'None')
        selectionDict['None'] = None
      
    else:
      selectionList = IOdefault # Should be list!
    
    if selectionList:
      if widgetType[:13] == 'SelectionList':
        widget = PulldownList(master, texts = selectionList)
      elif widgetType[:18] == 'MultiSelectionList':
        widget = ScrolledListbox(master,height = 5,selectmode = Tkinter.MULTIPLE,initial_list = selectionList)

  elif widgetType in ('FileButton','FileMultiButton','DirButton'):
 
    (component,format,selectFile,selectDir) = fileDefs
    fileComponent = None
    
    if extraDefs:
      if extraDefs.has_key('component'):
        fileComponent = extraDefs['component'] # Can't reset component 'cos necessary for handling widget!
      elif extraDefs.has_key('format'):
        format = extraDefs['format']
    
    if widgetType[:4] == 'File':
      if widgetType == 'FileMultiButton':
        multiSelect= True
      else:
        multiSelect = False
      
      widget = Tkinter.Button(master, text = IOdefault, command = lambda comp = component, format = format, buttonKeyword = IOkeywd, defaultText = IOdefault, fileComponent = fileComponent, multiSelect = multiSelect: selectFile(comp,format,buttonKeyword,defaultText,fileComponent,multiSelect = multiSelect))

    elif widgetType == 'DirButton':
      widget = Tkinter.Button(master, text = IOdefault, command = lambda comp = component, format = format, buttonKeyword = IOkeywd: selectDir(comp,format,buttonKeyword))

  return (label,widget,selectionDict)