PEATDB/DNAtool/evaluate_primer.py
def save_primer_from_edit(self, parent_window=None):
        """Save the primer in the DB when doing a primer Edit"""
        if not parent_window:
            parent_window = self.eval_win

        # Check if the primer name has been changed first, and ask for confirmation of rename

        if self.primername_var.get() != self.edit_primer_name or not self.edit_primer_name:
            import tkMessageBox
            ok = tkMessageBox.askyesno('Primer Name altered',
                                       'Rename primer and save?\n',
                                       parent=parent_window)
            if not ok:
                self.primername_var.set(self.edit_primer_name)
                return
            #rename primer based on value in entry widget
            else:
                new_name=self.primername_var.get()
                if new_name:
                    #only rename if there isn't already a primer with the same name
                    if not self.data['primer_dict'].has_key(new_name):
                        self.data['primer_dict'][new_name]=self.data['primer_dict'][self.edit_primer_name].copy()
                        del self.data['primer_dict'][self.edit_primer_name]
                        self.edit_primer_name = new_name
                        self.i_parent.new_name = new_name
                    #otherwise don't allow rename
                    else:
                        tkMessageBox.showwarning('Primer name already present',
                                     'Primer name already present.\nPlease choose another name',
                                     parent=parent_window)
                        return


        # Update the sequence and description fields for the primer
        DNA=self.eval_var.get()
        # Validation check if primer is changed (maybe by mistake)
        if not DNA:
            ok = tkMessageBox.askyesno('No sequence entered',
                                        'No sequence entered.\nDo you wish to save anyway?',
                                        parent=parent_window)
            if not ok:
                return

        import mutation
        ok,DNA_sequence=mutation.check_DNA(DNA)
        self.data['primer_dict'][self.edit_primer_name]['sequence']=DNA_sequence
        self.data['primer_dict'][self.edit_primer_name]['description']=self.descr_var.get()

        #print 'Primer Info:',self.edit_primer_name,self.data['primer_dict'][self.edit_primer_name]

        # Clear all graphics
        if getattr(self,'pDB',None):
            self.pDB.clear_pDB_objects()

        # Close the window
        self.eval_win.destroy()
        return
Save the primer in the DB when doing a primer Edit
Save the primer in the DB when doing a primer Edit
Save the primer in the DB when doing a primer Edit
def save_primer_from_edit(self, parent_window=None):
        if not parent_window:
            parent_window = self.eval_win
        if self.primername_var.get() != self.edit_primer_name or not self.edit_primer_name:
            import tkMessageBox
            ok = tkMessageBox.askyesno('Primer Name altered',
                                       'Rename primer and save?\n',
                                       parent=parent_window)
            if not ok:
                self.primername_var.set(self.edit_primer_name)
                return
            else:
                new_name=self.primername_var.get()
                if new_name:
                    if not self.data['primer_dict'].has_key(new_name):
                        self.data['primer_dict'][new_name]=self.data['primer_dict'][self.edit_primer_name].copy()
                        del self.data['primer_dict'][self.edit_primer_name]
                        self.edit_primer_name = new_name
                        self.i_parent.new_name = new_name
                    else:
                        tkMessageBox.showwarning('Primer name already present',
                                     'Primer name already present.\nPlease choose another name',
                                     parent=parent_window)
                        return
        DNA=self.eval_var.get()
        if not DNA:
            ok = tkMessageBox.askyesno('No sequence entered',
                                        'No sequence entered.\nDo you wish to save anyway?',
                                        parent=parent_window)
            if not ok:
                return
        import mutation
        ok,DNA_sequence=mutation.check_DNA(DNA)
        self.data['primer_dict'][self.edit_primer_name]['sequence']=DNA_sequence
        self.data['primer_dict'][self.edit_primer_name]['description']=self.descr_var.get()
        if getattr(self,'pDB',None):
            self.pDB.clear_pDB_objects()
        self.eval_win.destroy()
        return
def save_primer_from_edit ( self , parent_window = None ) : if not parent_window : parent_window = self . eval_win if self . primername_var . get ( ) != self . edit_primer_name or not self . edit_primer_name : import tkMessageBox ok = tkMessageBox . askyesno ( 'Primer Name altered' , 'Rename primer and save?\n' , parent = parent_window ) if not ok : self . primername_var . set ( self . edit_primer_name ) return else : new_name = self . primername_var . get ( ) if new_name : if not self . data [ 'primer_dict' ] . has_key ( new_name ) : self . data [ 'primer_dict' ] [ new_name ] = self . data [ 'primer_dict' ] [ self . edit_primer_name ] . copy ( ) del self . data [ 'primer_dict' ] [ self . edit_primer_name ] self . edit_primer_name = new_name self . i_parent . new_name = new_name else : tkMessageBox . showwarning ( 'Primer name already present' , 'Primer name already present.\nPlease choose another name' , parent = parent_window ) return DNA = self . eval_var . get ( ) if not DNA : ok = tkMessageBox . askyesno ( 'No sequence entered' , 'No sequence entered.\nDo you wish to save anyway?' , parent = parent_window ) if not ok : return import mutation ok , DNA_sequence = mutation . check_DNA ( DNA ) self . data [ 'primer_dict' ] [ self . edit_primer_name ] [ 'sequence' ] = DNA_sequence self . data [ 'primer_dict' ] [ self . edit_primer_name ] [ 'description' ] = self . descr_var . get ( ) if getattr ( self , 'pDB' , None ) : self . pDB . clear_pDB_objects ( ) self . eval_win . destroy ( ) return
Save the primer in the DB when doing a primer Edit
Save the primer in the DB when doing a primer Edit
"""Save the primer in the DB when doing a primer Edit""" # Check if the primer name has been changed first, and ask for confirmation of rename #rename primer based on value in entry widget #only rename if there isn't already a primer with the same name #otherwise don't allow rename # Update the sequence and description fields for the primer # Validation check if primer is changed (maybe by mistake) #print 'Primer Info:',self.edit_primer_name,self.data['primer_dict'][self.edit_primer_name] # Clear all graphics # Close the window
self
parent_window