summaryrefslogtreecommitdiff
path: root/Tools/idle
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-04-04 22:55:58 +0000
committerTim Peters <tim.peters@gmail.com>2002-04-04 22:55:58 +0000
commit6466fec7b159fc14149632409a49b3ff86d011a8 (patch)
treeecdc70d76cc98d27bc305966884c5e269f15fdb0 /Tools/idle
parentf4c58160823a30ddfac1b2565ff8a57edfaf31e1 (diff)
downloadcpython-6466fec7b159fc14149632409a49b3ff86d011a8.tar.gz
Convert a pile of obvious "yes/no" functions to return bool.
Diffstat (limited to 'Tools/idle')
-rw-r--r--Tools/idle/EditorWindow.py6
-rw-r--r--Tools/idle/IOBinding.py8
-rw-r--r--Tools/idle/ObjectBrowser.py4
-rw-r--r--Tools/idle/PyShell.py6
-rw-r--r--Tools/idle/ReplaceDialog.py12
-rw-r--r--Tools/idle/SearchDialog.py10
6 files changed, 23 insertions, 23 deletions
diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py
index f924c45289..9dd51b68d4 100644
--- a/Tools/idle/EditorWindow.py
+++ b/Tools/idle/EditorWindow.py
@@ -375,16 +375,16 @@ class EditorWindow:
def ispythonsource(self, filename):
if not filename:
- return 1
+ return True
base, ext = os.path.splitext(os.path.basename(filename))
if os.path.normcase(ext) in (".py", ".pyw"):
- return 1
+ return True
try:
f = open(filename)
line = f.readline()
f.close()
except IOError:
- return 0
+ return False
return line[:2] == '#!' and string.find(line, 'python') >= 0
def close_hook(self):
diff --git a/Tools/idle/IOBinding.py b/Tools/idle/IOBinding.py
index 5d41d3592e..dfea0b6618 100644
--- a/Tools/idle/IOBinding.py
+++ b/Tools/idle/IOBinding.py
@@ -92,7 +92,7 @@ class IOBinding:
f.close()
except IOError, msg:
tkMessageBox.showerror("I/O Error", str(msg), master=self.text)
- return 0
+ return False
self.text.delete("1.0", "end")
self.set_filename(None)
self.text.insert("1.0", chars)
@@ -100,7 +100,7 @@ class IOBinding:
self.set_filename(filename)
self.text.mark_set("insert", "1.0")
self.text.see("insert")
- return 1
+ return True
def maybesave(self):
if self.get_saved():
@@ -154,11 +154,11 @@ class IOBinding:
f.write(chars)
f.close()
## print "saved to", `filename`
- return 1
+ return True
except IOError, msg:
tkMessageBox.showerror("I/O Error", str(msg),
master=self.text)
- return 0
+ return False
def fixlastline(self):
c = self.text.get("end-2c")
diff --git a/Tools/idle/ObjectBrowser.py b/Tools/idle/ObjectBrowser.py
index c235a7564f..416be5a15f 100644
--- a/Tools/idle/ObjectBrowser.py
+++ b/Tools/idle/ObjectBrowser.py
@@ -59,7 +59,7 @@ class ObjectTreeItem(TreeItem):
class InstanceTreeItem(ObjectTreeItem):
def IsExpandable(self):
- return 1
+ return True
def GetSubList(self):
sublist = ObjectTreeItem.GetSubList(self)
sublist.insert(0,
@@ -68,7 +68,7 @@ class InstanceTreeItem(ObjectTreeItem):
class ClassTreeItem(ObjectTreeItem):
def IsExpandable(self):
- return 1
+ return True
def GetSubList(self):
sublist = ObjectTreeItem.GetSubList(self)
if len(self.object.__bases__) == 1:
diff --git a/Tools/idle/PyShell.py b/Tools/idle/PyShell.py
index 03b468424d..2c471dee27 100644
--- a/Tools/idle/PyShell.py
+++ b/Tools/idle/PyShell.py
@@ -439,7 +439,7 @@ class PyShell(OutputWindow):
def ispythonsource(self, filename):
# Override this so EditorWindow never removes the colorizer
- return 1
+ return True
def short_title(self):
return self.shell_title
@@ -482,7 +482,7 @@ class PyShell(OutputWindow):
return line
def isatty(self):
- return 1
+ return True
def cancel_callback(self, event):
try:
@@ -685,7 +685,7 @@ class PseudoFile:
pass
def isatty(self):
- return 1
+ return True
usage_msg = """\
diff --git a/Tools/idle/ReplaceDialog.py b/Tools/idle/ReplaceDialog.py
index 83462f9a1f..1e46f36565 100644
--- a/Tools/idle/ReplaceDialog.py
+++ b/Tools/idle/ReplaceDialog.py
@@ -111,24 +111,24 @@ class ReplaceDialog(SearchDialogBase):
def do_find(self, ok=0):
if not self.engine.getprog():
- return 0
+ return False
text = self.text
res = self.engine.search_text(text, None, ok)
if not res:
text.bell()
- return 0
+ return False
line, m = res
i, j = m.span()
first = "%d.%d" % (line, i)
last = "%d.%d" % (line, j)
self.show_hit(first, last)
self.ok = 1
- return 1
+ return True
def do_replace(self):
prog = self.engine.getprog()
if not prog:
- return 0
+ return False
text = self.text
try:
first = pos = text.index("sel.first")
@@ -141,7 +141,7 @@ class ReplaceDialog(SearchDialogBase):
chars = text.get("%d.0" % line, "%d.0" % (line+1))
m = prog.match(chars, col)
if not prog:
- return 0
+ return False
new = self._expand(m, self.replvar.get())
text.mark_set("insert", first)
text.undo_block_start()
@@ -152,7 +152,7 @@ class ReplaceDialog(SearchDialogBase):
text.undo_block_stop()
self.show_hit(first, text.index("insert"))
self.ok = 0
- return 1
+ return True
def _expand(self, m, template):
# XXX This code depends on internals of the regular expression
diff --git a/Tools/idle/SearchDialog.py b/Tools/idle/SearchDialog.py
index 0f0cb189f6..8d275c4437 100644
--- a/Tools/idle/SearchDialog.py
+++ b/Tools/idle/SearchDialog.py
@@ -34,9 +34,9 @@ class SearchDialog(SearchDialogBase):
def find_again(self, text):
if not self.engine.getpat():
self.open(text)
- return 0
+ return False
if not self.engine.getprog():
- return 0
+ return False
res = self.engine.search_text(text)
if res:
line, m = res
@@ -48,17 +48,17 @@ class SearchDialog(SearchDialogBase):
sellast = text.index("sel.last")
if selfirst == first and sellast == last:
text.bell()
- return 0
+ return False
except TclError:
pass
text.tag_remove("sel", "1.0", "end")
text.tag_add("sel", first, last)
text.mark_set("insert", self.engine.isback() and first or last)
text.see("insert")
- return 1
+ return True
else:
text.bell()
- return 0
+ return False
def find_selection(self, text):
pat = text.get("sel.first", "sel.last")