summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/aboutDialog.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2007-10-04 02:53:07 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2007-10-04 02:53:07 (GMT)
commitd5f4910afdd95d86f51ed53a932a4c2fd181bd43 (patch)
treebb9ce7073bfb90e92d5d6bff5cefc9140631ca51 /Lib/idlelib/aboutDialog.py
parent0b634efcbcd10d9364796e9b048f18cd4a08b88b (diff)
downloadcpython-d5f4910afdd95d86f51ed53a932a4c2fd181bd43.zip
cpython-d5f4910afdd95d86f51ed53a932a4c2fd181bd43.tar.gz
cpython-d5f4910afdd95d86f51ed53a932a4c2fd181bd43.tar.bz2
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py M idlelib/aboutDialog.py M idlelib/textView.py M idlelib/NEWS.txt
Diffstat (limited to 'Lib/idlelib/aboutDialog.py')
-rw-r--r--Lib/idlelib/aboutDialog.py43
1 files changed, 15 insertions, 28 deletions
diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py
index c121061..008602c 100644
--- a/Lib/idlelib/aboutDialog.py
+++ b/Lib/idlelib/aboutDialog.py
@@ -3,7 +3,8 @@
"""
from Tkinter import *
-import string, os
+import os
+import os.path
import textView
import idlever
@@ -70,7 +71,7 @@ class AboutDialog(Toplevel):
tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:]
if tkVer[len(tkVer)-1] == '':
tkVer[len(tkVer)-1] = '0'
- tkVer = string.join(tkVer,'.')
+ tkVer = '.'.join(tkVer)
labelTkVer = Label(frameBg, text='Tk version: '+
tkVer, fg=self.fg, bg=self.bg)
labelTkVer.grid(row=9, column=1, sticky=W, padx=2, pady=0)
@@ -110,45 +111,31 @@ class AboutDialog(Toplevel):
idle_credits_b.pack(side=LEFT, padx=10, pady=10)
def ShowLicense(self):
- self.display_printer_text(license, 'About - License')
+ self.display_printer_text('About - License', license)
def ShowCopyright(self):
- self.display_printer_text(copyright, 'About - Copyright')
+ self.display_printer_text('About - Copyright', copyright)
def ShowPythonCredits(self):
- self.display_printer_text(credits, 'About - Python Credits')
+ self.display_printer_text('About - Python Credits', credits)
def ShowIDLECredits(self):
- self.ViewFile('About - Credits','CREDITS.txt', 'iso-8859-1')
+ self.display_file_text('About - Credits', 'CREDITS.txt', 'iso-8859-1')
def ShowIDLEAbout(self):
- self.ViewFile('About - Readme', 'README.txt')
+ self.display_file_text('About - Readme', 'README.txt')
def ShowIDLENEWS(self):
- self.ViewFile('About - NEWS', 'NEWS.txt')
+ self.display_file_text('About - NEWS', 'NEWS.txt')
- def display_printer_text(self, printer, title):
+ def display_printer_text(self, title, printer):
printer._Printer__setup()
- data = '\n'.join(printer._Printer__lines)
- textView.TextViewer(self, title, None, data)
+ text = '\n'.join(printer._Printer__lines)
+ textView.view_text(self, title, text)
- def ViewFile(self, viewTitle, viewFile, encoding=None):
- fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), viewFile)
- if encoding:
- import codecs
- try:
- textFile = codecs.open(fn, 'r')
- except IOError:
- import tkMessageBox
- tkMessageBox.showerror(title='File Load Error',
- message='Unable to load file %r .' % (fn,),
- parent=self)
- return
- else:
- data = textFile.read()
- else:
- data = None
- textView.TextViewer(self, viewTitle, fn, data=data)
+ def display_file_text(self, title, filename, encoding=None):
+ fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename)
+ textView.view_file(self, title, fn, encoding)
def Ok(self, event=None):
self.destroy()