コード例 #1
0
 def onNotationEdit(self, evt=None):
     """Edit selected annotation or sequence match."""
     
     # get selected item
     item = self.documentTree.GetSelection()
     itemType = self.documentTree.getItemType(item)
     itemData = self.documentTree.GetPyData(item)
     
     # show dialog
     dlg = dlgNotation(self.parent, itemData, button='Update')
     if dlg.ShowModal() == wx.ID_OK:
         dlg.Destroy()
         
         if itemType == 'annotation':
             self.parent.onDocumentChanged(items=('annotations'))
         elif itemType == 'match':
             self.parent.onDocumentChanged(items=('matches'))
     
     else:
         dlg.Destroy()
コード例 #2
0
 def onAnnotate(self, evt=None):
     """Annotate selected peak."""
     
     # check document and selected peak
     if self.currentDocument == None or self.selectedPeak == None:
         wx.Bell()
         return
     
     # make annotation
     peak = self.currentDocument.spectrum.peaklist[self.selectedPeak]
     annot = doc.annotation(label='', mz=peak.mz, ai=peak.ai, base=peak.base, charge=peak.charge)
     
     # get annotation label
     dlg = dlgNotation(self.parent, annot, button='Add')
     if dlg.ShowModal() == wx.ID_OK:
         dlg.Destroy()
     else:
         dlg.Destroy()
         return
     
     # add annotation
     self.currentDocument.annotations.append(annot)
     self.currentDocument.sortAnnotations()
     self.parent.onDocumentChanged(items=('annotations'))