Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/chat/richtext.py
diff options
context:
space:
mode:
Diffstat (limited to 'chat/richtext.py')
-rw-r--r--chat/richtext.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/chat/richtext.py b/chat/richtext.py
index 7996547..ecf49e4 100644
--- a/chat/richtext.py
+++ b/chat/richtext.py
@@ -9,7 +9,7 @@ import xml.sax
class RichTextBuffer(gtk.TextBuffer):
def __init__(self):
gtk.TextBuffer.__init__(self)
-
+
self.connect_after("insert-text", self.__insert_text_cb)
self.__create_tags()
@@ -18,8 +18,10 @@ class RichTextBuffer(gtk.TextBuffer):
def apply_tag(self, tag_name):
self.active_tags.append(tag_name)
- [start, end] = self.get_selection_bounds()
- self.apply_tag_by_name(tag_name, start, end)
+ bounds = self.get_selection_bounds()
+ if bounds:
+ [start, end] = bounds
+ self.apply_tag_by_name(tag_name, start, end)
def unapply_tag(self, tag_name):
self.active_tags.remove(tag_name)
@@ -46,6 +48,8 @@ class RichTextToolbar(gtk.Toolbar):
self.buf = buf
+ self.set_style(gtk.TOOLBAR_ICONS)
+
item = gtk.ToggleToolButton(gtk.STOCK_BOLD)
item.connect("toggled", self.__toggle_style_cb, "bold")
self.insert(item, -1)