[Python-checkins] CVS: python/dist/src/Tools/idle EditorWindow.py,1.39,1.40 IOBinding.py,1.4,1.5 ObjectBrowser.py,1.3,1.4 PyShell.py,1.35,1.36 ReplaceDialog.py,1.4,1.5 SearchDialog.py,1.2,1.3

Tim Peters tim_one@users.sourceforge.net
2002年4月04日 14:56:00 -0800


Update of /cvsroot/python/python/dist/src/Tools/idle
In directory usw-pr-cvs1:/tmp/cvs-serv18060/python/Tools/idle
Modified Files:
	EditorWindow.py IOBinding.py ObjectBrowser.py PyShell.py 
	ReplaceDialog.py SearchDialog.py 
Log Message:
Convert a pile of obvious "yes/no" functions to return bool.
Index: EditorWindow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** EditorWindow.py	23 Jan 2002 15:15:13 -0000	1.39
--- EditorWindow.py	4 Apr 2002 22:55:58 -0000	1.40
***************
*** 376,383 ****
 def ispythonsource(self, filename):
 if not filename:
! return 1
 base, ext = os.path.splitext(os.path.basename(filename))
 if os.path.normcase(ext) in (".py", ".pyw"):
! return 1
 try:
 f = open(filename)
--- 376,383 ----
 def ispythonsource(self, filename):
 if not filename:
! return True
 base, ext = os.path.splitext(os.path.basename(filename))
 if os.path.normcase(ext) in (".py", ".pyw"):
! return True
 try:
 f = open(filename)
***************
*** 385,389 ****
 f.close()
 except IOError:
! return 0
 return line[:2] == '#!' and string.find(line, 'python') >= 0
 
--- 385,389 ----
 f.close()
 except IOError:
! return False
 return line[:2] == '#!' and string.find(line, 'python') >= 0
 
Index: IOBinding.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** IOBinding.py	2 Feb 2001 20:07:46 -0000	1.4
--- IOBinding.py	4 Apr 2002 22:55:58 -0000	1.5
***************
*** 93,97 ****
 except IOError, msg:
 tkMessageBox.showerror("I/O Error", str(msg), master=self.text)
! return 0
 self.text.delete("1.0", "end")
 self.set_filename(None)
--- 93,97 ----
 except IOError, msg:
 tkMessageBox.showerror("I/O Error", str(msg), master=self.text)
! return False
 self.text.delete("1.0", "end")
 self.set_filename(None)
***************
*** 101,105 ****
 self.text.mark_set("insert", "1.0")
 self.text.see("insert")
! return 1
 
 def maybesave(self):
--- 101,105 ----
 self.text.mark_set("insert", "1.0")
 self.text.see("insert")
! return True
 
 def maybesave(self):
***************
*** 155,163 ****
 f.close()
 ## print "saved to", `filename`
! return 1
 except IOError, msg:
 tkMessageBox.showerror("I/O Error", str(msg),
 master=self.text)
! return 0
 
 def fixlastline(self):
--- 155,163 ----
 f.close()
 ## print "saved to", `filename`
! return True
 except IOError, msg:
 tkMessageBox.showerror("I/O Error", str(msg),
 master=self.text)
! return False
 
 def fixlastline(self):
Index: ObjectBrowser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/ObjectBrowser.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ObjectBrowser.py	2 Jan 2001 21:22:03 -0000	1.3
--- ObjectBrowser.py	4 Apr 2002 22:55:58 -0000	1.4
***************
*** 60,64 ****
 class InstanceTreeItem(ObjectTreeItem):
 def IsExpandable(self):
! return 1
 def GetSubList(self):
 sublist = ObjectTreeItem.GetSubList(self)
--- 60,64 ----
 class InstanceTreeItem(ObjectTreeItem):
 def IsExpandable(self):
! return True
 def GetSubList(self):
 sublist = ObjectTreeItem.GetSubList(self)
***************
*** 69,73 ****
 class ClassTreeItem(ObjectTreeItem):
 def IsExpandable(self):
! return 1
 def GetSubList(self):
 sublist = ObjectTreeItem.GetSubList(self)
--- 69,73 ----
 class ClassTreeItem(ObjectTreeItem):
 def IsExpandable(self):
