fix change font in html, wrong import
This commit is contained in:
parent
a5027f847e
commit
67e7d7f718
3 changed files with 6 additions and 8 deletions
|
@ -1102,7 +1102,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
|
|
||||||
def on_font_menuitem_activale(self, widget):
|
def on_font_menuitem_activale(self, widget):
|
||||||
font_dialog = Gtk.FontChooserDialog(None, self.parent_win.window)
|
font_dialog = Gtk.FontChooserDialog(None, self.parent_win.window)
|
||||||
font_dialog.connect('response', self.msg_textview.font_set)
|
start, finish = self.msg_textview.get_active_iters()
|
||||||
|
font_dialog.connect('response', self.msg_textview.font_set, start, finish)
|
||||||
font_dialog.show_all()
|
font_dialog.show_all()
|
||||||
|
|
||||||
def on_actions_button_clicked(self, widget):
|
def on_actions_button_clicked(self, widget):
|
||||||
|
|
|
@ -45,7 +45,7 @@ if gajim.HAVE_PYCRYPTO:
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
|
|
||||||
from common import dh
|
from common import dh
|
||||||
from . import secrets
|
import secrets
|
||||||
|
|
||||||
XmlDsig = 'http://www.w3.org/2000/09/xmldsig#'
|
XmlDsig = 'http://www.w3.org/2000/09/xmldsig#'
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,6 @@ class MessageTextView(Gtk.TextView):
|
||||||
_buffer.remove_all_tags(start, finish)
|
_buffer.remove_all_tags(start, finish)
|
||||||
|
|
||||||
def color_set(self, widget, response):
|
def color_set(self, widget, response):
|
||||||
print (response)
|
|
||||||
if response == -6 or response == -4:
|
if response == -6 or response == -4:
|
||||||
widget.destroy()
|
widget.destroy()
|
||||||
return
|
return
|
||||||
|
@ -174,13 +173,11 @@ class MessageTextView(Gtk.TextView):
|
||||||
|
|
||||||
_buffer.apply_tag_by_name(tag_name, start, finish)
|
_buffer.apply_tag_by_name(tag_name, start, finish)
|
||||||
|
|
||||||
def font_set(self, widget, response):
|
def font_set(self, widget, response, start, finish):
|
||||||
if response == -6 or response == -4:
|
if response == -6 or response == -4:
|
||||||
widget.destroy()
|
widget.destroy()
|
||||||
return
|
return
|
||||||
|
|
||||||
_buffer = self.get_buffer()
|
|
||||||
|
|
||||||
font = widget.get_font()
|
font = widget.get_font()
|
||||||
font_desc = widget.get_font_desc()
|
font_desc = widget.get_font_desc()
|
||||||
family = font_desc.get_family()
|
family = font_desc.get_family()
|
||||||
|
@ -191,6 +188,8 @@ class MessageTextView(Gtk.TextView):
|
||||||
|
|
||||||
widget.destroy()
|
widget.destroy()
|
||||||
|
|
||||||
|
_buffer = self.get_buffer()
|
||||||
|
|
||||||
tag_name = 'font' + font
|
tag_name = 'font' + font
|
||||||
if not tag_name in self.fonts_tags:
|
if not tag_name in self.fonts_tags:
|
||||||
tagFont = _buffer.create_tag(tag_name)
|
tagFont = _buffer.create_tag(tag_name)
|
||||||
|
@ -201,8 +200,6 @@ class MessageTextView(Gtk.TextView):
|
||||||
self.end_tags[tag_name] = '</span>'
|
self.end_tags[tag_name] = '</span>'
|
||||||
self.fonts_tags.append(tag_name)
|
self.fonts_tags.append(tag_name)
|
||||||
|
|
||||||
start, finish = self.get_active_iters()
|
|
||||||
|
|
||||||
for tag in self.fonts_tags:
|
for tag in self.fonts_tags:
|
||||||
_buffer.remove_tag_by_name(tag, start, finish)
|
_buffer.remove_tag_by_name(tag, start, finish)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue