| 1 |
## Test_Url II, is a PMW version of the orignal Test_url program. It will be used for
|
| 2 |
## Testing Multiple Url's from an input file. It will test each file in the input file,
|
| 3 |
## output them into an output file and also send its output to the main window.
|
| 4 |
#EBorges
|
| 5 |
#09.03.02
|
| 6 |
|
| 7 |
import Pmw, sys, tkFileDialog
|
| 8 |
from Tkinter import LEFT, RIGHT, BOTTOM, TOP, YES, BOTH
|
| 9 |
from Test_URL import url_tester
|
| 10 |
|
| 11 |
def Main():
|
| 12 |
root = Pmw.initialise()
|
| 13 |
group = Pmw.Group(root,tag_text = None)
|
| 14 |
group.pack()
|
| 15 |
inputFile = Pmw.EntryField(group.interior(), labelpos = 'w',label_text = 'Input File: ')
|
| 16 |
outputFile = Pmw.EntryField(group.interior(), labelpos = 'w', label_text = 'Output File:')
|
| 17 |
inBox = Pmw.ButtonBox(group.interior())
|
| 18 |
inBox.add('Browse',command = (lambda Root = root, inputFileObj = inputFile:SetInputFile(Root,inputFileObj)))
|
| 19 |
outBox = Pmw.ButtonBox(group.interior())
|
| 20 |
outBox.add('Browse',command = (lambda Root = root, outputFileObj = outputFile:SetOutputFile(Root,outputFileObj)))
|
| 21 |
outputWin = Pmw.ScrolledText(group.interior(), borderframe = 1, labelpos ='n', label_text = 'Output screen')
|
| 22 |
buttonBox = Pmw.ButtonBox(group.interior())
|
| 23 |
buttonBox.add('Test',command = (lambda inputFileObj=inputFile,outputFileObj=outputFile,outputWinObj = outputWin:RunTest(inputFileObj,outputFileObj,outputWinObj)))
|
| 24 |
buttonBox.add('Clear',command = (lambda inputObj = inputFile, outputObj = outputFile, outputWinObj = outputWin : ClearFields(inputObj,outputObj,outputWinObj)))
|
| 25 |
buttonBox.add('About',command =ShowAbout)
|
| 26 |
buttonBox.pack(side = BOTTOM)
|
| 27 |
outputWin.pack(side = BOTTOM)
|
| 28 |
inputFile.pack(side = LEFT,padx = 10)
|
| 29 |
inBox.pack(side = LEFT,padx = 10)
|
| 30 |
outputFile.pack(side = RIGHT,padx = 10)
|
| 31 |
outBox.pack(side = RIGHT)
|
| 32 |
root.title('URL Tester Upper')
|
| 33 |
root.mainloop()
|
| 34 |
|
| 35 |
def RunTest(inputFileObj,outputFileObj,outputWinObj):
|
| 36 |
results = url_tester(inputFileObj.get(),outputFileObj.get())
|
| 37 |
outputWinObj.settext(results)
|
| 38 |
|
| 39 |
def ClearFields(inputObj,outputObj,outputWinObj):
|
| 40 |
inputObj.clear()
|
| 41 |
outputObj.clear()
|
| 42 |
outputWinObj.clear()
|
| 43 |
|
| 44 |
def SetInputFile(root,inputObj):
|
| 45 |
input_file = tkFileDialog.askopenfilename(parent=root)
|
| 46 |
inputObj.setentry(input_file)
|
| 47 |
|
| 48 |
def SetOutputFile(root,outputObj):
|
| 49 |
output_file = tkFileDialog.askopenfilename(parent = root)
|
| 50 |
outputObj.setentry(output_file)
|
| 51 |
|
| 52 |
def ShowAbout():
|
| 53 |
Pmw.aboutversion('1.0')
|
| 54 |
Pmw.aboutcopyright('Copyright NinoSystems 2002\nAll rights reserved')
|
| 55 |
Pmw.aboutcontact('For information about this application contact:\n' + ' Emanuel Borges\n' + ' email: Eaborges@HotMail.com')
|
| 56 |
about = Pmw.AboutDialog(applicationname = 'URL Tester Upper')
|
| 57 |
about.withdraw()
|
| 58 |
about.show()
|
| 59 |
|
| 60 |
|
| 61 |
if __name__ == "__main__":
|
| 62 |
Main() |