Fix rich text in the chat
This commit is contained in:
parent
5078a97479
commit
68ebe0d9ad
@ -52,11 +52,10 @@ class Chat(activity.Activity):
|
||||
chat_vbox.pack_start(sw)
|
||||
sw.show()
|
||||
|
||||
rich_buf = richtext.RichTextBuffer()
|
||||
chat_view_sw = gtk.ScrolledWindow()
|
||||
chat_view_sw.set_shadow_type(gtk.SHADOW_IN)
|
||||
chat_view_sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
self._editor = richtext.RichTextView(rich_buf)
|
||||
self._editor = richtext.RichTextView()
|
||||
self._editor.connect("key-press-event", self.__key_press_event_cb)
|
||||
self._editor.set_size_request(-1, 50)
|
||||
chat_view_sw.add(self._editor)
|
||||
@ -65,7 +64,7 @@ class Chat(activity.Activity):
|
||||
chat_vbox.pack_start(chat_view_sw, False)
|
||||
chat_view_sw.show()
|
||||
|
||||
return chat_vbox, rich_buf
|
||||
return chat_vbox, self._editor.get_buffer()
|
||||
|
||||
def _ui_setup(self, base):
|
||||
vbox = gtk.VBox(False, 6)
|
||||
|
@ -14,8 +14,8 @@ class RichTextView(gtk.TextView):
|
||||
([gobject.TYPE_STRING]))
|
||||
}
|
||||
|
||||
def __init__(self, rich_buf = None):
|
||||
gtk.TextView.__init__(self, rich_buf)
|
||||
def __init__(self):
|
||||
gtk.TextView.__init__(self, RichTextBuffer())
|
||||
self.connect("motion-notify-event", self.__motion_notify_cb)
|
||||
self.connect("button-press-event", self.__button_press_cb)
|
||||
self.__hover_link = False
|
||||
@ -343,7 +343,12 @@ if __name__ == "__main__":
|
||||
|
||||
vbox = gtk.VBox()
|
||||
|
||||
rich_buf = RichTextBuffer()
|
||||
view = RichTextView()
|
||||
view.connect("link-clicked", link_clicked)
|
||||
vbox.pack_start(view)
|
||||
view.show()
|
||||
|
||||
rich_buf = view.get_buffer()
|
||||
|
||||
xml_string = "<richtext>"
|
||||
|
||||
@ -355,11 +360,6 @@ if __name__ == "__main__":
|
||||
|
||||
RichTextSerializer().deserialize(xml_string, rich_buf)
|
||||
|
||||
view = RichTextView(rich_buf)
|
||||
view.connect("link-clicked", link_clicked)
|
||||
vbox.pack_start(view)
|
||||
view.show()
|
||||
|
||||
toolbar = RichTextToolbar(rich_buf)
|
||||
vbox.pack_start(toolbar, False)
|
||||
toolbar.show()
|
||||
|
Loading…
Reference in New Issue
Block a user