ulvis.paste.net

Paste Search Dynamic
Recent pastes
search
  1. class Application(Frame):
  2.     def searchWord(self):
  3.         sw = Search
  4.         word = self.BOX1.get(1.0, 10.0)
  5.         texts = self.BOX2.get(1.0, 10.0)
  6.         word = re.sub("\s*\n\s*", ' ', word.strip())
  7.         self.res = Search.searchAtomWord(word,  texts, self.varOrder.get(), self.varRgister.get(), self.varForm.get())
  8.         #cProfile.run('self.res = Search.searchAtomWord(word,  texts, self.varOrder.get(), self.varRgister.get(), self.varForm.get())', 'search')
  9. #        indx = self.res[0]
  10. #        #self.gg = self.BOX1.get(1.0, 10.0)
  11. #        indx = "1."+str(indx)
  12. #        self.BOX2.insert(indx, 'gggg')
  13.         print (self.res)
  14.         self.gg= self.res
  15.         self.textin.set(self.gg)
  16.        
  17.     def viewStat(self):
  18.         mainW = Toplevel()
  19.        
  20.     def copyBuf(event):
  21.         import win32clipboard
  22.         import win32con
  23.         copydata = event.widget.get()
  24.         win32clipboard.OpenClipboard()
  25.         win32clipboard.EmptyClipboard
  26.         textClip = win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, copydata)
  27.         win32clipboard.CloseClipboard()
  28.  
  29.        
  30.    
  31.     def pasteBuf(event):
  32.         import win32clipboard
  33.         import win32con
  34.         win32clipboard.OpenClipboard()
  35.         textClip = win32clipboard.GetClipboardData()
  36.         win32clipboard.CloseClipboard()
  37.  
  38.         return textClip
  39.  
  40.     def menuWidgets(self, event):
  41.         menu = Menu(self, tearoff=0)
  42.         menu.add_command(label='вставить', command=self.pasteBuf)
  43.         menu.add_command(label='копировать', command=self.copyBuf)
  44.         menu.add_command(label='вырезать', command=root.quit)
  45.         menu.post(event.x_root, event.y_root)
  46.        
  47.          
  48.     def createWidgets(self):
  49.         self.textin =  StringVar()
  50.         self.varOrder = IntVar(self, 2)
  51.         self.varForm = IntVar(self, 1)
  52.         self.varRgister = IntVar(self, 1)
  53.        
  54.         self.Label1 = Label(self)
  55.         self.Label1["text"] = "Поисковой запрос"
  56.         self.Label1.grid(column=0, row=0, columnspan=3, sticky=W)
  57.        
  58.         self.BOX1 = Text(self, width=37, height=2)
  59.         self.BOX1.bind("<Button-3>", self.menuWidgets)
  60.        
  61.         self.BOX1.grid(column=0, row=1, columnspan=3, sticky=E)
  62.        
  63.         self.Label2 = Label(self)
  64.         self.Label2["text"] = "Текст"
  65.         self.Label2.grid(column=0, row=2,columnspan=2, sticky=W)
  66.        
  67.         self.BOX2 = Text(self, width=37, height=10)  
  68.         self.BOX2.bind("<Button-3>", self.menuWidgets)
  69.         self.BOX2.grid(column=0, row=3, columnspan=3, sticky=W)
  70.        
  71.         self.LableRes = Label(self)
  72.         self.LableRes["text"] = "Результаты"
  73.         self.LableRes.grid(column=0, row=4,  sticky=(W))
  74.        
  75.         self.LableRes2 = Label(self, textvariable=self.textin,  relief=GROOVE)
  76.         self.LableRes2.grid(column=2, row=4,  sticky=E)
  77.        
  78.         self.Chek1 = Checkbutton(self, variable = self.varOrder,  onvalue = 1, offvalue=2)
  79.         self.Chek1["text"] = "Слова подряд"
  80.         self.Chek1.grid(column=0, row=5, sticky=(W))
  81.        
  82.         self.Chek2 = Checkbutton(self, variable = self.varForm,  onvalue = 2, offvalue=1)
  83.         self.Chek2["text"] = "Форма слова"
  84.         self.Chek2.grid(column=1, row=5, sticky=(W))
  85.  
  86.         self.Chek3 = Checkbutton(self, variable = self.varRgister,  onvalue = 2, offvalue=1)
  87.         self.Chek3["text"] = "Регистр"
  88.         self.Chek3.grid(column=2, row=5, sticky=(W))
  89.        
  90.         self.hi_there = Button(self)
  91.         self.hi_there["text"] = "Поиск",
  92.         self.hi_there["command"] = self.searchWord
  93.         self.hi_there.grid(column=0, row=8, columnspan=3, sticky=(E, W))
  94.        
  95.         self.statView = Button(self)
  96.         self.statView["text"] = "Статистика"
  97.         self.statView["command"] = self.viewStat
  98.         self.statView.grid(column=0, row=9, columnspan=3, sticky=(E, W))
  99.        
  100.         self.QUIT = Button(self)
  101.         self.QUIT["text"] = "QUIT"
  102.         self.QUIT["fg"] = "blue"
  103.         self.QUIT["command"] = self.quit
  104.         self.QUIT.grid(column=0, row=10, columnspan=3, sticky=(E, W))
  105.        
  106.     def __init__(self, master=None):
  107.         Frame.__init__(self, master)
  108.         #self.size()
  109.         self.grid(column=0, row=0, sticky=(N, W, E, S))
  110.         self.columnconfigure(0, weight=1)
  111.         self.rowconfigure(0, weight=1)
  112. #        for child in self.winfo_children():
  113. #            child.grid_configure(padx=0, pady=0)
  114.         self.pack()
  115.         self.createWidgets()
  116.  
  117.  
  118. root = Tk()
  119. root.title("Поисковая утилита Лекспро")
  120. root.minsize(100,150)
  121. root.maxsize(800,850)
  122. root.geometry()
  123. app = Application(master=root)
  124. app.mainloop()
  125. root.destroy()
Parsed in 0.037 seconds