PEATDB/PEATApp.py
def addRecordDialog(self, event=None):
        """Add a new protein to our database"""
        if self.DB == None:
            return
        self.added=False

        def closewin(event=None):
            enterwin.destroy()
            return

        def add():
            self.added = self.addRecord(new_name.get())
            if self.added == False:
                tkMessageBox.showwarning("Key present",
                                         "A record with this key is already in the DB")
            else:
                enterwin.destroy()

            return

        import pdb
        enterwin=Toplevel()
        enterwin.title('Choose data')

        top=self.master.winfo_toplevel()
        rootx=top.winfo_rootx()
        rooty=top.winfo_rooty()
        enterwin.geometry('+%d+%d' %(rootx+100,rooty+100))
        enterwin.transient(self.master)
        enterwin.grab_set()

        row=1
        l=Label(enterwin,text='What type of data will you add?')
        l.grid(row=row,column=0,sticky='news',columnspan=2)
        options=[('DNA sequence','DNA'),
                 ('Protein sequence','Prot'),
                 ('PDB file','PDB'),
                 ('Name only','Name')]
        enter_choice=StringVar()
        enter_choice.set('Name')
        row=row+1
        for text,mod in options:
            b=Radiobutton(enterwin,text=text,variable=enter_choice,value=mod)
            b.grid(row=row,column=0,sticky='w')
            row=row+1

        l=Label(enterwin, text="Enter name")
        l.grid(row=row,column=0, sticky='news')
        new_name=StringVar()
        e=Entry(enterwin,textvariable=new_name)
        e.grid(row=row,column=1,sticky='news')

        row=row+1
        b=Button(enterwin,text='Cancel',command=closewin)
        b.grid(row=row,column=1,sticky='news')
        b2=Button(enterwin,text='Enter',command=add)
        b2.grid(row=row,column=0,sticky='news')

        e.focus_set()
        self.master.wait_window(enterwin)
        if self.added == True:
            self.addRecordAction(new_name.get(), action=enter_choice.get())
        return
Add a new protein to our database
Add a new protein to our database
Add a new protein to our database
def addRecordDialog(self, event=None):
        if self.DB == None:
            return
        self.added=False
        def closewin(event=None):
            enterwin.destroy()
            return
        def add():
            self.added = self.addRecord(new_name.get())
            if self.added == False:
                tkMessageBox.showwarning("Key present",
                                         "A record with this key is already in the DB")
            else:
                enterwin.destroy()
            return
        import pdb
        enterwin=Toplevel()
        enterwin.title('Choose data')
        top=self.master.winfo_toplevel()
        rootx=top.winfo_rootx()
        rooty=top.winfo_rooty()
        enterwin.geometry('+%d+%d' %(rootx+100,rooty+100))
        enterwin.transient(self.master)
        enterwin.grab_set()
        row=1
        l=Label(enterwin,text='What type of data will you add?')
        l.grid(row=row,column=0,sticky='news',columnspan=2)
        options=[('DNA sequence','DNA'),
                 ('Protein sequence','Prot'),
                 ('PDB file','PDB'),
                 ('Name only','Name')]
        enter_choice=StringVar()
        enter_choice.set('Name')
        row=row+1
        for text,mod in options:
            b=Radiobutton(enterwin,text=text,variable=enter_choice,value=mod)
            b.grid(row=row,column=0,sticky='w')
            row=row+1
        l=Label(enterwin, text="Enter name")
        l.grid(row=row,column=0, sticky='news')
        new_name=StringVar()
        e=Entry(enterwin,textvariable=new_name)
        e.grid(row=row,column=1,sticky='news')
        row=row+1
        b=Button(enterwin,text='Cancel',command=closewin)
        b.grid(row=row,column=1,sticky='news')
        b2=Button(enterwin,text='Enter',command=add)
        b2.grid(row=row,column=0,sticky='news')
        e.focus_set()
        self.master.wait_window(enterwin)
        if self.added == True:
            self.addRecordAction(new_name.get(), action=enter_choice.get())
        return
def addRecordDialog ( self , event = None ) : if self . DB == None : return self . added = False def closewin ( event = None ) : enterwin . destroy ( ) return def add ( ) : self . added = self . addRecord ( new_name . get ( ) ) if self . added == False : tkMessageBox . showwarning ( "Key present" , "A record with this key is already in the DB" ) else : enterwin . destroy ( ) return import pdb enterwin = Toplevel ( ) enterwin . title ( 'Choose data' ) top = self . master . winfo_toplevel ( ) rootx = top . winfo_rootx ( ) rooty = top . winfo_rooty ( ) enterwin . geometry ( '+%d+%d' % ( rootx + 100 , rooty + 100 ) ) enterwin . transient ( self . master ) enterwin . grab_set ( ) row = 1 l = Label ( enterwin , text = 'What type of data will you add?' ) l . grid ( row = row , column = 0 , sticky = 'news' , columnspan = 2 ) options = [ ( 'DNA sequence' , 'DNA' ) , ( 'Protein sequence' , 'Prot' ) , ( 'PDB file' , 'PDB' ) , ( 'Name only' , 'Name' ) ] enter_choice = StringVar ( ) enter_choice . set ( 'Name' ) row = row + 1 for text , mod in options : b = Radiobutton ( enterwin , text = text , variable = enter_choice , value = mod ) b . grid ( row = row , column = 0 , sticky = 'w' ) row = row + 1 l = Label ( enterwin , text = "Enter name" ) l . grid ( row = row , column = 0 , sticky = 'news' ) new_name = StringVar ( ) e = Entry ( enterwin , textvariable = new_name ) e . grid ( row = row , column = 1 , sticky = 'news' ) row = row + 1 b = Button ( enterwin , text = 'Cancel' , command = closewin ) b . grid ( row = row , column = 1 , sticky = 'news' ) b2 = Button ( enterwin , text = 'Enter' , command = add ) b2 . grid ( row = row , column = 0 , sticky = 'news' ) e . focus_set ( ) self . master . wait_window ( enterwin ) if self . added == True : self . addRecordAction ( new_name . get ( ) , action = enter_choice . get ( ) ) return
Add a new protein to our database
Add a new protein to our database
"""Add a new protein to our database"""
self
event