Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
idlelib.PyShell.PyShell Class Reference
Inheritance diagram for idlelib.PyShell.PyShell:
Inheritance graph
[legend]
Collaboration diagram for idlelib.PyShell.PyShell:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def ispythonsource
def short_title
def maybesave
def write
def writelines
def flush
def close_hook
def new_callback
def home_callback
def set_status_bar
def set_line_and_column
def createmenubar
def postwindowsmenu
def right_menu_event
def make_rmenu
def about_dialog
def config_dialog
def help_dialog
def python_docs
def cut
def copy
def paste
def select_all
def remove_selection
def move_at_edge_if_selection
def del_word_left
def del_word_right
def find_event
def find_again_event
def find_selection_event
def find_in_files_event
def replace_event
def goto_line_event
def open_module
def open_class_browser
def open_path_browser
def gotoline
def set_close_hook
def filename_change_hook
def ResetColorizer
def colorize_syntax_error
def ResetFont
def RemoveKeybindings
def ApplyKeybindings
def set_notabs_indentwidth
def reset_help_menu_entries
def update_recent_files_list
def saved_change_hook
def get_saved
def set_saved
def reset_undo
def long_title
def center_insert_event
def center
def getwindowlines
def getlineno
def get_geometry
def close_event
def close
def load_extensions
def unload_extensions
def load_standard_extensions
def get_standard_extension_names
def load_extension
def apply_bindings
def fill_menus
def getvar
def setvar
def get_var_obj
def is_char_in_string
def get_selection_indices
def get_tk_tabwidth
def set_tk_tabwidth
def set_indentation_params
 begin autoindent code ### (configuration was moved to beginning of class)
def smart_backspace_event
def smart_indent_event
def newline_and_indent_event
def indent_region_event
def dedent_region_event
def comment_region_event
def uncomment_region_event
def tabify_region_event
def untabify_region_event
def toggle_tabs_event

Public Attributes

 interp
 flist
 root
 menubar
 top
 tkinter_vars
 recent_files_path
 text_frame
 vbar
 width
 text
 usetabs
 tabwidth
 indentwidth
 context_use_ps1
 num_context_lines
 per
 undo
 io
 good_load
 color
 wmenu_end
 askyesno
 askinteger
 showerror
 status_bar
 menudict
 recent_files_menu
 base_helpmenu_length
 event
 close_hook
 extensions
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

string shell_title = "Python Shell"
 ColorDelegator = ModifiedColorDelegator
 UndoDelegator = ModifiedUndoDelegator
list menu_specs
list rmenu_specs
list file_line_pats
 help_url = None
 rmenu = None
string IDENTCHARS = "_"

Detailed Description

Definition at line 764 of file PyShell.py.


Constructor & Destructor Documentation

def idlelib.PyShell.PyShell.__init__ (   self,
  flist = None 
)

Reimplemented from idlelib.OutputWindow.OutputWindow.

Definition at line 790 of file PyShell.py.

00790 
00791     def __init__(self, flist=None):
00792         if use_subprocess:
00793             ms = self.menu_specs
00794             if ms[2][0] != "shell":
00795                 ms.insert(2, ("shell", "She_ll"))
00796         self.interp = ModifiedInterpreter(self)
00797         if flist is None:
00798             root = Tk()
00799             fixwordbreaks(root)
00800             root.withdraw()
00801             flist = PyShellFileList(root)
00802         #
00803         OutputWindow.__init__(self, flist, None, None)
        #

Here is the caller graph for this function:


Member Function Documentation

def idlelib.EditorWindow.EditorWindow.about_dialog (   self,
  event = None 
) [inherited]

Definition at line 449 of file EditorWindow.py.

00449 
00450     def about_dialog(self, event=None):
00451         aboutDialog.AboutDialog(self.top,'About IDLE')

def idlelib.EditorWindow.EditorWindow.apply_bindings (   self,
  keydefs = None 
) [inherited]

Definition at line 978 of file EditorWindow.py.

00978 
00979     def apply_bindings(self, keydefs=None):
00980         if keydefs is None:
00981             keydefs = self.Bindings.default_keydefs
00982         text = self.text
00983         text.keydefs = keydefs
00984         for event, keylist in keydefs.items():
00985             if keylist:
00986                 text.event_add(event, *keylist)

Here is the caller graph for this function:

Definition at line 708 of file EditorWindow.py.

00708 
00709     def ApplyKeybindings(self):
00710         "Update the keybindings after they are changed"
00711         # Called from configDialog.py
00712         self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
00713         self.apply_bindings()
00714         for extensionName in self.get_standard_extension_names():
00715             xkeydefs = idleConf.GetExtensionBindings(extensionName)
00716             if xkeydefs:
00717                 self.apply_bindings(xkeydefs)
00718         #update menu accelerators
00719         menuEventDict = {}
00720         for menu in self.Bindings.menudefs:
00721             menuEventDict[menu[0]] = {}
00722             for item in menu[1]:
00723                 if item:
00724                     menuEventDict[menu[0]][prepstr(item[0])[1]] = item[1]
00725         for menubarItem in self.menudict:
00726             menu = self.menudict[menubarItem]
00727             end = menu.index(END) + 1
00728             for index in range(0, end):
00729                 if menu.type(index) == 'command':
00730                     accel = menu.entrycget(index, 'accelerator')
00731                     if accel:
00732                         itemName = menu.entrycget(index, 'label')
00733                         event = ''
00734                         if menubarItem in menuEventDict:
00735                             if itemName in menuEventDict[menubarItem]:
00736                                 event = menuEventDict[menubarItem][itemName]
00737                         if event:
00738                             accel = get_accelerator(keydefs, event)
00739                             menu.entryconfig(index, accelerator=accel)

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.center (   self,
  mark = "insert" 
) [inherited]

Definition at line 867 of file EditorWindow.py.

