annotate Tools/webchecker/wcgui.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents f6785bce54b5
children
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
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
67 def main():
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
68 try:
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
69 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
70 except getopt.error, msg:
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
71 sys.stdout = sys.stderr
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
72 print msg
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
73 print __doc__%vars(webchecker)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
74 sys.exit(2)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
75 webchecker.verbose = webchecker.VERBOSE
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
76 webchecker.nonames = webchecker.NONAMES
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
77 webchecker.maxpage = webchecker.MAXPAGE
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
78 extra_roots = []
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
79 for o, a in opts:
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
80 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
81 webchecker.maxpage = int(a)
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
82 if o == '-q':
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
83 webchecker.verbose = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
84 if o == '-v':
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
85 webchecker.verbose = webchecker.verbose + 1
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
86 if o == '-t':
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
87 extra_roots.append(a)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
88 if o == '-a':
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
89 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
90 root = Tk(className='Webchecker')
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
91 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
92 c = CheckerWindow(root)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
93 c.setflags(verbose=webchecker.verbose, maxpage=webchecker.maxpage,
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
94 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
95 if args:
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
96 for arg in args[:-1]:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
97 c.addroot(arg)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
98 c.suggestroot(args[-1])
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
99 # Usually conditioned on whether external links
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
100 # will be checked, but since that's not a command
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
101 # line option, just toss them in.
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
102 for url_root in extra_roots:
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
103 # Make sure it's terminated by a slash,
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
104 # so that addroot doesn't discard the last
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
105 # directory component.
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
106 if url_root[-1] != "/":
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
107 url_root = url_root + "/"
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
108 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
109 root.mainloop()
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
110
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
111
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
112 class CheckerWindow(webchecker.Checker):
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
113
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
114 def __init__(self, parent, root=webchecker.DEFROOT):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
115 self.__parent = parent
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
116
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
117 self.__topcontrols = Frame(parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
118 self.__topcontrols.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
119 self.__label = Label(self.__topcontrols, text="Root URL:")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
120 self.__label.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
121 self.__rootentry = Entry(self.__topcontrols, width=60)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
122 self.__rootentry.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
123 self.__rootentry.bind('<Return>', self.enterroot)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
124 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
125
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
126 self.__controls = Frame(parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
127 self.__controls.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
128 self.__running = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
129 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
130 self.__start.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
131 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
132 state=DISABLED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
133 self.__stop.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
134 self.__step = Button(self.__controls, text="Check one",
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
135 command=self.step)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
136 self.__step.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
137 self.__cv = BooleanVar(parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
138 self.__cv.set(self.checkext)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
139 self.__checkext = Checkbutton(self.__controls, variable=self.__cv,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
140 command=self.update_checkext,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
141 text="Check nonlocal links",)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
142 self.__checkext.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
143 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
144 self.__reset.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
145 if __name__ == '__main__': # No Quit button under Grail!
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
146 self.__quit = Button(self.__controls, text="Quit",
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
147 command=self.__parent.quit)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
148 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
149
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
150 self.__status = Label(parent, text="Status: initial", anchor=W)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
151 self.__status.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
152 self.__checking = Label(parent, text="Idle", anchor=W)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
153 self.__checking.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
154 self.__mp = mp = MultiPanel(parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
155 sys.stdout = self.__log = LogPanel(mp, "Log")
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
156 self.__todo = ListPanel(mp, "To check", self, self.showinfo)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
157 self.__done = ListPanel(mp, "Checked", self, self.showinfo)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
158 self.__bad = ListPanel(mp, "Bad links", self, self.showinfo)
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
159 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
160 self.__details = LogPanel(mp, "Details")
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
161 self.root_seed = None
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
162 webchecker.Checker.__init__(self)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
163 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
164 root = str(root).strip()
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
165 if root:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
166 self.suggestroot(root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
167 self.newstatus()
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
168
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
169 def reset(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
170 webchecker.Checker.reset(self)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
171 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
172 p.clear()
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
173 if self.root_seed:
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
174 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
175
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
176 def suggestroot(self, root):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
177 self.__rootentry.delete(0, END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
178 self.__rootentry.insert(END, root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
179 self.__rootentry.select_range(0, END)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
180 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
181
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
182 def enterroot(self, event=None):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
183 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
184 root = root.strip()
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
185 if root:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
186 self.__checking.config(text="Adding root "+root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
187 self.__checking.update_idletasks()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
188 self.addroot(root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
189 self.__checking.config(text="Idle")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
190 try:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
191 i = self.__todo.items.index(root)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
192 except (ValueError, IndexError):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
193 pass
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
194 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
195 self.__todo.list.select_clear(0, END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
196 self.__todo.list.select_set(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
197 self.__todo.list.yview(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
198 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
199
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
200 def start(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
201 self.__start.config(state=DISABLED, relief=SUNKEN)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
202 self.__stop.config(state=NORMAL)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
203 self.__step.config(state=DISABLED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
204 self.enterroot()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
205 self.__running = 1
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
206 self.go()
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
207
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
208 def stop(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
209 self.__stop.config(state=DISABLED, relief=SUNKEN)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
210 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
211
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
212 def step(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
213 self.__start.config(state=DISABLED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
214 self.__step.config(state=DISABLED, relief=SUNKEN)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
215 self.enterroot()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
216 self.__running = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
217 self.dosomething()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
218
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
219 def go(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
220 if self.__running:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
221 self.__parent.after_idle(self.dosomething)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
222 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
223 self.__checking.config(text="Idle")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
224 self.__start.config(state=NORMAL, relief=RAISED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
225 self.__stop.config(state=DISABLED, relief=RAISED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
226 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
227
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
228 __busy = 0
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
229
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
230 def dosomething(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
231 if self.__busy: return
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
232 self.__busy = 1
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
233 if self.todo:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
234 l = self.__todo.selectedindices()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
235 if l:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
236 i = l[0]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
237 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
238 i = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
239 self.__todo.list.select_set(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
240 self.__todo.list.yview(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
241 url = self.__todo.items[i]
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
242 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
243 self.__parent.update()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
244 self.dopage(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
245 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
246 self.stop()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
247 self.__busy = 0
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
248 self.go()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
249
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
250 def showinfo(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
251 d = self.__details
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
252 d.clear()
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
253 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
254 if self.bad.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
255 d.put("Error: %s\n" % str(self.bad[url]))
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
256 if url in self.roots:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
257 d.put("Note: This is a root URL\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
258 if self.done.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
259 d.put("Status: checked\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
260 o = self.done[url]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
261 elif self.todo.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
262 d.put("Status: to check\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
263 o = self.todo[url]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
264 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
265 d.put("Status: unknown (!)\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
266 o = []
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
267 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
268 d.put("Bad links from this page:\n")
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
269 for triple in self.errors[url[0]]:
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
270 link, rawlink, msg = triple
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
271 d.put(" HREF %s" % self.format_url(link))
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
272 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
273 d.put("\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
274 d.put(" error %s\n" % str(msg))
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
275 self.__mp.showpanel("Details")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
276 for source, rawlink in o:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
277 d.put("Origin: %s" % source)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
278 if rawlink != self.format_url(url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
279 d.put(" (%s)" % rawlink)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
280 d.put("\n")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
281 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
282
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
283 def setbad(self, url, msg):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
284 webchecker.Checker.setbad(self, url, msg)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
285 self.__bad.insert(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
286 self.newstatus()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
287
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
288 def setgood(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
289 webchecker.Checker.setgood(self, url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
290 self.__bad.remove(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
291 self.newstatus()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
292
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
293 def newlink(self, url, origin):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
294 webchecker.Checker.newlink(self, url, origin)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
295 if self.done.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
296 self.__done.insert(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
297 elif self.todo.has_key(url):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
298 self.__todo.insert(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
299 self.newstatus()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
300
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
301 def markdone(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
302 webchecker.Checker.markdone(self, url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
303 self.__done.insert(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
304 self.__todo.remove(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
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
307 def seterror(self, url, triple):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
308 webchecker.Checker.seterror(self, url, triple)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
309 self.__errors.insert((url, ''))
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
310 self.newstatus()
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
311
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
312 def newstatus(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
313 self.__status.config(text="Status: "+self.status())
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
314 self.__parent.update()
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
315
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
316 def update_checkext(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
317 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
318
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
319
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
320 class ListPanel:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
321
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
322 def __init__(self, mp, name, checker, showinfo=None):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
323 self.mp = mp
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
324 self.name = name
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
325 self.showinfo = showinfo
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
326 self.checker = checker
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
327 self.panel = mp.addpanel(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
328 self.list, self.frame = tktools.make_list_box(
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
329 self.panel, width=60, height=5)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
330 self.list.config(exportselection=0)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
331 if showinfo:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
332 self.list.bind('<Double-Button-1>', self.doubleclick)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
333 self.items = []
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
334
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
335 def clear(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
336 self.items = []
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
337 self.list.delete(0, END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
338 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
339
5084
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
340 def doubleclick(self, event):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
341 l = self.selectedindices()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
342 if l:
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
343 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
344
afc3e4e08740 Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents: 5081
diff changeset
345 def selectedindices(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
346 l = self.list.curselection()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
347 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
348 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
349
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
350 def insert(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
351 if url not in self.items:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
352 if not self.items:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
353 self.mp.showpanel(self.name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
354 # (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
355 i = len(self.items)
11478
e2408744dc7f Samuel L. Bayer:
Guido van Rossum <guido@python.org>
parents: 7887
diff changeset
356 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
357 self.list.yview(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
358 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
359
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
360 def remove(self, url):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
361 try:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
362 i = self.items.index(url)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
363 except (ValueError, IndexError):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
364 pass
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
365 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
366 was_selected = i in self.selectedindices()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
367 self.list.delete(i)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
368 del self.items[i]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
369 if not self.items:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
370 self.mp.hidepanel(self.name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
371 elif was_selected:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
372 if i >= len(self.items):
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
373 i = len(self.items) - 1
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
374 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
375
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
376
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
377 class LogPanel:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
378
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
379 def __init__(self, mp, name):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
380 self.mp = mp
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
381 self.name = name
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
382 self.panel = mp.addpanel(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
383 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
384 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
385
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
386 def clear(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
387 self.text.delete("1.0", END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
388 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
389
5086
aa73da661cdf Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents: 5084
diff changeset
390 def put(self, s):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
391 self.text.insert(END, s)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
392 if '\n' in s:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
393 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
394
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
395 def write(self, s):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
396 self.text.insert(END, s)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
397 if '\n' in s:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
398 self.text.yview(END)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
399 self.panel.update()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
400
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
401
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
402 class MultiPanel:
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
403
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
404 def __init__(self, parent):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
405 self.parent = parent
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
406 self.frame = Frame(self.parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
407 self.frame.pack(expand=1, fill=BOTH)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
408 self.topframe = Frame(self.frame, borderwidth=2, relief=RAISED)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
409 self.topframe.pack(fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
410 self.botframe = Frame(self.frame)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
411 self.botframe.pack(expand=1, fill=BOTH)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
412 self.panelnames = []
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
413 self.panels = {}
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
414
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
415 def addpanel(self, name, on=0):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
416 v = StringVar(self.parent)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
417 if on:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
418 v.set(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
419 else:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
420 v.set("")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
421 check = Checkbutton(self.topframe, text=name,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
422 offvalue="", onvalue=name, variable=v,
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
423 command=self.checkpanel)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
424 check.pack(side=LEFT)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
425 panel = Frame(self.botframe)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
426 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
427 label.pack(side=TOP, fill=X)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
428 t = v, check, panel
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
429 self.panelnames.append(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
430 self.panels[name] = t
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
431 if on:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
432 panel.pack(expand=1, fill=BOTH)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
433 return panel
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
434
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
435 def showpanel(self, name):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
436 v, check, panel = self.panels[name]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
437 v.set(name)
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
438 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
439
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
440 def hidepanel(self, name):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
441 v, check, panel = self.panels[name]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
442 v.set("")
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
443 panel.pack_forget()
5081
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
444
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
445 def checkpanel(self):
7887
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
446 for name in self.panelnames:
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 panel.pack_forget()
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
449 for name in self.panelnames:
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
450 v, check, panel = self.panels[name]
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
451 if v.get():
efbb7e57e6f8 Give in to tabnanny
Guido van Rossum <guido@python.org>
parents: 7568
diff changeset
452 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
453
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
454
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
455 if __name__ == '__main__':
1b619b811c10 Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff changeset
456 main()