! return True
 def GetSubList(self):
 sublist = ObjectTreeItem.GetSubList(self)
Index: PyShell.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** PyShell.py	20 Jul 2001 18:58:42 -0000	1.35
--- PyShell.py	4 Apr 2002 22:55:58 -0000	1.36
***************
*** 440,444 ****
 def ispythonsource(self, filename):
 # Override this so EditorWindow never removes the colorizer
! return 1
 
 def short_title(self):
--- 440,444 ----
 def ispythonsource(self, filename):
 # Override this so EditorWindow never removes the colorizer
! return True
 
 def short_title(self):
***************
*** 483,487 ****
 
 def isatty(self):
! return 1
 
 def cancel_callback(self, event):
--- 483,487 ----
 
 def isatty(self):
! return True
 
 def cancel_callback(self, event):
***************
*** 686,690 ****
 
 def isatty(self):
! return 1
 
 
--- 686,690 ----
 
 def isatty(self):
! return True
 
 
Index: ReplaceDialog.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/ReplaceDialog.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ReplaceDialog.py	19 Sep 2000 20:51:17 -0000	1.4
--- ReplaceDialog.py	4 Apr 2002 22:55:58 -0000	1.5
***************
*** 112,121 ****
 def do_find(self, ok=0):
 if not self.engine.getprog():
! return 0
 text = self.text
 res = self.engine.search_text(text, None, ok)
 if not res:
 text.bell()
! return 0
 line, m = res
 i, j = m.span()
--- 112,121 ----
 def do_find(self, ok=0):
 if not self.engine.getprog():
! return False
 text = self.text
 res = self.engine.search_text(text, None, ok)
 if not res:
 text.bell()
! return False
 line, m = res
 i, j = m.span()
***************
*** 124,133 ****
 self.show_hit(first, last)
 self.ok = 1
! return 1
 
 def do_replace(self):
 prog = self.engine.getprog()
 if not prog:
! return 0
 text = self.text
 try:
--- 124,133 ----
 self.show_hit(first, last)
 self.ok = 1
! return True
 
 def do_replace(self):
 prog = self.engine.getprog()
 if not prog:
! return False
 text = self.text
 try:
***************
*** 142,146 ****
 m = prog.match(chars, col)
 if not prog:
! return 0
 new = self._expand(m, self.replvar.get())
 text.mark_set("insert", first)
--- 142,146 ----
 m = prog.match(chars, col)
 if not prog:
! return False
 new = self._expand(m, self.replvar.get())
 text.mark_set("insert", first)
***************
*** 153,157 ****
 self.show_hit(first, text.index("insert"))
 self.ok = 0
! return 1
 
 def _expand(self, m, template):
--- 153,157 ----
 self.show_hit(first, text.index("insert"))
 self.ok = 0
! return True
 
 def _expand(self, m, template):
Index: SearchDialog.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/idle/SearchDialog.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SearchDialog.py	28 Jan 1999 19:04:01 -0000	1.2
--- SearchDialog.py	4 Apr 2002 22:55:58 -0000	1.3
***************
*** 35,41 ****
 if not self.engine.getpat():
 self.open(text)
! return 0
 if not self.engine.getprog():
! return 0
 res = self.engine.search_text(text)
 if res:
--- 35,41 ----
 if not self.engine.getpat():
 self.open(text)
! return False
 if not self.engine.getprog():
! return False
 res = self.engine.search_text(text)
 if res:
***************
*** 49,53 ****
 if selfirst == first and sellast == last:
 text.bell()
! return 0
 except TclError:
 pass
--- 49,53 ----
 if selfirst == first and sellast == last:
 text.bell()
! return False
 except TclError:
 pass
***************
*** 56,63 ****
 text.mark_set("insert", self.engine.isback() and first or last)
 text.see("insert")
! return 1
 else:
 text.bell()
! return 0
 
 def find_selection(self, text):
--- 56,63 ----
 text.mark_set("insert", self.engine.isback() and first or last)
 text.see("insert")
! return True
 else:
 text.bell()
! return False
 
 def find_selection(self, text):

AltStyle によって変換されたページ (->オリジナル) /