Dont use depracted override_font()
This commit is contained in:
parent
9ecabd561e
commit
0abb26ae36
|
@ -343,8 +343,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
self.msg_textview.drag_dest_set(Gtk.DestDefaults.MOTION |
|
||||
Gtk.DestDefaults.HIGHLIGHT, self.dnd_list, Gdk.DragAction.COPY)
|
||||
|
||||
self.update_font()
|
||||
|
||||
# Hook up send button
|
||||
widget = self.xml.get_object('send_button')
|
||||
id_ = widget.connect('clicked', self._on_send_button_clicked)
|
||||
|
@ -896,11 +894,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
gtkgui_helpers.popup_emoticons_under_button(menu, widget,
|
||||
self.parent_win)
|
||||
|
||||
def update_font(self):
|
||||
font = Pango.FontDescription(gajim.config.get('conversation_font'))
|
||||
self.conv_textview.tv.override_font(font)
|
||||
self.msg_textview.override_font(font)
|
||||
|
||||
def update_tags(self):
|
||||
self.conv_textview.update_tags()
|
||||
|
||||
|
|
|
@ -881,14 +881,7 @@ class PreferencesWindow:
|
|||
else:
|
||||
font = ''
|
||||
gajim.config.set(text, font)
|
||||
self.update_text_font()
|
||||
|
||||
def update_text_font(self):
|
||||
"""
|
||||
Update text font in opened chat windows
|
||||
"""
|
||||
for ctrl in self._get_all_controls():
|
||||
ctrl.update_font()
|
||||
gtkgui_helpers.load_css()
|
||||
|
||||
def on_incoming_nick_colorbutton_color_set(self, widget):
|
||||
self.on_preference_widget_color_set(widget, 'inmsgcolor')
|
||||
|
|
|
@ -238,8 +238,8 @@ class ConversationTextview(GObject.GObject):
|
|||
self.change_cursor = False
|
||||
self.last_time_printout = 0
|
||||
|
||||
font = Pango.FontDescription(gajim.config.get('conversation_font'))
|
||||
self.tv.override_font(font)
|
||||
style = self.tv.get_style_context()
|
||||
style.add_class('font_custom')
|
||||
buffer_ = self.tv.get_buffer()
|
||||
end_iter = buffer_.get_end_iter()
|
||||
buffer_.create_mark('end', end_iter, False)
|
||||
|
|
|
@ -1141,6 +1141,8 @@ def convert_config_to_css():
|
|||
css += '.theme_{cls} {node} {{ {attr}: {color}; }}\n'.format(
|
||||
cls=key, node=node, attr=attr, color=value)
|
||||
|
||||
css += add_css_font()
|
||||
|
||||
return css
|
||||
|
||||
def add_css_class(widget, class_name):
|
||||
|
@ -1154,3 +1156,24 @@ def add_css_class(widget, class_name):
|
|||
def remove_css_class(widget, class_name):
|
||||
style = widget.get_style_context()
|
||||
style.remove_class('theme_' + class_name)
|
||||
|
||||
def add_css_font():
|
||||
conversation_font = gajim.config.get('conversation_font')
|
||||
if not conversation_font:
|
||||
return ''
|
||||
font = Pango.FontDescription(conversation_font)
|
||||
unit = "pt" if Gtk.check_version(3, 22, 0) is None else "px"
|
||||
css = """
|
||||
.font_custom {{
|
||||
font-family: {family};
|
||||
font-size: {size}{unit};
|
||||
font-weight: {weight};
|
||||
}}""".format(
|
||||
family=font.get_family(),
|
||||
size=int(round(font.get_size() / Pango.SCALE)),
|
||||
unit=unit,
|
||||
weight=int(font.get_weight()))
|
||||
css = css.replace("font-size: 0{unit};".format(unit=unit), "")
|
||||
css = css.replace("font-weight: 0;", "")
|
||||
css = "\n".join(filter(lambda x: x.strip(), css.splitlines()))
|
||||
return css
|
||||
|
|
Loading…
Reference in New Issue