00867 
00868     def center(self, mark="insert"):
00869         text = self.text
00870         top, bot = self.getwindowlines()
00871         lineno = self.getlineno(mark)
00872         height = bot - top
00873         newtop = max(1, lineno - height//2)
00874         text.yview(float(newtop))

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.center_insert_event (   self,
  event 
) [inherited]

Definition at line 864 of file EditorWindow.py.

00864 
00865     def center_insert_event(self, event):
00866         self.center()

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.close (   self) [inherited]

Definition at line 907 of file EditorWindow.py.

00907 
00908     def close(self):
00909         reply = self.maybesave()
00910         if str(reply) != "cancel":
00911             self._close()
00912         return reply

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.close_event (   self,
  event 
) [inherited]

Definition at line 895 of file EditorWindow.py.

00895 
00896     def close_event(self, event):
00897         self.close()

Here is the call graph for this function:

Definition at line 623 of file EditorWindow.py.

00623 
00624     def close_hook(self):
00625         if self.flist:
00626             self.flist.unregister_maybe_terminate(self)
00627             self.flist = None

def idlelib.EditorWindow.EditorWindow.colorize_syntax_error (   self,
  text,
  pos 
) [inherited]

Definition at line 675 of file EditorWindow.py.

00675 
00676     def colorize_syntax_error(self, text, pos):
00677         text.tag_add("ERROR", pos)
00678         char = text.get(pos)
00679         if char and char in self.IDENTCHARS:
00680             text.tag_add("ERROR", pos + " wordstart", pos)
00681         if '\n' == text.get(pos):   # error at line end
00682             text.mark_set("insert", pos)
00683         else:
00684             text.mark_set("insert", pos + "+1c")
00685         text.see(pos)

def idlelib.EditorWindow.EditorWindow.comment_region_event (   self,
  event 
) [inherited]

Definition at line 1319 of file EditorWindow.py.

01319 
01320     def comment_region_event(self, event):
01321         head, tail, chars, lines = self.get_region()
01322         for pos in range(len(lines) - 1):
01323             line = lines[pos]
01324             lines[pos] = '##' + line
01325         self.set_region(head, tail, chars, lines)

def idlelib.EditorWindow.EditorWindow.config_dialog (   self,
  event = None 
) [inherited]

Definition at line 452 of file EditorWindow.py.

00452 
00453     def config_dialog(self, event=None):
00454         configDialog.ConfigDialog(self.top,'Settings')

def idlelib.EditorWindow.EditorWindow.copy (   self,
  event 
) [inherited]

Definition at line 474 of file EditorWindow.py.

00474 
00475     def copy(self,event):
00476         if not self.text.tag_ranges("sel"):
00477             # There is no selection, so do nothing and maybe interrupt.
00478             return
00479         self.text.event_generate("<<Copy>>")
00480         return "break"

Definition at line 391 of file EditorWindow.py.

00391 
00392     def createmenubar(self):
00393         mbar = self.menubar
00394         self.menudict = menudict = {}
00395         for name, label in self.menu_specs:
00396             underline, label = prepstr(label)
00397             menudict[name] = menu = Menu(mbar, name=name)
00398             mbar.add_cascade(label=label, menu=menu, underline=underline)
00399         if macosxSupport.isCarbonAquaTk(self.root):
00400             # Insert the application menu
00401             menudict['application'] = menu = Menu(mbar, name='apple')
00402             mbar.add_cascade(label='IDLE', menu=menu)
00403         self.fill_menus()
00404         self.recent_files_menu = Menu(self.menubar)
00405         self.menudict['file'].insert_cascade(3, label='Recent Files',
00406                                              underline=0,
00407                                              menu=self.recent_files_menu)
00408         self.base_helpmenu_length = self.menudict['help'].index(END)
00409         self.reset_help_menu_entries()

def idlelib.EditorWindow.EditorWindow.cut (   self,
  event 
) [inherited]

Definition at line 470 of file EditorWindow.py.

00470 
00471     def cut(self,event):
00472         self.text.event_generate("<<Cut>>")
00473         return "break"

def idlelib.EditorWindow.EditorWindow.dedent_region_event (   self,
  event 
) [inherited]

Definition at line 1308 of file EditorWindow.py.

01308 
01309     def dedent_region_event(self, event):
01310         head, tail, chars, lines = self.get_region()
01311         for pos in range(len(lines)):
01312             line = lines[pos]
01313             if line:
01314                 raw, effective = classifyws(line, self.tabwidth)
01315                 effective = max(effective - self.indentwidth, 0)
01316                 lines[pos] = self._make_blanks(effective) + line[raw:]
01317         self.set_region(head, tail, chars, lines)
01318         return "break"

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.del_word_left (   self,
  event 
) [inherited]

Definition at line 516 of file EditorWindow.py.

00516 
00517     def del_word_left(self, event):
00518         self.text.event_generate('<Meta-Delete>')
00519         return "break"

def idlelib.EditorWindow.EditorWindow.del_word_right (   self,
  event 
) [inherited]

Definition at line 520 of file EditorWindow.py.

00520 
00521     def del_word_right(self, event):
00522         self.text.event_generate('<Meta-d>')
00523         return "break"

Definition at line 631 of file EditorWindow.py.

00631 
00632     def filename_change_hook(self):
00633         if self.flist:
00634             self.flist.filename_changed_edit(self)
00635         self.saved_change_hook()
00636         self.top.update_windowlist_registry(self)
00637         self.ResetColorizer()

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.fill_menus (   self,
  menudefs = None,
  keydefs = None 
) [inherited]
Add appropriate entries to the menus and submenus

Menus that are absent or None in self.menudict are ignored.

Definition at line 987 of file EditorWindow.py.

00987 
00988     def fill_menus(self, menudefs=None, keydefs=None):
00989         """Add appropriate entries to the menus and submenus
00990 
00991         Menus that are absent or None in self.menudict are ignored.
00992         """
00993         if menudefs is None:
00994             menudefs = self.Bindings.menudefs
00995         if keydefs is None:
00996             keydefs = self.Bindings.default_keydefs
00997         menudict = self.menudict
00998         text = self.text
00999         for mname, entrylist in menudefs:
01000             menu = menudict.get(mname)
01001             if not menu:
01002                 continue
01003             for entry in entrylist:
01004                 if not entry:
01005                     menu.add_separator()
01006                 else:
01007                     label, eventname = entry
01008                     checkbutton = (label[:1] == '!')
01009                     if checkbutton:
01010                         label = label[1:]
01011                     underline, label = prepstr(label)
01012                     accelerator = get_accelerator(keydefs, eventname)
01013                     def command(text=text, eventname=eventname):
01014                         text.event_generate(eventname)
01015                     if checkbutton:
01016                         var = self.get_var_obj(eventname, BooleanVar)
01017                         menu.add_checkbutton(label=label, underline=underline,
01018                             command=command, accelerator=accelerator,
01019                             variable=var)
01020                     else:
01021                         menu.add_command(label=label, underline=underline,
01022                                          command=command,
01023                                          accelerator=accelerator)

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.find_again_event (   self,
  event 
) [inherited]

Definition at line 528 of file EditorWindow.py.

00528 
00529     def find_again_event(self, event):
00530         SearchDialog.find_again(self.text)
00531         return "break"

def idlelib.EditorWindow.EditorWindow.find_event (   self,
  event 
) [inherited]

Definition at line 524 of file EditorWindow.py.

00524 
00525     def find_event(self, event):
00526         SearchDialog.find(self.text)
00527         return "break"

def idlelib.EditorWindow.EditorWindow.find_in_files_event (   self,
  event 
) [inherited]

Definition at line 536 of file EditorWindow.py.

00536 
00537     def find_in_files_event(self, event):
00538         GrepDialog.grep(self.text, self.io, self.flist)
00539         return "break"

def idlelib.EditorWindow.EditorWindow.find_selection_event (   self,
  event 
) [inherited]

Definition at line 532 of file EditorWindow.py.

00532 
00533     def find_selection_event(self, event):
00534         SearchDialog.find_selection(self.text)
00535         return "break"

def idlelib.OutputWindow.OutputWindow.flush (   self) [inherited]

Definition at line 48 of file OutputWindow.py.

00048 
00049     def flush(self):
00050         pass

Here is the caller graph for this function:

Definition at line 889 of file EditorWindow.py.

00889 
00890     def get_geometry(self):
00891         "Return (width, height, x, y)"
00892         geom = self.top.wm_geometry()
00893         m = re.match(r"(\d+)x(\d+)\+(-?\d+)\+(-?\d+)", geom)
00894         return list(map(int, m.groups()))

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.get_saved (   self) [inherited]

Definition at line 844 of file EditorWindow.py.

00844 
00845     def get_saved(self):
00846         return self.undo.get_saved()

Here is the caller graph for this function:

Definition at line 1067 of file EditorWindow.py.

01067 
01068     def get_selection_indices(self):
01069         try:
01070             first = self.text.index("sel.first")
01071             last = self.text.index("sel.last")
01072             return first, last
01073         except TclError:
01074             return None, None

Here is the caller graph for this function:

Definition at line 951 of file EditorWindow.py.

00951 
00952     def get_standard_extension_names(self):
00953         return idleConf.GetExtensions(editor_only=True)

Here is the caller graph for this function:

Definition at line 1078 of file EditorWindow.py.

01078 
01079     def get_tk_tabwidth(self):
01080         current = self.text['tabs'] or TK_TABWIDTH_DEFAULT
01081         return int(current)

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.get_var_obj (   self,
  name,
  vartype = None 
) [inherited]

Definition at line 1039 of file EditorWindow.py.

01039 
01040     def get_var_obj(self, name, vartype=None):
01041         var = self.tkinter_vars.get(name)
01042         if not var and vartype:
01043             # create a Tkinter variable object with self.text as master:
01044             self.tkinter_vars[name] = var = vartype(self.text)
01045         return var

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.getlineno (   self,
  mark = "insert" 
) [inherited]

Definition at line 885 of file EditorWindow.py.

00885 
00886     def getlineno(self, mark="insert"):
00887         text = self.text
00888         return int(float(text.index(mark)))

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.getvar (   self,
  name 
) [inherited]

Definition at line 1024 of file EditorWindow.py.

01024 
01025     def getvar(self, name):
01026         var = self.get_var_obj(name)
01027         if var:
01028             value = var.get()
01029             return value
01030         else:
01031             raise NameError(name)

Here is the call graph for this function:

Definition at line 875 of file EditorWindow.py.

00875 
00876     def getwindowlines(self):
00877         text = self.text
00878         top = self.getlineno("@0,0")
00879         bot = self.getlineno("@0,65535")
00880         if top == bot and text.winfo_height() == 1:
00881             # Geometry manager hasn't run yet
00882             height = int(text['height'])
00883             bot = top + height - 1
00884         return top, bot

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.goto_line_event (   self,
  event 
) [inherited]

Definition at line 544 of file EditorWindow.py.

00544 
00545     def goto_line_event(self, event):
00546         text = self.text
00547         lineno = tkSimpleDialog.askinteger("Goto",
00548                 "Go to line number:",parent=text)
00549         if lineno is None:
00550             return "break"
00551         if lineno <= 0:
00552             text.bell()
00553             return "break"
00554         text.mark_set("insert", "%d.0" % lineno)
00555         text.see("insert")

def idlelib.EditorWindow.EditorWindow.gotoline (   self,
  lineno 
) [inherited]

Definition at line 607 of file EditorWindow.py.

00607 
00608     def gotoline(self, lineno):
00609         if lineno is not None and lineno > 0:
00610             self.text.mark_set("insert", "%d.0" % lineno)
00611             self.text.tag_remove("sel", "1.0", "end")
00612             self.text.tag_add("sel", "insert", "insert +1l")
00613             self.center()

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.help_dialog (   self,
  event = None 
) [inherited]

Definition at line 455 of file EditorWindow.py.

00455 
00456     def help_dialog(self, event=None):
00457         fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt')
00458         textView.view_file(self.top,'Help',fn)

def idlelib.EditorWindow.EditorWindow.home_callback (   self,
  event 
) [inherited]

Definition at line 316 of file EditorWindow.py.

00316 
00317     def home_callback(self, event):
00318         if (event.state & 4) != 0 and event.keysym == "Home":
00319             # state&4==Control. If <Control-Home>, use the Tk binding.
00320             return
00321         if self.text.index("iomark") and \
00322            self.text.compare("iomark", "<=", "insert lineend") and \
00323            self.text.compare("insert linestart", "<=", "iomark"):
00324             # In Shell on input line, go to just after prompt
00325             insertpt = int(self.text.index("iomark").split(".")[1])
00326         else:
00327             line = self.text.get("insert linestart", "insert lineend")
00328             for insertpt in range(len(line)):
00329                 if line[insertpt] not in (' ','\t'):
00330                     break
00331             else:
00332                 insertpt=len(line)
00333         lineat = int(self.text.index("insert").split('.')[1])
00334         if insertpt == lineat:
00335             insertpt = 0
00336         dest = "insert linestart+"+str(insertpt)+"c"
00337         if (event.state&1) == 0:
00338             # shift was not pressed
00339             self.text.tag_remove("sel", "1.0", "end")
00340         else:
00341             if not self.text.index("sel.first"):
00342                 self.text.mark_set("my_anchor", "insert")  # there was no previous selection
00343             else:
00344                 if self.text.compare(self.text.index("sel.first"), "<", self.text.index("insert")):
00345                     self.text.mark_set("my_anchor", "sel.first") # extend back
00346                 else:
00347                     self.text.mark_set("my_anchor", "sel.last") # extend forward
00348             first = self.text.index(dest)
00349             last = self.text.index("my_anchor")
00350             if self.text.compare(first,">",last):
00351                 first,last = last,first
00352             self.text.tag_remove("sel", "1.0", "end")
00353             self.text.tag_add("sel", first, last)
00354         self.text.mark_set("insert", dest)
00355         self.text.see("insert")
00356         return "break"

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.indent_region_event (   self,
  event 
) [inherited]

Definition at line 1297 of file EditorWindow.py.

01297 
01298     def indent_region_event(self, event):
01299         head, tail, chars, lines = self.get_region()
01300         for pos in range(len(lines)):
01301             line = lines[pos]
01302             if line:
01303                 raw, effective = classifyws(line, self.tabwidth)
01304                 effective = effective + self.indentwidth
01305                 lines[pos] = self._make_blanks(effective) + line[raw:]
01306         self.set_region(head, tail, chars, lines)
01307         return "break"

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.is_char_in_string (   self,
  text_index 
) [inherited]

Definition at line 1055 of file EditorWindow.py.

01055 
01056     def is_char_in_string(self, text_index):
01057         if self.color:
01058             # Return true iff colorizer hasn't (re)gotten this far
01059             # yet, or the character is tagged as being in a string
01060             return self.text.tag_prevrange("TODO", text_index) or \
01061                    "STRING" in self.text.tag_names(text_index)
01062         else:
01063             # The colorizer is missing: assume the worst
01064             return 1

Here is the caller graph for this function:

def idlelib.OutputWindow.OutputWindow.ispythonsource (   self,
  filename 
) [inherited]

Reimplemented from idlelib.EditorWindow.EditorWindow.

Definition at line 21 of file OutputWindow.py.

00021 
00022     def ispythonsource(self, filename):
00023         # No colorization needed
00024         return 0

def idlelib.EditorWindow.EditorWindow.load_extension (   self,
  name 
) [inherited]

Definition at line 954 of file EditorWindow.py.

00954 
00955     def load_extension(self, name):
00956         try:
00957             mod = __import__(name, globals(), locals(), [])
00958         except ImportError:
00959             print("\nFailed to import extension: ", name)
00960             raise
00961         cls = getattr(mod, name)
00962         keydefs = idleConf.GetExtensionBindings(name)
00963         if hasattr(cls, "menudefs"):
00964             self.fill_menus(cls.menudefs, keydefs)
00965         ins = cls(self)
00966         self.extensions[name] = ins
00967         if keydefs:
00968             self.apply_bindings(keydefs)
00969             for vevent in keydefs:
00970                 methodname = vevent.replace("-", "_")
00971                 while methodname[:1] == '<':
00972                     methodname = methodname[1:]
00973                 while methodname[-1:] == '>':
00974                     methodname = methodname[:-1]
00975                 methodname = methodname + "_event"
00976                 if hasattr(ins, methodname):
00977                     self.text.bind(vevent, getattr(ins, methodname))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 933 of file EditorWindow.py.

00933 
00934     def load_extensions(self):
00935         self.extensions = {}
00936         self.load_standard_extensions()

Definition at line 943 of file EditorWindow.py.

00943 
00944     def load_standard_extensions(self):
00945         for name in self.get_standard_extension_names():
00946             try:
00947                 self.load_extension(name)
00948             except:
00949                 print("Failed to load extension", repr(name))
00950                 traceback.print_exc()

Here is the call graph for this function:

Definition at line 860 of file EditorWindow.py.

00860 
00861     def long_title(self):
00862         # return unicode string to display non-ASCII chars correctly
00863         return self._filename_to_unicode(self.io.filename or "")

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 441 of file EditorWindow.py.

00441 
00442     def make_rmenu(self):
00443         rmenu = Menu(self.text, tearoff=0)
00444         for label, eventname in self.rmenu_specs:
00445             def command(text=self.text, eventname=eventname):
00446                 text.event_generate(eventname)
00447             rmenu.add_command(label=label, command=command)
00448         self.rmenu = rmenu

Here is the caller graph for this function:

def idlelib.OutputWindow.OutputWindow.maybesave (   self) [inherited]

Reimplemented from idlelib.EditorWindow.EditorWindow.

Definition at line 28 of file OutputWindow.py.

00028 
00029     def maybesave(self):
00030         # Override base class method -- don't ask any questions
00031         if self.get_saved():
00032             return "yes"
00033         else:
00034             return "no"

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.move_at_edge_if_selection (   self,
  edge_index 
) [inherited]
Cursor move begins at start or end of selection

When a left/right cursor key is pressed create and return to Tkinter a
function which causes a cursor move from the associated edge of the
selection.

Definition at line 496 of file EditorWindow.py.

00496 
00497     def move_at_edge_if_selection(self, edge_index):
00498         """Cursor move begins at start or end of selection
00499 
00500         When a left/right cursor key is pressed create and return to Tkinter a
00501         function which causes a cursor move from the associated edge of the
00502         selection.
00503 
00504         """
00505         self_text_index = self.text.index
00506         self_text_mark_set = self.text.mark_set
00507         edges_table = ("sel.first+1c", "sel.last-1c")
00508         def move_at_edge(event):
00509             if (event.state & 5) == 0: # no shift(==1) or control(==4) pressed
00510                 try:
00511                     self_text_index("sel.first")
00512                     self_text_mark_set("insert", edges_table[edge_index])
00513                 except TclError:
00514                     pass
00515         return move_at_edge

def idlelib.EditorWindow.EditorWindow.new_callback (   self,
  event 
) [inherited]

Definition at line 311 of file EditorWindow.py.

00311 
00312     def new_callback(self, event):
00313         dirname, basename = self.io.defaultfilename()
00314         self.flist.new(dirname)
00315         return "break"

def idlelib.EditorWindow.EditorWindow.newline_and_indent_event (   self,
  event 
) [inherited]

Definition at line 1184 of file EditorWindow.py.

01184 
01185     def newline_and_indent_event(self, event):
01186         text = self.text
01187         first, last = self.get_selection_indices()
01188         text.undo_block_start()
01189         try:
01190             if first and last:
01191                 text.delete(first, last)
01192                 text.mark_set("insert", first)
01193             line = text.get("insert linestart", "insert")
01194             i, n = 0, len(line)
01195             while i < n and line[i] in " \t":
01196                 i = i+1
01197             if i == n:
01198                 # the cursor is in or at leading indentation in a continuation
01199                 # line; just inject an empty line at the start
01200                 text.insert("insert linestart", '\n')
01201                 return "break"
01202             indent = line[:i]
01203             # strip whitespace before insert point unless it's in the prompt
01204             i = 0
01205             last_line_of_prompt = sys.ps1.split('\n')[-1]
01206             while line and line[-1] in " \t" and line != last_line_of_prompt:
01207                 line = line[:-1]
01208                 i = i+1
01209             if i:
01210                 text.delete("insert - %d chars" % i, "insert")
01211             # strip whitespace after insert point
01212             while text.get("insert") in " \t":
01213                 text.delete("insert")
01214             # start new line
01215             text.insert("insert", '\n')
01216 
01217             # adjust indentation for continuations and block
01218             # open/close first need to find the last stmt
01219             lno = index2line(text.index('insert'))
01220             y = PyParse.Parser(self.indentwidth, self.tabwidth)
01221             if not self.context_use_ps1:
01222                 for context in self.num_context_lines:
01223                     startat = max(lno - context, 1)
01224                     startatindex = repr(startat) + ".0"
01225                     rawtext = text.get(startatindex, "insert")
01226                     y.set_str(rawtext)
01227                     bod = y.find_good_parse_start(
01228                               self.context_use_ps1,
01229                               self._build_char_in_string_func(startatindex))
01230                     if bod is not None or startat == 1:
01231                         break
01232                 y.set_lo(bod or 0)
01233             else:
01234                 r = text.tag_prevrange("console", "insert")
01235                 if r:
01236                     startatindex = r[1]
01237                 else:
01238                     startatindex = "1.0"
01239                 rawtext = text.get(startatindex, "insert")
01240                 y.set_str(rawtext)
01241                 y.set_lo(0)
01242 
01243             c = y.get_continuation_type()
01244             if c != PyParse.C_NONE:
01245                 # The current stmt hasn't ended yet.
01246                 if c == PyParse.C_STRING_FIRST_LINE:
01247                     # after the first line of a string; do not indent at all
01248                     pass
01249                 elif c == PyParse.C_STRING_NEXT_LINES:
01250                     # inside a string which started before this line;
01251                     # just mimic the current indent
01252                     text.insert("insert", indent)
01253                 elif c == PyParse.C_BRACKET:
01254                     # line up with the first (if any) element of the
01255                     # last open bracket structure; else indent one
01256                     # level beyond the indent of the line with the
01257                     # last open bracket
01258                     self.reindent_to(y.compute_bracket_indent())
01259                 elif c == PyParse.C_BACKSLASH:
01260                     # if more than one line in this stmt already, just
01261                     # mimic the current indent; else if initial line
01262                     # has a start on an assignment stmt, indent to
01263                     # beyond leftmost =; else to beyond first chunk of
01264                     # non-whitespace on initial line
01265                     if y.get_num_lines_in_stmt() > 1:
01266                         text.insert("insert", indent)
01267                     else:
01268                         self.reindent_to(y.compute_backslash_indent())
01269                 else:
01270                     assert 0, "bogus continuation type %r" % (c,)
01271                 return "break"
01272 
01273             # This line starts a brand new stmt; indent relative to
01274             # indentation of initial line of closest preceding
01275             # interesting stmt.
01276             indent = y.get_base_indent_string()
01277             text.insert("insert", indent)
01278             if y.is_block_opener():
01279                 self.smart_indent_event(event)
01280             elif indent and y.is_block_closer():
01281                 self.smart_backspace_event(event)
01282             return "break"
01283         finally:
01284             text.see("insert")
01285             text.undo_block_stop()

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.open_class_browser (   self,
  event = None 
) [inherited]

Definition at line 589 of file EditorWindow.py.

00589 
00590     def open_class_browser(self, event=None):
00591         filename = self.io.filename
00592         if not filename:
00593             tkMessageBox.showerror(
00594                 "No filename",
00595                 "This buffer has no associated filename",
00596                 master=self.text)
00597             self.text.focus_set()
00598             return None
00599         head, tail = os.path.split(filename)
00600         base, ext = os.path.splitext(tail)
00601         from idlelib import ClassBrowser
00602         ClassBrowser.ClassBrowser(self.flist, base, [head])

def idlelib.EditorWindow.EditorWindow.open_module (   self,
  event = None 
) [inherited]

Definition at line 556 of file EditorWindow.py.

00556 
00557     def open_module(self, event=None):
00558         # XXX Shouldn't this be in IOBinding?
00559         try:
00560             name = self.text.get("sel.first", "sel.last")
00561         except TclError:
00562             name = ""
00563         else:
00564             name = name.strip()
00565         name = tkSimpleDialog.askstring("Module",
00566                  "Enter the name of a Python module\n"
00567                  "to search on sys.path and open:",
00568                  parent=self.text, initialvalue=name)
00569         if name:
00570             name = name.strip()
00571         if not name:
00572             return
00573         # XXX Ought to insert current file's directory in front of path
00574         try:
00575             (f, file, (suffix, mode, type)) = _find_module(name)
00576         except (NameError, ImportError) as msg:
00577             tkMessageBox.showerror("Import error", str(msg), parent=self.text)
00578             return
00579         if type != imp.PY_SOURCE:
00580             tkMessageBox.showerror("Unsupported type",
00581                 "%s is not a source module" % name, parent=self.text)
00582             return
00583         if f:
00584             f.close()
00585         if self.flist:
00586             self.flist.open(file)
00587         else:
00588             self.io.loadfile(file)

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.open_path_browser (   self,
  event = None 
) [inherited]

Definition at line 603 of file EditorWindow.py.

00603 
00604     def open_path_browser(self, event=None):
00605         from idlelib import PathBrowser
00606         PathBrowser.PathBrowser(self.flist)

def idlelib.EditorWindow.EditorWindow.paste (   self,
  event 
) [inherited]

Definition at line 481 of file EditorWindow.py.

00481 
00482     def paste(self,event):
00483         self.text.event_generate("<<Paste>>")
00484         self.text.see("insert")
00485         return "break"

Definition at line 410 of file EditorWindow.py.

00410 
00411     def postwindowsmenu(self):
00412         # Only called when Windows menu exists
00413         menu = self.menudict['windows']
00414         end = menu.index("end")
00415         if end is None:
00416             end = -1
00417         if end > self.wmenu_end:
00418             menu.delete(self.wmenu_end+1, end)
00419         WindowList.add_windows_to_menu(menu)

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.python_docs (   self,
  event = None 
) [inherited]

Definition at line 459 of file EditorWindow.py.

00459 
00460     def python_docs(self, event=None):
00461         if sys.platform[:3] == 'win':
00462             try:
00463                 os.startfile(self.help_url)
00464             except WindowsError as why:
00465                 tkMessageBox.showerror(title='Document Start Failure',
00466                     message=str(why), parent=self.text)
00467         else:
00468             webbrowser.open(self.help_url)
00469         return "break"

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.remove_selection (   self,
  event = None 
) [inherited]

Definition at line 492 of file EditorWindow.py.

00492 
00493     def remove_selection(self, event=None):
00494         self.text.tag_remove("sel", "1.0", "end")
00495         self.text.see("insert")

Definition at line 696 of file EditorWindow.py.

00696 
00697     def RemoveKeybindings(self):
00698         "Remove the keybindings before they are changed."
00699         # Called from configDialog.py
00700         self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
00701         for event, keylist in keydefs.items():
00702             self.text.event_delete(event, *keylist)
00703         for extensionName in self.get_standard_extension_names():
00704             xkeydefs = idleConf.GetExtensionBindings(extensionName)
00705             if xkeydefs:
00706                 for event, keylist in xkeydefs.items():
00707                     self.text.event_delete(event, *keylist)

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.replace_event (   self,
  event 
) [inherited]

Definition at line 540 of file EditorWindow.py.

00540 
00541     def replace_event(self, event):
00542         ReplaceDialog.replace(self.text)
00543         return "break"

Definition at line 747 of file EditorWindow.py.

00747 
00748     def reset_help_menu_entries(self):
00749         "Update the additional help entries on the Help menu"
00750         help_list = idleConf.GetAllExtraHelpSourcesList()
00751         helpmenu = self.menudict['help']
00752         # first delete the extra help entries, if any
00753         helpmenu_length = helpmenu.index(END)
00754         if helpmenu_length > self.base_helpmenu_length:
00755             helpmenu.delete((self.base_helpmenu_length + 1), helpmenu_length)
00756         # then rebuild them
00757         if help_list:
00758             helpmenu.add_separator()
00759             for entry in help_list:
00760                 cmd = self.__extra_help_callback(entry[1])
00761                 helpmenu.add_command(label=entry[0], command=cmd)
00762         # and update the menu dictionary
00763         self.menudict['help'] = helpmenu

Here is the call graph for this function:

Definition at line 850 of file EditorWindow.py.

00850 
00851     def reset_undo(self):
00852         self.undo.reset_undo()

Here is the caller graph for this function:

Definition at line 656 of file EditorWindow.py.

00656 
00657     def ResetColorizer(self):
00658         "Update the colour theme"
00659         # Called from self.filename_change_hook and from configDialog.py
00660         self._rmcolorizer()
00661         self._addcolorizer()
00662         theme = idleConf.GetOption('main','Theme','name')
00663         normal_colors = idleConf.GetHighlight(theme, 'normal')
00664         cursor_color = idleConf.GetHighlight(theme, 'cursor', fgBg='fg')
00665         select_colors = idleConf.GetHighlight(theme, 'hilite')
00666         self.text.config(
00667             foreground=normal_colors['foreground'],
00668             background=normal_colors['background'],
00669             insertbackground=cursor_color,
00670             selectforeground=select_colors['foreground'],
00671             selectbackground=select_colors['background'],
00672             )

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.ResetFont (   self) [inherited]

Definition at line 686 of file EditorWindow.py.

00686 
00687     def ResetFont(self):
00688         "Update the text widgets' font if it is changed"
00689         # Called from configDialog.py
00690         fontWeight='normal'
00691         if idleConf.GetOption('main','EditorWindow','font-bold',type='bool'):
00692             fontWeight='bold'
00693         self.text.config(font=(idleConf.GetOption('main','EditorWindow','font'),
00694                 idleConf.GetOption('main','EditorWindow','font-size'),
00695                 fontWeight))

def idlelib.EditorWindow.EditorWindow.right_menu_event (   self,
  event 
) [inherited]

Definition at line 422 of file EditorWindow.py.

00422 
00423     def right_menu_event(self, event):
00424         self.text.tag_remove("sel", "1.0", "end")
00425         self.text.mark_set("insert", "@%d,%d" % (event.x, event.y))
00426         if not self.rmenu:
00427             self.make_rmenu()
00428         rmenu = self.rmenu
00429         self.event = event
00430         iswin = sys.platform[:3] == 'win'
00431         if iswin:
00432             self.text.config(cursor="arrow")
00433         rmenu.tk_popup(event.x_root, event.y_root)
00434         if iswin:
00435             self.text.config(cursor="ibeam")

Here is the call graph for this function:

Definition at line 826 of file EditorWindow.py.

00826 
00827     def saved_change_hook(self):
00828         short = self.short_title()
00829         long = self.long_title()
00830         if short and long:
00831             title = short + " - " + long
00832         elif short:
00833             title = short
00834         elif long:
00835             title = long
00836         else:
00837             title = "Untitled"
00838         icon = short or long or title
00839         if not self.get_saved():
00840             title = "*%s*" % title
00841             icon = "*%s" % icon
00842         self.top.wm_title(title)
00843         self.top.wm_iconname(icon)

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.select_all (   self,
  event = None 
) [inherited]

Definition at line 486 of file EditorWindow.py.

00486 
00487     def select_all(self, event=None):
00488         self.text.tag_add("sel", "1.0", "end-1c")
00489         self.text.mark_set("insert", "1.0")
00490         self.text.see("insert")
00491         return "break"

def idlelib.EditorWindow.EditorWindow.set_close_hook (   self,
  close_hook 
) [inherited]

Definition at line 628 of file EditorWindow.py.

00628 
00629     def set_close_hook(self, close_hook):
00630         self.close_hook = close_hook

def idlelib.EditorWindow.EditorWindow.set_indentation_params (   self,
  is_py_src,
  guess = True 
) [inherited]

begin autoindent code ### (configuration was moved to beginning of class)

Definition at line 1095 of file EditorWindow.py.

01095 
01096     def set_indentation_params(self, is_py_src, guess=True):
01097         if is_py_src and guess:
01098             i = self.guess_indent()
01099             if 2 <= i <= 8:
01100                 self.indentwidth = i
01101             if self.indentwidth != self.tabwidth:
01102                 self.usetabs = False
01103         self.set_tk_tabwidth(self.tabwidth)

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.set_line_and_column (   self,
  event = None 
) [inherited]

Definition at line 371 of file EditorWindow.py.

00371 
00372     def set_line_and_column(self, event=None):
00373         line, column = self.text.index(INSERT).split('.')
00374         self.status_bar.set_label('column', 'Col: %s' % column)
00375         self.status_bar.set_label('line', 'Ln: %s' % line)

Here is the call graph for this function:

Definition at line 740 of file EditorWindow.py.

00740 
00741     def set_notabs_indentwidth(self):
00742         "Update the indentwidth if changed and not using tabs in this window"
00743         # Called from configDialog.py
00744         if not self.usetabs:
00745             self.indentwidth = idleConf.GetOption('main', 'Indent','num-spaces',
00746                                                   type='int')

def idlelib.EditorWindow.EditorWindow.set_saved (   self,
  flag 
) [inherited]

Definition at line 847 of file EditorWindow.py.

00847 
00848     def set_saved(self, flag):
00849         self.undo.set_saved(flag)

Here is the caller graph for this function:

Definition at line 357 of file EditorWindow.py.

00357 
00358     def set_status_bar(self):
00359         self.status_bar = self.MultiStatusBar(self.top)
00360         if macosxSupport.runningAsOSXApp():
00361             # Insert some padding to avoid obscuring some of the statusbar
00362             # by the resize widget.
00363             self.status_bar.set_label('_padding1', '    ', side=RIGHT)
00364         self.status_bar.set_label('column', 'Col: ?', side=RIGHT)
00365         self.status_bar.set_label('line', 'Ln: ?', side=RIGHT)
00366         self.status_bar.pack(side=BOTTOM, fill=X)
00367         self.text.bind("<<set-line-and-column>>", self.set_line_and_column)
00368         self.text.event_add("<<set-line-and-column>>",
00369                             "<KeyRelease>", "<ButtonRelease>")
00370         self.text.after_idle(self.set_line_and_column)

def idlelib.EditorWindow.EditorWindow.set_tk_tabwidth (   self,
  newtabwidth 
) [inherited]

Definition at line 1084 of file EditorWindow.py.

01084 
01085     def set_tk_tabwidth(self, newtabwidth):
01086         text = self.text
01087         if self.get_tk_tabwidth() != newtabwidth:
01088             # Set text widget tab width
01089             pixels = text.tk.call("font", "measure", text["font"],
01090                                   "-displayof", text.master,
01091                                   "n" * newtabwidth)
01092             text.configure(tabs=pixels)

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.setvar (   self,
  name,
  value,
  vartype = None 
) [inherited]

Definition at line 1032 of file EditorWindow.py.

01032 
01033     def setvar(self, name, value, vartype=None):
01034         var = self.get_var_obj(name, vartype)
01035         if var:
01036             var.set(value)
01037         else:
01038             raise NameError(name)

Here is the call graph for this function:

Reimplemented from idlelib.EditorWindow.EditorWindow.

Definition at line 25 of file OutputWindow.py.

00025 
00026     def short_title(self):
00027         return "Output"

def idlelib.EditorWindow.EditorWindow.smart_backspace_event (   self,
  event 
) [inherited]

Definition at line 1104 of file EditorWindow.py.

01104 
01105     def smart_backspace_event(self, event):
01106         text = self.text
01107         first, last = self.get_selection_indices()
01108         if first and last:
01109             text.delete(first, last)
01110             text.mark_set("insert", first)
01111             return "break"
01112         # Delete whitespace left, until hitting a real char or closest
01113         # preceding virtual tab stop.
01114         chars = text.get("insert linestart", "insert")
01115         if chars == '':
01116             if text.compare("insert", ">", "1.0"):
01117                 # easy: delete preceding newline
01118                 text.delete("insert-1c")
01119             else:
01120                 text.bell()     # at start of buffer
01121             return "break"
01122         if  chars[-1] not in " \t":
01123             # easy: delete preceding real char
01124             text.delete("insert-1c")
01125             return "break"
01126         # Ick.  It may require *inserting* spaces if we back up over a
01127         # tab character!  This is written to be clear, not fast.
01128         tabwidth = self.tabwidth
01129         have = len(chars.expandtabs(tabwidth))
01130         assert have > 0
01131         want = ((have - 1) // self.indentwidth) * self.indentwidth
01132         # Debug prompt is multilined....
01133         last_line_of_prompt = sys.ps1.split('\n')[-1]
01134         ncharsdeleted = 0
01135         while 1:
01136             if chars == last_line_of_prompt:
01137                 break
01138             chars = chars[:-1]
01139             ncharsdeleted = ncharsdeleted + 1
01140             have = len(chars.expandtabs(tabwidth))
01141             if have <= want or chars[-1] not in " \t":
01142                 break
01143         text.undo_block_start()
01144         text.delete("insert-%dc" % ncharsdeleted, "insert")
01145         if have < want:
01146             text.insert("insert", ' ' * (want - have))
01147         text.undo_block_stop()
01148         return "break"

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.smart_indent_event (   self,
  event 
) [inherited]

Definition at line 1149 of file EditorWindow.py.

01149 
01150     def smart_indent_event(self, event):
01151         # if intraline selection:
01152         #     delete it
01153         # elif multiline selection:
01154         #     do indent-region
01155         # else:
01156         #     indent one level
01157         text = self.text
01158         first, last = self.get_selection_indices()
01159         text.undo_block_start()
01160         try:
01161             if first and last:
01162                 if index2line(first) != index2line(last):
01163                     return self.indent_region_event(event)
01164                 text.delete(first, last)
01165                 text.mark_set("insert", first)
01166             prefix = text.get("insert linestart", "insert")
01167             raw, effective = classifyws(prefix, self.tabwidth)
01168             if raw == len(prefix):
01169                 # only whitespace to the left
01170                 self.reindent_to(effective + self.indentwidth)
01171             else:
01172                 # tab to the next 'stop' within or to right of line's text:
01173                 if self.usetabs:
01174                     pad = '\t'
01175                 else:
01176                     effective = len(prefix.expandtabs(self.tabwidth))
01177                     n = self.indentwidth
01178                     pad = ' ' * (n - effective % n)
01179                 text.insert("insert", pad)
01180             text.see("insert")
01181             return "break"
01182         finally:
01183             text.undo_block_stop()

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.tabify_region_event (   self,
  event 
) [inherited]

Definition at line 1339 of file EditorWindow.py.

01339 
01340     def tabify_region_event(self, event):
01341         head, tail, chars, lines = self.get_region()
01342         tabwidth = self._asktabwidth()
01343         for pos in range(len(lines)):
01344             line = lines[pos]
01345             if line:
01346                 raw, effective = classifyws(line, tabwidth)
01347                 ntabs, nspaces = divmod(effective, tabwidth)
01348                 lines[pos] = '\t' * ntabs + ' ' * nspaces + line[raw:]
01349         self.set_region(head, tail, chars, lines)

Here is the call graph for this function:

def idlelib.EditorWindow.EditorWindow.toggle_tabs_event (   self,
  event 
) [inherited]

Definition at line 1357 of file EditorWindow.py.

01357 
01358     def toggle_tabs_event(self, event):
01359         if self.askyesno(
01360               "Toggle tabs",
01361               "Turn tabs " + ("on", "off")[self.usetabs] +
01362               "?\nIndent width " +
01363               ("will be", "remains at")[self.usetabs] + " 8." +
01364               "\n Note: a tab is always 8 columns",
01365               parent=self.text):
01366             self.usetabs = not self.usetabs
01367             # Try to prevent inconsistent indentation.
01368             # User must change indent width manually after using tabs.
01369             self.indentwidth = 8
01370         return "break"

def idlelib.EditorWindow.EditorWindow.uncomment_region_event (   self,
  event 
) [inherited]

Definition at line 1326 of file EditorWindow.py.

01326 
01327     def uncomment_region_event(self, event):
01328         head, tail, chars, lines = self.get_region()
01329         for pos in range(len(lines)):
01330             line = lines[pos]
01331             if not line:
01332                 continue
01333             if line[:2] == '##':
01334                 line = line[2:]
01335             elif line[:1] == '#':
01336                 line = line[1:]
01337             lines[pos] = line
01338         self.set_region(head, tail, chars, lines)

Definition at line 937 of file EditorWindow.py.

00937 
00938     def unload_extensions(self):
00939         for ins in list(self.extensions.values()):
00940             if hasattr(ins, "close"):
00941                 ins.close()
00942         self.extensions = {}

Here is the caller graph for this function:

def idlelib.EditorWindow.EditorWindow.untabify_region_event (   self,
  event 
) [inherited]

Definition at line 1350 of file EditorWindow.py.

01350 
01351     def untabify_region_event(self, event):
01352         head, tail, chars, lines = self.get_region()
01353         tabwidth = self._asktabwidth()
01354         for pos in range(len(lines)):
01355             lines[pos] = lines[pos].expandtabs(tabwidth)
01356         self.set_region(head, tail, chars, lines)

def idlelib.EditorWindow.EditorWindow.update_recent_files_list (   self,
  new_file = None 
) [inherited]

Definition at line 779 of file EditorWindow.py.

00779 
00780     def update_recent_files_list(self, new_file=None):
00781         "Load and update the recent files list and menus"
00782         rf_list = []
00783         if os.path.exists(self.recent_files_path):
00784             rf_list_file = open(self.recent_files_path,'r',
00785                                 encoding='utf_8', errors='replace')
00786             try:
00787                 rf_list = rf_list_file.readlines()
00788             finally:
00789                 rf_list_file.close()
00790         if new_file:
00791             new_file = os.path.abspath(new_file) + '\n'
00792             if new_file in rf_list:
00793                 rf_list.remove(new_file)  # move to top
00794             rf_list.insert(0, new_file)
00795         # clean and save the recent files list
00796         bad_paths = []
00797         for path in rf_list:
00798             if '\0' in path or not os.path.exists(path[0:-1]):
00799                 bad_paths.append(path)
00800         rf_list = [path for path in rf_list if path not in bad_paths]
00801         ulchars = "1234567890ABCDEFGHIJK"
00802         rf_list = rf_list[0:len(ulchars)]
00803         rf_file = open(self.recent_files_path, 'w',
00804                         encoding='utf_8', errors='replace')
00805         try:
00806             rf_file.writelines(rf_list)
00807         finally:
00808             rf_file.close()
00809         # for each edit window instance, construct the recent files menu
00810         for instance in self.top.instance_dict:
00811             menu = instance.recent_files_menu
00812             menu.delete(1, END)  # clear, and rebuild:
00813             for i, file_name in enumerate(rf_list):
00814                 file_name = file_name.rstrip()  # zap \n
00815                 # make unicode string to display non-ASCII chars correctly
00816                 ufile_name = self._filename_to_unicode(file_name)
00817                 callback = instance.__recent_file_callback(file_name)
00818                 menu.add_command(label=ulchars[i] + " " + ufile_name,
00819                                  command=callback,
00820                                  underline=0)

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.OutputWindow.OutputWindow.write (   self,
  s,
  tags = (),
  mark = "insert" 
) [inherited]

Definition at line 37 of file OutputWindow.py.

00037 
00038     def write(self, s, tags=(), mark="insert"):
00039         if isinstance(s, (bytes, bytes)):
00040             s = s.decode(IOBinding.encoding, "replace")
00041         self.text.insert(mark, s, tags)
00042         self.text.see(mark)
00043         self.text.update()

def idlelib.OutputWindow.OutputWindow.writelines (   self,
  lines 
) [inherited]

Definition at line 44 of file OutputWindow.py.

00044 
00045     def writelines(self, lines):
00046         for line in lines:
00047             self.write(line)

Here is the call graph for this function:


Member Data Documentation

Definition at line 293 of file EditorWindow.py.

Definition at line 292 of file EditorWindow.py.

Definition at line 407 of file EditorWindow.py.

Definition at line 629 of file EditorWindow.py.

Definition at line 264 of file EditorWindow.py.

Definition at line 769 of file PyShell.py.

Definition at line 244 of file EditorWindow.py.

Definition at line 428 of file EditorWindow.py.

Definition at line 934 of file EditorWindow.py.

Initial value:
[
        # order of patterns matters
        r'file "([^"]

Definition at line 57 of file OutputWindow.py.

Definition at line 107 of file EditorWindow.py.

Definition at line 262 of file EditorWindow.py.

idlelib.EditorWindow.EditorWindow.help_url = None [static, inherited]

Definition at line 75 of file EditorWindow.py.

Definition at line 673 of file EditorWindow.py.

Definition at line 239 of file EditorWindow.py.

Definition at line 795 of file PyShell.py.

Definition at line 260 of file EditorWindow.py.

Initial value:
[
        ("file", "_File"),
        ("edit", "_Edit"),
        ("debug", "_Debug"),
        ("options", "_Options"),
        ("windows", "_Windows"),
        ("help", "_Help"),
    ]

Reimplemented from idlelib.EditorWindow.EditorWindow.

Definition at line 773 of file PyShell.py.

Definition at line 114 of file EditorWindow.py.

Definition at line 393 of file EditorWindow.py.

Definition at line 252 of file EditorWindow.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 253 of file EditorWindow.py.

Definition at line 403 of file EditorWindow.py.

Definition at line 125 of file EditorWindow.py.

idlelib.EditorWindow.EditorWindow.rmenu = None [static, inherited]

Definition at line 420 of file EditorWindow.py.

Initial value:
[
        ("Go to file/line", "<<goto-file-line>>"),
    ]

Reimplemented from idlelib.EditorWindow.EditorWindow.

Definition at line 53 of file OutputWindow.py.

Definition at line 109 of file EditorWindow.py.

string idlelib.PyShell.PyShell.shell_title = "Python Shell" [static]

Definition at line 766 of file PyShell.py.

Definition at line 294 of file EditorWindow.py.

Definition at line 358 of file EditorWindow.py.

Definition at line 235 of file EditorWindow.py.

Definition at line 141 of file EditorWindow.py.

Definition at line 127 of file EditorWindow.py.

Definition at line 117 of file EditorWindow.py.

Definition at line 115 of file EditorWindow.py.

Definition at line 254 of file EditorWindow.py.

Definition at line 770 of file PyShell.py.

Definition at line 228 of file EditorWindow.py.

Definition at line 128 of file EditorWindow.py.

Definition at line 129 of file EditorWindow.py.

Definition at line 288 of file EditorWindow.py.


The documentation for this class was generated from the following file: