Back to index

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

List of all members.

Public Member Functions

def __init__
def set_breakpoint
def set_breakpoint_here
def clear_breakpoint_here
def clear_file_breaks
def store_file_breaks
def restore_file_breaks
def update_breakpoints
def ranges_to_linenumbers
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 ispythonsource
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 short_title
def long_title
def center_insert_event
def center
def getwindowlines
def getlineno
def get_geometry
def close_event
def maybesave
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

 breakpoints
 breakpointPath
 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

list rmenu_specs
 help_url = None
list menu_specs
 rmenu = None
string IDENTCHARS = "_"

Private Member Functions

def _close

Detailed Description

Definition at line 98 of file PyShell.py.


Constructor & Destructor Documentation

Definition at line 101 of file PyShell.py.

00101 
00102     def __init__(self, *args):
00103         self.breakpoints = []
00104         EditorWindow.__init__(self, *args)
00105         self.text.bind("<<set-breakpoint-here>>", self.set_breakpoint_here)
00106         self.text.bind("<<clear-breakpoint-here>>", self.clear_breakpoint_here)
00107         self.text.bind("<<open-python-shell>>", self.flist.open_shell)
00108 
00109         self.breakpointPath = os.path.join(idleConf.GetUserCfgDir(),
00110                                            'breakpoints.lst')
00111         # whenever a file is changed, restore breakpoints
00112         if self.io.filename: self.restore_file_breaks()
00113         def filename_changed_hook(old_hook=self.io.filename_change_hook,
00114                                   self=self):
00115             self.restore_file_breaks()
00116             old_hook()
00117         self.io.set_filename_change_hook(filename_changed_hook)

Here is the caller graph for this function:


Member Function Documentation

Reimplemented from idlelib.EditorWindow.EditorWindow.

Definition at line 254 of file PyShell.py.

00254 
00255     def _close(self):
00256         "Extend base method - clear breaks when module is closed"
00257         self.clear_file_breaks()
00258         EditorWindow._close(self)
00259 

Here is the call graph for this function:

Here is the caller graph for this function:

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:

Definition at line 144 of file PyShell.py.

00144 
00145     def clear_breakpoint_here(self, event=None):
00146         text = self.text
00147         filename = self.io.filename
00148         if not filename:
00149             text.bell()
00150             return
00151         lineno = int(float(text.index("insert")))
00152         try:
00153             self.breakpoints.remove(lineno)
00154         except:
00155             pass
00156         text.tag_remove("BREAK", "insert linestart",\
00157                         "insert lineend +1char")
00158         try:
00159             debug = self.flist.pyshell.interp.debugger
00160             debug.clear_breakpoint_here(filename, lineno)
00161         except:
00162             pass

Definition at line 163 of file PyShell.py.

00163 
00164     def clear_file_breaks(self):
00165         if self.breakpoints:
00166             text = self.text
00167             filename = self.io.filename
00168             if not filename:
00169                 text.bell()
00170                 return
00171             self.breakpoints = []
00172             text.tag_remove("BREAK", "1.0", END)
00173             try:
00174                 debug = self.flist.pyshell.interp.debugger
00175                 debug.clear_file_breaks(filename)
00176             except:
00177                 pass

Here is the caller 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"

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.EditorWindow.EditorWindow.ispythonsource (   self,
  filename 
) [inherited]

Reimplemented in idlelib.OutputWindow.OutputWindow.

Definition at line 614 of file EditorWindow.py.

00614 
00615     def ispythonsource(self, filename):
00616         if not filename or os.path.isdir(filename):
00617             return True
00618         base, ext = os.path.splitext(os.path.basename(filename))
00619         if os.path.normcase(ext) in (".py", ".pyw"):
00620             return True
00621         line = self.text.get('1.0', '1.0 lineend')
00622         return line.startswith('#!') and 'python' in line

Here is the caller graph for this function:

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.EditorWindow.EditorWindow.maybesave (   self) [inherited]

Reimplemented in idlelib.OutputWindow.OutputWindow.

Definition at line 898 of file EditorWindow.py.

00898 
00899     def maybesave(self):
00900         if self.io:
00901             if not self.get_saved():
00902                 if self.top.state()!='normal':
00903                     self.top.deiconify()
00904                 self.top.lower()
00905                 self.top.lift()
00906             return self.io.maybesave()

Here is the call graph for this function:

Here is the caller 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:

Definition at line 237 of file PyShell.py.

00237 
00238     def ranges_to_linenumbers(self, ranges):
00239         lines = []
00240         for index in range(0, len(ranges), 2):
00241             lineno = int(float(ranges[index]))
00242             end = int(float(ranges[index+1]))
00243             while lineno < end:
00244                 lines.append(lineno)
00245                 lineno += 1
00246         return lines
00247 
00248 # XXX 13 Dec 2002 KBK Not used currently
00249 #    def saved_change_hook(self):
00250 #        "Extend base method - clear breaks if module is modified"
00251 #        if not self.get_saved():
00252 #            self.clear_file_breaks()
00253 #        EditorWindow.saved_change_hook(self)

Here is the caller 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))

Definition at line 217 of file PyShell.py.

