Commit 5667ce2e authored by root's avatar root

search app

parent 42e1f37d
from PyQt4 import QtGui
import sys
def search_files():
searchstr =search_edit.text()
dict_data = open('dict.json')
dictionary = json.load(dict_data)
files_data = open('filemap.json')
fileList = json.load(files_data)
found = 0
for wordlist in dictionary:
if searchstr == wordlist[0]:
label.setText("%s is found in " % (searchstr))
for match in wordlist[1:]:
label.setText("%s " % (fileList[match]))
found = 1
break
if found == 0:
label.setText( "Unable to find %s" % (searchstr))
dict_data.close()
files_data.close()
#########################
app=QtGui.QApplication(sys.argv)
w=QtGui.QWidget()
w.setWindowTitle("Team 1 SEARCH APP")
hbox1=QtGui.QHBoxLayout()
label=QtGui.Qlabel("Search")
search_edit=QtGui.QLineEdit()
clik_button=QtGui.QPushButton("Clik Here")
clik_button.clicked.connect(search_files)
#icon should be added
hbox1.addWidget(label)
hbox1.addWidget(search_edit)
#button should be added
hbox1.addWidget(clik_button)
w.setlayout(hbox1)
w.show()
sys.exit(app.exec_())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment