Example #1
0
 def LoadTagDefs(self):
     ColorDelegator.LoadTagDefs(self)
     theme = idleConf.GetOption('main', 'Theme', 'name')
     self.tagdefs.update({
         "stdin": {
             'background': None,
             'foreground': None
         },
         "stdout": idleConf.GetHighlight(theme, "stdout"),
         "stderr": idleConf.GetHighlight(theme, "stderr"),
         "console": idleConf.GetHighlight(theme, "console"),
     })
Example #2
0
def addFiltersFromIDLE(self):
    """
  Adds syntax colors, undo, replace, find, goto, indent, commment 
  functionality from IDLE to the text widget
  """
    textWidget = self.textWidget

    p = Percolator(textWidget)
    p.insertfilter(ColorDelegator())  # Python syntax coloring
    undo = UndoDelegator()
    p.insertfilter(undo)  # Undo/Redo feature

    # This is used to undo stuff done with replace, indent, comment, etc.
    textWidget.undo_block_start = undo.undo_block_start
    textWidget.undo_block_stop = undo.undo_block_stop

    #----------------- Bind virtual events to the text widget ------------------
    textWidget.bind(
        "<<replace>>",
        lambda e=None, self=self: ReplaceDialog.replace(self.textWidget))
    textWidget.bind(
        "<<find>>",
        lambda e=None, self=self: SearchDialog.find(self.textWidget))
    textWidget.bind("<<goto-line>>",
                    lambda e=None, self=self: goto_line_event(self))
    textWidget.bind("<<add-indent>>",
                    lambda e=None, self=self: indent_region_event(self))
    textWidget.bind("<<del-indent>>",
                    lambda e=None, self=self: dedent_region_event(self))
    textWidget.bind("<<add-comment>>",
                    lambda e=None, self=self: comment_region_event(self))
    textWidget.bind("<<del-comment>>",
                    lambda e=None, self=self: uncomment_region_event(self))
    textWidget.bind("<<select-all>>",
                    lambda e=None, self=self: select_all(self))
    textWidget.bind("<<deselect-all>>",
                    lambda e=None, self=self: deselect_all(self))
    textWidget.bind("<<paste>>", lambda e=None, self=self: paste(self))
    textWidget.bind("<<copy>>", lambda e=None, self=self: copy(self))
    textWidget.bind("<<cut>>", lambda e=None, self=self: cut(self))
    textWidget.bind("<<popup-menu>>",
                    lambda e=None, self=self: popupMenu(self, e))
    textWidget.bind("<<open>>", lambda e=None, self=self: Open(self))
    textWidget.bind("<<save>>", lambda e=None, self=self: SaveAs(self))

    #---------------- Give virtual events a concrete keybinding ----------------
    for key, value in KEY_DICT.iteritems():
        textWidget.event_add(key, *value)
Example #3
0
 def recolorize_main(self):
     self.tag_remove("TODO", "1.0", "iomark")
     self.tag_add("SYNC", "1.0", "iomark")
     ColorDelegator.recolorize_main(self)
Example #4
0
 def __init__(self):
     ColorDelegator.__init__(self)
     self.LoadTagDefs()
Example #5
0
 def recolorize_main(self):
     self.tag_remove("TODO", "1.0", "iomark")
     self.tag_add("SYNC", "1.0", "iomark")
     ColorDelegator.recolorize_main(self)
Example #6
0
 def __init__(self):
     ColorDelegator.__init__(self)
     self.LoadTagDefs()
Example #7
0
#! /usr/bin/env python