annotate Tools/webchecker/wcgui.py @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents 1d84bf5f9478
children f6785bce54b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 #! /usr/bin/env python
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 """GUI interface to webchecker.
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
4
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 This works as a Grail applet too! E.g.
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
6
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
7 <APPLET CODE=wcgui.py NAME=CheckerWindow></APPLET>
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
9 Checkpoints are not (yet??? ever???) supported.
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
10
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 User interface:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
12
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 25219
diff changeset
13 Enter a root to check in the text entry box. To enter more than one root,
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
14 enter them one at a time and press <Return> for each one.
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
15
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 25219
diff changeset
16 Command buttons Start, Stop and "Check one" govern the checking process in
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 25219
diff changeset
17 the obvious way. Start and "Check one" also enter the root from the text
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
18 entry box if one is present. There's also a check box (enabled by default)
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
19 to decide whether actually to follow external links (since this can slow
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
20 the checking down considerably). Finally there's a Quit button.
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
21
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 25219
diff changeset
22 A series of checkbuttons determines whether the corresponding output panel
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 25219
diff changeset
23 is shown. List panels are also automatically shown or hidden when their
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
24 status changes between empty to non-empty. There are six panels:
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
25
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 Log -- raw output from the checker (-v, -q affect this)
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
27 To check -- links discovered but not yet checked
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
28 Checked -- links that have been checked
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
29 Bad links -- links that failed upon checking
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
30 Errors -- pages containing at least one bad link
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
31 Details -- details about one URL; double click on a URL in any of
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
32 the above list panels (not in Log) will show details
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
33 for that URL
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
34
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
35 Use your window manager's Close command to quit.
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
36
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 Command line options:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
38
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 -m bytes -- skip HTML pages larger than this size (default %(MAXPAGE)d)
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 -q -- quiet operation (also suppresses external links report)
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 -v -- verbose operation; repeating -v will increase verbosity
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
42 -t root -- specify root dir which should be treated as internal (can repeat)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
43 -a -- don't check name anchors
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
44
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 Command line arguments:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
46
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 rooturl -- URL to start checking
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 (default %(DEFROOT)s)
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
49
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
50 XXX The command line options (-m, -q, -v) should be GUI accessible.
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
51
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
52 XXX The roots should be visible as a list (?).
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
53
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
54 XXX The multipanel user interface is clumsy.
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
55
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
56 """
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
57
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
58 # ' Emacs bait
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
59
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
60
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
61 import sys
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
62 import getopt
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
63 from Tkinter import *
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 import tktools
11482
0680e67a0d49 Changed fron importing wcnew back to webchecker.
Guido van Rossum <guido@python.org>
parents: 11478
diff changeset
65 import webchecker
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
66
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
67 # Override some for a weaker platform
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
68 if sys.platform == 'mac':
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
69 webchecker.DEFROOT = "http://grail.cnri.reston.va.us/"
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
70 webchecker.MAXPAGE = 50000
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
71 webchecker.verbose = 4
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
72
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
73 def main():
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 try:
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
75 opts, args = getopt.getopt(sys.argv[1:], 't:m:qva')
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
76 except getopt.error, msg:
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
77 sys.stdout = sys.stderr
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
78 print msg
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
79 print __doc__%vars(webchecker)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
80 sys.exit(2)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
81 webchecker.verbose = webchecker.VERBOSE
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
82 webchecker.nonames = webchecker.NONAMES
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
83 webchecker.maxpage = webchecker.MAXPAGE
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
84 extra_roots = []
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
85 for o, a in opts:
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
86 if o == '-m':
25219
8a7a2f1f88f0 Apply diff2.txt from SF patch http://www.python.org/sf/572113
Walter Dörwald <walter@livinglogic.de>
parents: 11482
diff changeset
87 webchecker.maxpage = int(a)
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
88 if o == '-q':
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
89 webchecker.verbose = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
90 if o == '-v':
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
91 webchecker.verbose = webchecker.verbose + 1
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
92 if o == '-t':
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
93 extra_roots.append(a)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
94 if o == '-a':
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
95 webchecker.nonames = not webchecker.nonames
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
96 root = Tk(className='Webchecker')
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
97 root.protocol("WM_DELETE_WINDOW", root.quit)
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
98 c = CheckerWindow(root)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
99 c.setflags(verbose=webchecker.verbose, maxpage=webchecker.maxpage,
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
100 nonames=webchecker.nonames)
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
101 if args:
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
102 for arg in args[:-1]:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
103 c.addroot(arg)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
104 c.suggestroot(args[-1])
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
105 # Usually conditioned on whether external links
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
106 # will be checked, but since that's not a command
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
107 # line option, just toss them in.
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
108 for url_root in extra_roots:
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
109 # Make sure it's terminated by a slash,
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
110 # so that addroot doesn't discard the last
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
111 # directory component.
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
112 if url_root[-1] != "/":
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
113 url_root = url_root + "/"
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
114 c.addroot(url_root, add_to_do = 0)
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
115 root.mainloop()
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
116
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
117
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
118 class CheckerWindow(webchecker.Checker):
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
119
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
120 def __init__(self, parent, root=webchecker.DEFROOT):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
121 self.__parent = parent
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
122
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
123 self.__topcontrols = Frame(parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
124 self.__topcontrols.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
125 self.__label = Label(self.__topcontrols, text="Root URL:")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
126 self.__label.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
127 self.__rootentry = Entry(self.__topcontrols, width=60)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
128 self.__rootentry.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
129 self.__rootentry.bind('<Return>', self.enterroot)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
130 self.__rootentry.focus_set()
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
131
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
132 self.__controls = Frame(parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
133 self.__controls.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
134 self.__running = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
135 self.__start = Button(self.__controls, text="Run", command=self.start)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
136 self.__start.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
137 self.__stop = Button(self.__controls, text="Stop", command=self.stop,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
138 state=DISABLED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
139 self.__stop.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
140 self.__step = Button(self.__controls, text="Check one",
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
141 command=self.step)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
142 self.__step.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
143 self.__cv = BooleanVar(parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
144 self.__cv.set(self.checkext)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
145 self.__checkext = Checkbutton(self.__controls, variable=self.__cv,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
146 command=self.update_checkext,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
147 text="Check nonlocal links",)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
148 self.__checkext.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
149 self.__reset = Button(self.__controls, text="Start over", command=self.reset)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
150 self.__reset.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
151 if __name__ == '__main__': # No Quit button under Grail!
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
152 self.__quit = Button(self.__controls, text="Quit",
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
153 command=self.__parent.quit)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
154 self.__quit.pack(side=RIGHT)
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
155
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
156 self.__status = Label(parent, text="Status: initial", anchor=W)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
157 self.__status.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
158 self.__checking = Label(parent, text="Idle", anchor=W)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
159 self.__checking.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
160 self.__mp = mp = MultiPanel(parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
161 sys.stdout = self.__log = LogPanel(mp, "Log")
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
162 self.__todo = ListPanel(mp, "To check", self, self.showinfo)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
163 self.__done = ListPanel(mp, "Checked", self, self.showinfo)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
164 self.__bad = ListPanel(mp, "Bad links", self, self.showinfo)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
165 self.__errors = ListPanel(mp, "Pages w/ bad links", self, self.showinfo)
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
166 self.__details = LogPanel(mp, "Details")
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
167 self.root_seed = None
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
168 webchecker.Checker.__init__(self)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
169 if root:
25219
8a7a2f1f88f0 Apply diff2.txt from SF patch http://www.python.org/sf/572113
Walter Dörwald <walter@livinglogic.de>
parents: 11482
diff changeset
170 root = str(root).strip()
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
171 if root:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
172 self.suggestroot(root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
173 self.newstatus()
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
174
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
175 def reset(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
176 webchecker.Checker.reset(self)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
177 for p in self.__todo, self.__done, self.__bad, self.__errors:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
178 p.clear()
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
179 if self.root_seed:
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
180 self.suggestroot(self.root_seed)
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
181
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
182 def suggestroot(self, root):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
183 self.__rootentry.delete(0, END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
184 self.__rootentry.insert(END, root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
185 self.__rootentry.select_range(0, END)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
186 self.root_seed = root
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
187
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
188 def enterroot(self, event=None):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
189 root = self.__rootentry.get()
25219
8a7a2f1f88f0 Apply diff2.txt from SF patch http://www.python.org/sf/572113
Walter Dörwald <walter@livinglogic.de>
parents: 11482
diff changeset
190 root = root.strip()
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
191 if root:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
192 self.__checking.config(text="Adding root "+root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
193 self.__checking.update_idletasks()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
194 self.addroot(root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
195 self.__checking.config(text="Idle")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
196 try:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
197 i = self.__todo.items.index(root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
198 except (ValueError, IndexError):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
199 pass
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
200 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
201 self.__todo.list.select_clear(0, END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
202 self.__todo.list.select_set(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
203 self.__todo.list.yview(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
204 self.__rootentry.delete(0, END)
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
205
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
206 def start(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
207 self.__start.config(state=DISABLED, relief=SUNKEN)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
208 self.__stop.config(state=NORMAL)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
209 self.__step.config(state=DISABLED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
210 self.enterroot()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
211 self.__running = 1
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
212 self.go()
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
213
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
214 def stop(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
215 self.__stop.config(state=DISABLED, relief=SUNKEN)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
216 self.__running = 0
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
217
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
218 def step(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
219 self.__start.config(state=DISABLED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
220 self.__step.config(state=DISABLED, relief=SUNKEN)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
221 self.enterroot()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
222 self.__running = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
223 self.dosomething()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
224
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
225 def go(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
226 if self.__running:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
227 self.__parent.after_idle(self.dosomething)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
228 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
229 self.__checking.config(text="Idle")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
230 self.__start.config(state=NORMAL, relief=RAISED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
231 self.__stop.config(state=DISABLED, relief=RAISED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
232 self.__step.config(state=NORMAL, relief=RAISED)
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
233
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
234 __busy = 0
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
235
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
236 def dosomething(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
237 if self.__busy: return
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
238 self.__busy = 1
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
239 if self.todo:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
240 l = self.__todo.selectedindices()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
241 if l:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
242 i = l[0]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
243 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
244 i = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
245 self.__todo.list.select_set(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
246 self.__todo.list.yview(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
247 url = self.__todo.items[i]
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
248 self.__checking.config(text="Checking "+self.format_url(url))
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
249 self.__parent.update()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
250 self.dopage(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
251 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
252 self.stop()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
253 self.__busy = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
254 self.go()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
255
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
256 def showinfo(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
257 d = self.__details
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
258 d.clear()
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
259 d.put("URL: %s\n" % self.format_url(url))
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
260 if self.bad.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
261 d.put("Error: %s\n" % str(self.bad[url]))
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
262 if url in self.roots:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
263 d.put("Note: This is a root URL\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
264 if self.done.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
265 d.put("Status: checked\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
266 o = self.done[url]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
267 elif self.todo.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
268 d.put("Status: to check\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
269 o = self.todo[url]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
270 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
271 d.put("Status: unknown (!)\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
272 o = []
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
273 if (not url[1]) and self.errors.has_key(url[0]):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
274 d.put("Bad links from this page:\n")
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
275 for triple in self.errors[url[0]]:
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
276 link, rawlink, msg = triple
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
277 d.put(" HREF %s" % self.format_url(link))
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
278 if self.format_url(link) != rawlink: d.put(" (%s)" %rawlink)
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
279 d.put("\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
280 d.put(" error %s\n" % str(msg))
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
281 self.__mp.showpanel("Details")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
282 for source, rawlink in o:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
283 d.put("Origin: %s" % source)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
284 if rawlink != self.format_url(url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
285 d.put(" (%s)" % rawlink)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
286 d.put("\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
287 d.text.yview("1.0")
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
288
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
289 def setbad(self, url, msg):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
290 webchecker.Checker.setbad(self, url, msg)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
291 self.__bad.insert(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
292 self.newstatus()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
293
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
294 def setgood(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
295 webchecker.Checker.setgood(self, url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
296 self.__bad.remove(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
297 self.newstatus()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
298
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
299 def newlink(self, url, origin):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
300 webchecker.Checker.newlink(self, url, origin)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
301 if self.done.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
302 self.__done.insert(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
303 elif self.todo.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
304 self.__todo.insert(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
305 self.newstatus()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
306
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
307 def markdone(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
308 webchecker.Checker.markdone(self, url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
309 self.__done.insert(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
310 self.__todo.remove(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
311 self.newstatus()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
312
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
313 def seterror(self, url, triple):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
314 webchecker.Checker.seterror(self, url, triple)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
315 self.__errors.insert((url, ''))
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
316 self.newstatus()
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
317
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
318 def newstatus(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
319 self.__status.config(text="Status: "+self.status())
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
320 self.__parent.update()
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
321
7568
e15e85d987af Use a better way to bind the checkext instance variable to a check
Guido van Rossum <guido@python.org>
parents: 5473
diff changeset
322 def update_checkext(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
323 self.checkext = self.__cv.get()
7568
e15e85d987af Use a better way to bind the checkext instance variable to a check
Guido van Rossum <guido@python.org>
parents: 5473
diff changeset
324
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
325
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
326 class ListPanel:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
327
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
328 def __init__(self, mp, name, checker, showinfo=None):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
329 self.mp = mp
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
330 self.name = name
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
331 self.showinfo = showinfo
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
332 self.checker = checker
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
333 self.panel = mp.addpanel(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
334 self.list, self.frame = tktools.make_list_box(
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
335 self.panel, width=60, height=5)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
336 self.list.config(exportselection=0)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
337 if showinfo:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
338 self.list.bind('<Double-Button-1>', self.doubleclick)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
339 self.items = []
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
340
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
341 def clear(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
342 self.items = []
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
343 self.list.delete(0, END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
344 self.mp.hidepanel(self.name)
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
345
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
346 def doubleclick(self, event):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
347 l = self.selectedindices()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
348 if l:
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
349 self.showinfo(self.items[l[0]])
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
350
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
351 def selectedindices(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
352 l = self.list.curselection()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
353 if not l: return []
25219
8a7a2f1f88f0 Apply diff2.txt from SF patch http://www.python.org/sf/572113
Walter Dörwald <walter@livinglogic.de>
parents: 11482
diff changeset
354 return map(int, l)
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
355
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
356 def insert(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
357 if url not in self.items:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
358 if not self.items:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
359 self.mp.showpanel(self.name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
360 # (I tried sorting alphabetically, but the display is too jumpy)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
361 i = len(self.items)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
362 self.list.insert(i, self.checker.format_url(url))
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
363 self.list.yview(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
364 self.items.insert(i, url)
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
365
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
366 def remove(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
367 try:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
368 i = self.items.index(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
369 except (ValueError, IndexError):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
370 pass
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
371 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
372 was_selected = i in self.selectedindices()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
373 self.list.delete(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
374 del self.items[i]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
375 if not self.items:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
376 self.mp.hidepanel(self.name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
377 elif was_selected:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
378 if i >= len(self.items):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
379 i = len(self.items) - 1
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
380 self.list.select_set(i)
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
381
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
382
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
383 class LogPanel:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
384
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
385 def __init__(self, mp, name):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
386 self.mp = mp
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
387 self.name = name
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
388 self.panel = mp.addpanel(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
389 self.text, self.frame = tktools.make_text_box(self.panel, height=10)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
390 self.text.config(wrap=NONE)
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
391
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
392 def clear(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
393 self.text.delete("1.0", END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
394 self.text.yview("1.0")
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
395
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
396 def put(self, s):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
397 self.text.insert(END, s)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
398 if '\n' in s:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
399 self.text.yview(END)
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
400
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
401 def write(self, s):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
402 self.text.insert(END, s)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
403 if '\n' in s:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
404 self.text.yview(END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
405 self.panel.update()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
406
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
407
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
408 class MultiPanel:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
409
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
410 def __init__(self, parent):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
411 self.parent = parent
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
412 self.frame = Frame(self.parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
413 self.frame.pack(expand=1, fill=BOTH)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
414 self.topframe = Frame(self.frame, borderwidth=2, relief=RAISED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
415 self.topframe.pack(fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
416 self.botframe = Frame(self.frame)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
417 self.botframe.pack(expand=1, fill=BOTH)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
418 self.panelnames = []
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
419 self.panels = {}
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
420
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
421 def addpanel(self, name, on=0):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
422 v = StringVar(self.parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
423 if on:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
424 v.set(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
425 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
426 v.set("")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
427 check = Checkbutton(self.topframe, text=name,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
428 offvalue="", onvalue=name, variable=v,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
429 command=self.checkpanel)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
430 check.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
431 panel = Frame(self.botframe)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
432 label = Label(panel, text=name, borderwidth=2, relief=RAISED, anchor=W)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
433 label.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
434 t = v, check, panel
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
435 self.panelnames.append(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
436 self.panels[name] = t
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
437 if on:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
438 panel.pack(expand=1, fill=BOTH)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
439 return panel
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
440
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
441 def showpanel(self, name):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
442 v, check, panel = self.panels[name]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
443 v.set(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
444 panel.pack(expand=1, fill=BOTH)
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
445
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
446 def hidepanel(self, name):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
447 v, check, panel = self.panels[name]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
448 v.set("")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
449 panel.pack_forget()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
450
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
451 def checkpanel(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
452 for name in self.panelnames:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
453 v, check, panel = self.panels[name]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
454 panel.pack_forget()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
455 for name in self.panelnames:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
456 v, check, panel = self.panels[name]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
457 if v.get():
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
458 panel.pack(expand=1, fill=BOTH)
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
459
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
460
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
461 if __name__ == '__main__':
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
462 main()