Set styles on current selection
This commit is contained in:
parent
9b14f7e578
commit
68b991404e
@ -18,9 +18,15 @@ class RichTextBuffer(gtk.TextBuffer):
|
|||||||
def apply_tag(self, tag_name):
|
def apply_tag(self, tag_name):
|
||||||
self.active_tags.append(tag_name)
|
self.active_tags.append(tag_name)
|
||||||
|
|
||||||
|
[start, end] = self.get_selection_bounds()
|
||||||
|
self.apply_tag_by_name(tag_name, start, end)
|
||||||
|
|
||||||
def unapply_tag(self, tag_name):
|
def unapply_tag(self, tag_name):
|
||||||
self.active_tags.remove(tag_name)
|
self.active_tags.remove(tag_name)
|
||||||
|
|
||||||
|
[start, end] = self.get_selection_bounds()
|
||||||
|
self.remove_tag_by_name(tag_name, start, end)
|
||||||
|
|
||||||
def __create_tags(self):
|
def __create_tags(self):
|
||||||
tag = self.create_tag("bold")
|
tag = self.create_tag("bold")
|
||||||
tag.set_property("weight", pango.WEIGHT_BOLD)
|
tag.set_property("weight", pango.WEIGHT_BOLD)
|
||||||
|
Loading…
Reference in New Issue
Block a user