1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| # Search functions of the sequence tab
def rechercher(self, event=None):
"""Search window"""
def recherche(direction):
self.subseq = self.dispsubseq.get()
if self.subseq == "":
tkMessageBox.showinfo(self.w_appli.lalangue["warning"],
self.w_appli.lalangue["enterasequence"])
else:
if self.checkcpst.get() == 1:
self.subseq = reverse(complement(self.subseq))
self.trouver(self.subseq, direction)
self.nbfenrech = self.nbfenrech + 1
if self.nbfenrech == 1:
self.fenrech = Toplevel(self)
self.fenrech.protocol("WM_DELETE_WINDOW", self.fermerech)#to have only one instance of search window
self.fenrech.transient(self)
self.fenrech.geometry("+%d+%d" % (self.winfo_rootx()+50, self.winfo_rooty()+50))
self.fenrech.title(self.w_appli.lalangue["find"])
self.dispsubseq = Entry(self.fenrech, width=40)
self.dispsubseq.grid(row=0, column=0, columnspan=2)
self.checkcpst = IntVar()
self.complemstrand = Checkbutton(self.fenrech, text=self.w_appli.lalangue["complementstrand"],
variable=self.checkcpst)
self.complemstrand.grid(row=1, column=0)
self.checkcase = IntVar()
self.casecare = Checkbutton(self.fenrech, text=self.w_appli.lalangue["caseinsensitive"],
variable=self.checkcase)
self.casecare.grid(row=1, column=1)
self.casecare.select()
self.up = Button(self.fenrech, text=self.w_appli.lalangue["previous"],
command=lambda : recherche(1))
self.up.grid(row=2, column=0, sticky=W)
self.down = Button(self.fenrech, text=self.w_appli.lalangue["next"],
command=lambda : recherche(0))
self.down.grid(row=2, column=1, sticky=E)
self.dispsubseq.focus()
else:
self.fenrech.focus() |
Partager