Mercurial > cpython-lru_cache-weakref
annotate Tools/webchecker/wcgui.py @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | c3d4bfb8ccdf |
| children | e15e85d987af |
| 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 |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
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 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
16 Command buttons Start, Stop and "Check one" govern the checking process in |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
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 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
22 A series of checkbuttons determines whether the corresponding output panel |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
23 is shown. List panels are also automatically shown or hidden when their |
|
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 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 Command line arguments: |
|
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 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
|
46 (default %(DEFROOT)s) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
48 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
|
49 |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
50 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
|
51 |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
52 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
|
53 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 """ |
|
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 # ' Emacs bait |
|
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 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 import sys |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 import getopt |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 import string |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 from Tkinter import * |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
63 import tktools |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 import webchecker |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 import random |
|
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: |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
75 opts, args = getopt.getopt(sys.argv[1:], 'm:qv') |
|
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: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 sys.stdout = sys.stderr |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 print msg |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
79 print __doc__%vars(webchecker) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
80 sys.exit(2) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 for o, a in opts: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 if o == '-m': |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
83 webchecker.maxpage = string.atoi(a) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
84 if o == '-q': |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 webchecker.verbose = 0 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
86 if o == '-v': |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
87 webchecker.verbose = webchecker.verbose + 1 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
88 root = Tk(className='Webchecker') |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
89 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
|
90 c = CheckerWindow(root) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
91 if args: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
92 for arg in args[:-1]: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
93 c.addroot(arg) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
94 c.suggestroot(args[-1]) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 root.mainloop() |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
96 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 class CheckerWindow(webchecker.Checker): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
100 def __init__(self, parent, root=webchecker.DEFROOT): |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 self.__parent = parent |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
102 |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
103 self.__topcontrols = Frame(parent) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
104 self.__topcontrols.pack(side=TOP, fill=X) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
105 self.__label = Label(self.__topcontrols, text="Root URL:") |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
106 self.__label.pack(side=LEFT) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
107 self.__rootentry = Entry(self.__topcontrols, width=60) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
108 self.__rootentry.pack(side=LEFT) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
109 self.__rootentry.bind('<Return>', self.enterroot) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
110 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
|
111 |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
112 self.__controls = Frame(parent) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
113 self.__controls.pack(side=TOP, fill=X) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
114 self.__running = 0 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
115 self.__start = Button(self.__controls, text="Run", command=self.start) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
116 self.__start.pack(side=LEFT) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
117 self.__stop = Button(self.__controls, text="Stop", command=self.stop, |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
118 state=DISABLED) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
119 self.__stop.pack(side=LEFT) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
120 self.__step = Button(self.__controls, text="Check one", |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
121 command=self.step) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
122 self.__step.pack(side=LEFT) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
123 self.__cv = BooleanVar() |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
124 self.__cv.set(1) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
125 self.__checkext = Checkbutton(self.__controls, variable=self.__cv, |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
126 text="Check nonlocal links") |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
127 self.__checkext.pack(side=LEFT) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
128 self.__reset = Button(self.__controls, text="Start over", command=self.reset) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
129 self.__reset.pack(side=LEFT) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
130 if __name__ == '__main__': # No Quit button under Grail! |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
131 self.__quit = Button(self.__controls, text="Quit", |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
132 command=self.__parent.quit) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
133 self.__quit.pack(side=RIGHT) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
134 |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
135 self.__status = Label(parent, text="Status: initial", anchor=W) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
136 self.__status.pack(side=TOP, fill=X) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
137 self.__checking = Label(parent, text="Idle", anchor=W) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
138 self.__checking.pack(side=TOP, fill=X) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 self.__mp = mp = MultiPanel(parent) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
140 sys.stdout = self.__log = LogPanel(mp, "Log") |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
141 self.__todo = ListPanel(mp, "To check", self.showinfo) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
142 self.__done = ListPanel(mp, "Checked", self.showinfo) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
143 self.__bad = ListPanel(mp, "Bad links", self.showinfo) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
144 self.__errors = ListPanel(mp, "Pages w/ bad links", self.showinfo) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
145 self.__details = LogPanel(mp, "Details") |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
146 webchecker.Checker.__init__(self) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
147 del self.checkext # See __getattr__ below |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
148 if root: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
149 root = string.strip(str(root)) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
150 if root: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
151 self.suggestroot(root) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
152 self.newstatus() |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
153 |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
154 def __getattr__(self, name): |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
155 if name != 'checkext': raise AttributeError, name |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
156 return self.__cv.get() |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
157 |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
158 def reset(self): |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
159 webchecker.Checker.reset(self) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
160 for p in self.__todo, self.__done, self.__bad, self.__errors: |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
161 p.clear() |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
162 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
163 def suggestroot(self, root): |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
164 self.__rootentry.delete(0, END) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
165 self.__rootentry.insert(END, root) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
166 self.__rootentry.select_range(0, END) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
167 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
168 def enterroot(self, event=None): |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
169 root = self.__rootentry.get() |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
170 root = string.strip(root) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
171 if root: |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
172 self.__checking.config(text="Adding root "+root) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
173 self.__checking.update_idletasks() |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
174 self.addroot(root) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
175 self.__checking.config(text="Idle") |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
176 try: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
177 i = self.__todo.items.index(root) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
178 except (ValueError, IndexError): |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
179 pass |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
180 else: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
181 self.__todo.list.select_clear(0, END) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
182 self.__todo.list.select_set(i) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
183 self.__todo.list.yview(i) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
184 self.__rootentry.delete(0, END) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
185 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
186 def start(self): |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
187 self.__start.config(state=DISABLED, relief=SUNKEN) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
188 self.__stop.config(state=NORMAL) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
189 self.__step.config(state=DISABLED) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
190 self.enterroot() |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
191 self.__running = 1 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
192 self.go() |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
193 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
194 def stop(self): |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
195 self.__stop.config(state=DISABLED, relief=SUNKEN) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
196 self.__running = 0 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
197 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
198 def step(self): |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
199 self.__start.config(state=DISABLED) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
200 self.__step.config(state=DISABLED, relief=SUNKEN) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
201 self.enterroot() |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
202 self.__running = 0 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
203 self.dosomething() |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
204 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
205 def go(self): |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
206 if self.__running: |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
207 self.__parent.after_idle(self.dosomething) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
208 else: |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
209 self.__checking.config(text="Idle") |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
210 self.__start.config(state=NORMAL, relief=RAISED) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
211 self.__stop.config(state=DISABLED, relief=RAISED) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
212 self.__step.config(state=NORMAL, relief=RAISED) |
|
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 __busy = 0 |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
215 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
216 def dosomething(self): |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
217 if self.__busy: return |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
218 self.__busy = 1 |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
219 if self.todo: |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
220 l = self.__todo.selectedindices() |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
221 if l: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
222 i = l[0] |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
223 else: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
224 i = 0 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
225 self.__todo.list.select_set(i) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
226 self.__todo.list.yview(i) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
227 url = self.__todo.items[i] |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
228 self.__checking.config(text="Checking "+url) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
229 self.__parent.update() |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
230 self.dopage(url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
231 else: |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
232 self.stop() |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
233 self.__busy = 0 |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
234 self.go() |
|
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 showinfo(self, url): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
237 d = self.__details |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
238 d.clear() |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
239 d.put("URL: %s\n" % url) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
240 if self.bad.has_key(url): |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
241 d.put("Error: %s\n" % str(self.bad[url])) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
242 if url in self.roots: |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
243 d.put("Note: This is a root URL\n") |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
244 if self.done.has_key(url): |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
245 d.put("Status: checked\n") |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
246 o = self.done[url] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
247 elif self.todo.has_key(url): |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
248 d.put("Status: to check\n") |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
249 o = self.todo[url] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
250 else: |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
251 d.put("Status: unknown (!)\n") |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
252 o = [] |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
253 if self.errors.has_key(url): |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
254 d.put("Bad links from this page:\n") |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
255 for triple in self.errors[url]: |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
256 link, rawlink, msg = triple |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
257 d.put(" HREF %s" % link) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
258 if link != rawlink: d.put(" (%s)" %rawlink) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
259 d.put("\n") |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
260 d.put(" error %s\n" % str(msg)) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
261 self.__mp.showpanel("Details") |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
262 for source, rawlink in o: |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
263 d.put("Origin: %s" % source) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
264 if rawlink != url: |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
265 d.put(" (%s)" % rawlink) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
266 d.put("\n") |
|
5473
c3d4bfb8ccdf
Scroll to top of info window when done.
Guido van Rossum <guido@python.org>
parents:
5086
diff
changeset
|
267 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
|
268 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
269 def setbad(self, url, msg): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
270 webchecker.Checker.setbad(self, url, msg) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
271 self.__bad.insert(url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
272 self.newstatus() |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
273 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
274 def setgood(self, url): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
275 webchecker.Checker.setgood(self, url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
276 self.__bad.remove(url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
277 self.newstatus() |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
278 |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
279 def newlink(self, url, origin): |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
280 webchecker.Checker.newlink(self, url, origin) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
281 if self.done.has_key(url): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
282 self.__done.insert(url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
283 elif self.todo.has_key(url): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
284 self.__todo.insert(url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
285 self.newstatus() |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
286 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
287 def markdone(self, url): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
288 webchecker.Checker.markdone(self, url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
289 self.__done.insert(url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
290 self.__todo.remove(url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
291 self.newstatus() |
|
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 seterror(self, url, triple): |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
294 webchecker.Checker.seterror(self, url, triple) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
295 self.__errors.insert(url) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
296 self.newstatus() |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
297 |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
298 def newstatus(self): |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
299 self.__status.config(text="Status: "+self.status()) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
300 self.__parent.update() |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
301 |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
302 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
303 class ListPanel: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
304 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
305 def __init__(self, mp, name, showinfo=None): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
306 self.mp = mp |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
307 self.name = name |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
308 self.showinfo = showinfo |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
309 self.panel = mp.addpanel(name) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
310 self.list, self.frame = tktools.make_list_box( |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
311 self.panel, width=60, height=5) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
312 self.list.config(exportselection=0) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
313 if showinfo: |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
314 self.list.bind('<Double-Button-1>', self.doubleclick) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
315 self.items = [] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
316 |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
317 def clear(self): |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
318 self.items = [] |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
319 self.list.delete(0, END) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
320 self.mp.hidepanel(self.name) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
321 |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
322 def doubleclick(self, event): |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
323 l = self.selectedindices() |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
324 if l: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
325 self.showinfo(self.list.get(l[0])) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
326 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
327 def selectedindices(self): |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
328 l = self.list.curselection() |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
329 if not l: return [] |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
330 return map(string.atoi, l) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
331 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
332 def insert(self, url): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
333 if url not in self.items: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
334 if not self.items: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
335 self.mp.showpanel(self.name) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
336 # (I tried sorting alphabetically, but the display is too jumpy) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
337 i = len(self.items) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
338 self.list.insert(i, url) |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
339 self.list.yview(i) |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
340 self.items.insert(i, url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
341 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
342 def remove(self, url): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
343 try: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
344 i = self.items.index(url) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
345 except (ValueError, IndexError): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
346 pass |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
347 else: |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
348 was_selected = i in self.selectedindices() |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
349 self.list.delete(i) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
350 del self.items[i] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
351 if not self.items: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
352 self.mp.hidepanel(self.name) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
353 elif was_selected: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
354 if i >= len(self.items): |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
355 i = len(self.items) - 1 |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
356 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
|
357 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
358 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
359 class LogPanel: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
360 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
361 def __init__(self, mp, name): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
362 self.mp = mp |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
363 self.name = name |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
364 self.panel = mp.addpanel(name) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
365 self.text, self.frame = tktools.make_text_box(self.panel, height=10) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
366 self.text.config(wrap=NONE) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
367 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
368 def clear(self): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
369 self.text.delete("1.0", END) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
370 self.text.yview("1.0") |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
371 |
|
5086
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
372 def put(self, s): |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
373 self.text.insert(END, s) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
374 if '\n' in s: |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
375 self.text.yview(END) |
|
aa73da661cdf
Restructured Checker class to get rid of 'ext' table.
Guido van Rossum <guido@python.org>
parents:
5084
diff
changeset
|
376 |
|
5081
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
377 def write(self, s): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
378 self.text.insert(END, s) |
|
5084
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
379 if '\n' in s: |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
380 self.text.yview(END) |
|
afc3e4e08740
Add root URL entry box, separate start/stop/step buttons.
Guido van Rossum <guido@python.org>
parents:
5081
diff
changeset
|
381 self.panel.update() |
|
5081
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 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
384 class MultiPanel: |
|
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 __init__(self, parent): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
387 self.parent = parent |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
388 self.frame = Frame(self.parent) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
389 self.frame.pack(expand=1, fill=BOTH) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
390 self.topframe = Frame(self.frame, borderwidth=2, relief=RAISED) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
391 self.topframe.pack(fill=X) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
392 self.botframe = Frame(self.frame) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
393 self.botframe.pack(expand=1, fill=BOTH) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
394 self.panelnames = [] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
395 self.panels = {} |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
396 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
397 def addpanel(self, name, on=0): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
398 v = StringVar() |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
399 if on: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
400 v.set(name) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
401 else: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
402 v.set("") |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
403 check = Checkbutton(self.topframe, text=name, |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
404 offvalue="", onvalue=name, variable=v, |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
405 command=self.checkpanel) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
406 check.pack(side=LEFT) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
407 panel = Frame(self.botframe) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
408 label = Label(panel, text=name, borderwidth=2, relief=RAISED, anchor=W) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
409 label.pack(side=TOP, fill=X) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
410 t = v, check, panel |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
411 self.panelnames.append(name) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
412 self.panels[name] = t |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
413 if on: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
414 panel.pack(expand=1, fill=BOTH) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
415 return panel |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
416 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
417 def showpanel(self, name): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
418 v, check, panel = self.panels[name] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
419 v.set(name) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
420 panel.pack(expand=1, fill=BOTH) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
421 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
422 def hidepanel(self, name): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
423 v, check, panel = self.panels[name] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
424 v.set("") |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
425 panel.pack_forget() |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
426 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
427 def checkpanel(self): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
428 for name in self.panelnames: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
429 v, check, panel = self.panels[name] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
430 panel.pack_forget() |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
431 for name in self.panelnames: |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
432 v, check, panel = self.panels[name] |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
433 if v.get(): |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
434 panel.pack(expand=1, fill=BOTH) |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
435 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
436 |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
437 if __name__ == '__main__': |
|
1b619b811c10
Tk interface to webchecker. Not fully featured yet, but usable.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
438 main() |
