mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Use a better way to bind the checkext instance variable to a check
button widget, not involving a __getattr__() method but a callback on the widget.
This commit is contained in:
parent
2135117542
commit
88b02cf346
1 changed files with 8 additions and 9 deletions
|
@ -120,10 +120,11 @@ class CheckerWindow(webchecker.Checker):
|
|||
self.__step = Button(self.__controls, text="Check one",
|
||||
command=self.step)
|
||||
self.__step.pack(side=LEFT)
|
||||
self.__cv = BooleanVar()
|
||||
self.__cv.set(1)
|
||||
self.__cv = BooleanVar(parent)
|
||||
self.__cv.set(self.checkext)
|
||||
self.__checkext = Checkbutton(self.__controls, variable=self.__cv,
|
||||
text="Check nonlocal links")
|
||||
command=self.update_checkext,
|
||||
text="Check nonlocal links",)
|
||||
self.__checkext.pack(side=LEFT)
|
||||
self.__reset = Button(self.__controls, text="Start over", command=self.reset)
|
||||
self.__reset.pack(side=LEFT)
|
||||
|
@ -144,17 +145,12 @@ class CheckerWindow(webchecker.Checker):
|
|||
self.__errors = ListPanel(mp, "Pages w/ bad links", self.showinfo)
|
||||
self.__details = LogPanel(mp, "Details")
|
||||
webchecker.Checker.__init__(self)
|
||||
del self.checkext # See __getattr__ below
|
||||
if root:
|
||||
root = string.strip(str(root))
|
||||
if root:
|
||||
self.suggestroot(root)
|
||||
self.newstatus()
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name != 'checkext': raise AttributeError, name
|
||||
return self.__cv.get()
|
||||
|
||||
def reset(self):
|
||||
webchecker.Checker.reset(self)
|
||||
for p in self.__todo, self.__done, self.__bad, self.__errors:
|
||||
|
@ -299,6 +295,9 @@ class CheckerWindow(webchecker.Checker):
|
|||
self.__status.config(text="Status: "+self.status())
|
||||
self.__parent.update()
|
||||
|
||||
def update_checkext(self):
|
||||
self.checkext = self.__cv.get()
|
||||
|
||||
|
||||
class ListPanel:
|
||||
|
||||
|
@ -395,7 +394,7 @@ class MultiPanel:
|
|||
self.panels = {}
|
||||
|
||||
def addpanel(self, name, on=0):
|
||||
v = StringVar()
|
||||
v = StringVar(self.parent)
|
||||
if on:
|
||||
v.set(name)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue