def __init__(self): gtk.TextView.__init__(self, None) self._textbuffer = None self._buffer_callbacks = [] self._clipboard_contents = None self._blank_buffer = RichTextBuffer(self) self._popup_menu = None self._html_buffer = HtmlBuffer() self.set_buffer(RichTextBuffer(self)) self.set_default_font(DEFAULT_FONT) # spell checker self._spell_checker = None ##self.enable_spell_check(True) self.enable_spell_check(False) # signals self.set_wrap_mode(gtk.WRAP_WORD) self.set_property("right-margin", TEXTVIEW_MARGIN) self.set_property("left-margin", TEXTVIEW_MARGIN) self.connect("key-press-event", self.on_key_press_event) #self.connect("insert-at-cursor", self.on_insert_at_cursor) self.connect("backspace", self.on_backspace) self.connect("button-press-event", self.on_button_press) # drag and drop self.connect("drag-data-received", self.on_drag_data_received) self.connect("drag-motion", self.on_drag_motion) self.drag_dest_add_image_targets() # clipboard self.connect("copy-clipboard", lambda w: self._on_copy()) self.connect("cut-clipboard", lambda w: self._on_cut()) self.connect("paste-clipboard", lambda w: self._on_paste()) #self.connect("button-press-event", self.on_button_press) self.connect("populate-popup", self.on_popup) # popup menus self.init_menus()
def __init__(self): self._html_buffer = HtmlBuffer()