Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/idlelib/textView.py

    r2 r391  
    1010
    1111    """
    12     def __init__(self, parent, title, text):
     12    def __init__(self, parent, title, text, modal=True):
    1313        """Show the given text in a scrollable window with a 'close' button
    1414
     
    2525        self.CreateWidgets()
    2626        self.title(title)
    27         self.transient(parent)
    28         self.grab_set()
    2927        self.protocol("WM_DELETE_WINDOW", self.Ok)
    3028        self.parent = parent
     
    3533        self.textView.insert(0.0, text)
    3634        self.textView.config(state=DISABLED)
    37         self.wait_window()
     35
     36        if modal:
     37            self.transient(parent)
     38            self.grab_set()
     39            self.wait_window()
    3840
    3941    def CreateWidgets(self):
     
    5860
    5961
    60 def view_text(parent, title, text):
    61     TextViewer(parent, title, text)
     62def view_text(parent, title, text, modal=True):
     63    return TextViewer(parent, title, text, modal)
    6264
    63 def view_file(parent, title, filename, encoding=None):
     65def view_file(parent, title, filename, encoding=None, modal=True):
    6466    try:
    6567        if encoding:
     
    7476                               parent=parent)
    7577    else:
    76         return view_text(parent, title, textFile.read())
     78        return view_text(parent, title, textFile.read(), modal)
    7779
    7880
     
    8486    text = file(filename, 'r').read()
    8587    btn1 = Button(root, text='view_text',
    86                  command=lambda:view_text(root, 'view_text', text))
     88                  command=lambda:view_text(root, 'view_text', text))
    8789    btn1.pack(side=LEFT)
    8890    btn2 = Button(root, text='view_file',
    8991                  command=lambda:view_file(root, 'view_file', filename))
    9092    btn2.pack(side=LEFT)
     93    btn3 = Button(root, text='nonmodal view_text',
     94                  command=lambda:view_text(root, 'nonmodal view_text', text,
     95                                           modal=False))
     96    btn3.pack(side=LEFT)
    9197    close = Button(root, text='Close', command=root.destroy)
    9298    close.pack(side=RIGHT)
Note: See TracChangeset for help on using the changeset viewer.