00217 
00218     def restore_file_breaks(self):
00219         self.text.update()   # this enables setting "BREAK" tags to be visible
00220         filename = self.io.filename
00221         if filename is None:
00222             return
00223         if os.path.isfile(self.breakpointPath):
00224             lines = open(self.breakpointPath,"r").readlines()
00225             for line in lines:
00226                 if line.startswith(filename + '='):
00227                     breakpoint_linenumbers = eval(line[len(filename)+1:])
00228                     for breakpoint_linenumber in breakpoint_linenumbers:
00229                         self.set_breakpoint(breakpoint_linenumber)

Here is the call graph for this function:

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"

Definition at line 121 of file PyShell.py.

00121 
00122     def set_breakpoint(self, lineno):
00123         text = self.text
00124         filename = self.io.filename
00125         text.tag_add("BREAK", "%d.0" % lineno, "%d.0" % (lineno+1))
00126         try:
00127             i = self.breakpoints.index(lineno)
00128         except ValueError:  # only add if missing, i.e. do once
00129             self.breakpoints.append(lineno)
00130         try:    # update the subprocess debugger
00131             debug = self.flist.pyshell.interp.debugger
00132             debug.set_breakpoint_here(filename, lineno)
00133         except: # but debugger may not be active right now....
00134             pass

Here is the caller graph for this function:

def idlelib.PyShell.PyShellEditorWindow.set_breakpoint_here (   self,
  event = None 
)

Definition at line 135 of file PyShell.py.

00135 
00136     def set_breakpoint_here(self, event=None):
00137         text = self.text
00138         filename = self.io.filename
00139         if not filename:
00140             text.bell()
00141             return
00142         lineno = int(float(text.index("insert")))
00143         self.set_breakpoint(lineno)

Here is the call graph for this function:

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 in idlelib.OutputWindow.OutputWindow.

Definition at line 853 of file EditorWindow.py.

00853 
00854     def short_title(self):
00855         filename = self.io.filename
00856         if filename:
00857             filename = os.path.basename(filename)
00858         # return unicode string to display non-ASCII chars correctly
00859         return self._filename_to_unicode(filename)

Here is the call graph for this function:

Here is the caller graph for this function:

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:

Definition at line 178 of file PyShell.py.

00178 
00179     def store_file_breaks(self):
00180         "Save breakpoints when file is saved"
00181         # XXX 13 Dec 2002 KBK Currently the file must be saved before it can
00182         #     be run.  The breaks are saved at that time.  If we introduce
00183         #     a temporary file save feature the save breaks functionality
00184         #     needs to be re-verified, since the breaks at the time the
00185         #     temp file is created may differ from the breaks at the last
00186         #     permanent save of the file.  Currently, a break introduced
00187         #     after a save will be effective, but not persistent.
00188         #     This is necessary to keep the saved breaks synched with the
00189         #     saved file.
00190         #
00191         #     Breakpoints are set as tagged ranges in the text.  Certain
00192         #     kinds of edits cause these ranges to be deleted: Inserting
00193         #     or deleting a line just before a breakpoint, and certain
00194         #     deletions prior to a breakpoint.  These issues need to be
00195         #     investigated and understood.  It's not clear if they are
00196         #     Tk issues or IDLE issues, or whether they can actually
00197         #     be fixed.  Since a modified file has to be saved before it is
00198         #     run, and since self.breakpoints (from which the subprocess
00199         #     debugger is loaded) is updated during the save, the visible
00200         #     breaks stay synched with the subprocess even if one of these
00201         #     unexpected breakpoint deletions occurs.
00202         breaks = self.breakpoints
00203         filename = self.io.filename
00204         try:
00205             lines = open(self.breakpointPath,"r").readlines()
00206         except IOError:
00207             lines = []
00208         new_file = open(self.breakpointPath,"w")
00209         for line in lines:
00210             if not line.startswith(filename + '='):
00211                 new_file.write(line)
00212         self.update_breakpoints()
00213         breaks = self.breakpoints
00214         if breaks:
00215             new_file.write(filename + '=' + str(breaks) + '\n')
00216         new_file.close()

Here is the call 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)

Definition at line 230 of file PyShell.py.

00230 
00231     def update_breakpoints(self):
00232         "Retrieves all the breakpoints in the current window"
00233         text = self.text
00234         ranges = text.tag_ranges("BREAK")
00235         linenumber_list = self.ranges_to_linenumbers(ranges)
00236         self.breakpoints = linenumber_list

Here is the call graph for this function:

Here is the caller graph for this function:

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:


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 108 of file PyShell.py.

Definition at line 102 of file PyShell.py.

Definition at line 629 of file EditorWindow.py.

Definition at line 264 of file EditorWindow.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.

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 260 of file EditorWindow.py.

Initial value:
[
        ("file", "_File"),
        ("edit", "_Edit"),
        ("format", "F_ormat"),
        ("run", "_Run"),
        ("options", "_Options"),
        ("windows", "_Windows"),
        ("help", "_Help"),
    ]

Reimplemented in idlelib.PyShell.PyShell.

Definition at line 376 of file EditorWindow.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:
[("Set Breakpoint", "<<set-breakpoint-here>>"),
                   ("Clear Breakpoint", "<<clear-breakpoint-here>>")]

Reimplemented from idlelib.EditorWindow.EditorWindow.

Definition at line 118 of file PyShell.py.

Definition at line 109 of file EditorWindow.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 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: