modify_fg/bg/font -> override_*

This commit is contained in:
Yann Leboulanger 2013-07-31 16:40:33 +02:00
parent 2ad5b544c4
commit 025f879f25
10 changed files with 38 additions and 36 deletions

View File

@ -648,16 +648,20 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
self.disconnect_style_event(banner_name_label)
self.disconnect_style_event(self.banner_status_label)
if bgcolor:
banner_eventbox.modify_bg(Gtk.StateType.NORMAL,
Gdk.color_parse(bgcolor))
color = Gdk.RGBA()
Gdk.RGBA.parse(color, bgcolor)
banner_eventbox.override_background_color(Gtk.StateType.NORMAL,
color)
default_bg = False
else:
default_bg = True
if textcolor:
banner_name_label.modify_fg(Gtk.StateType.NORMAL,
Gdk.color_parse(textcolor))
self.banner_status_label.modify_fg(Gtk.StateType.NORMAL,
Gdk.color_parse(textcolor))
color = Gdk.RGBA()
Gdk.RGBA.parse(color, textcolor)
banner_name_label.override_background_color(Gtk.StateType.NORMAL,
color)
self.banner_status_label.override_background_color(
Gtk.StateType.NORMAL, color)
default_fg = False
else:
default_fg = True
@ -1183,8 +1187,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
def update_font(self):
font = Pango.FontDescription(gajim.config.get('conversation_font'))
self.conv_textview.tv.modify_font(font)
self.msg_textview.modify_font(font)
self.conv_textview.tv.override_font(font)
self.msg_textview.override_font(font)
def update_tags(self):
self.conv_textview.update_tags()
@ -2434,8 +2438,8 @@ class ChatControl(ChatControlBase):
self.conv_textview.correct_last_sent_message(message, xhtml,
self.get_our_nick(), old_txt)
self.correcting = False
self.msg_textview.modify_base(Gtk.StateType.NORMAL,
self.old_message_tv_color)
self.msg_textview.override_background_color(
Gtk.StateType.NORMAL, self.old_message_tv_color)
return
self.print_conversation(message, self.contact.jid,
encrypted=encrypted, xep0184_id=xep0184_id, xhtml=xhtml,

View File

@ -240,7 +240,7 @@ class ConversationTextview(GObject.GObject):
self.last_time_printout = 0
font = Pango.FontDescription(gajim.config.get('conversation_font'))
self.tv.modify_font(font)
self.tv.override_font(font)
buffer_ = self.tv.get_buffer()
end_iter = buffer_.get_end_iter()
buffer_.create_mark('end', end_iter, False)

View File

@ -2919,7 +2919,9 @@ class PopupNotificationWindow:
GLib.markup_escape_text(title))
# set colors [ http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html ]
self.window.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('black'))
color = Gdk.RGBA()
Gdk.RGBA.parse(color, 'black')
self.window.override_background_color(Gtk.StateType.NORMAL, color)
# default image
if not path_to_image:
@ -2945,9 +2947,11 @@ class PopupNotificationWindow:
bg_color = gajim.config.get('notif_status_color')
else: # Unknown event! Shouldn't happen but deal with it
bg_color = gajim.config.get('notif_other_color')
popup_bg_color = Gdk.color_parse(bg_color)
close_button.modify_bg(Gtk.StateType.NORMAL, popup_bg_color)
eventbox.modify_bg(Gtk.StateType.NORMAL, popup_bg_color)
popup_bg_color = Gdk.RGBA()
Gdk.RGBA.parse(popup_bg_color, bg_color)
close_button.override_background_color(Gtk.StateType.NORMAL,
popup_bg_color)
eventbox.override_background_color(Gtk.StateType.NORMAL, popup_bg_color)
event_description_label.set_markup('<span foreground="black">%s</span>' %
GLib.markup_escape_text(text))
@ -3337,8 +3341,9 @@ class XMLConsoleWindow:
self.enabled = True
self.xml.get_object('enable_checkbutton').set_active(True)
self.input_textview.modify_text(
Gtk.StateType.NORMAL, Gdk.color_parse(color))
col = Gdk.RGBA()
Gdk.RGBA.parse(col, color)
self.input_textview.override_color(Gtk.StateType.NORMAL, col)
if len(gajim.connections) > 1:
title = _('XML Console for %s') % self.account

View File

@ -645,15 +645,18 @@ _('Without a connection, you can not browse available services'))
textcolor = gajim.config.get_per('themes', theme, 'bannertextcolor')
self.disconnect_style_event()
if bgcolor:
color = Gdk.color_parse(bgcolor)
self.banner_eventbox.modify_bg(Gtk.StateType.NORMAL, color)
color = Gdk.RGBA()
Gdk.RGBA.parse(color, bgcolor)
self.banner_eventbox.override_background_color(Gtk.StateType.NORMAL,
color)
default_bg = False
else:
default_bg = True
if textcolor:
color = Gdk.color_parse(textcolor)
self.banner.modify_fg(Gtk.StateType.NORMAL, color)
color = Gdk.RGBA()
Gdk.RGBA.parse(color, textcolor)
self.banner.override_color(Gtk.StateType.NORMAL, color)
default_fg = False
else:
default_fg = True

View File

@ -193,7 +193,6 @@ if os.name == 'nt':
warnings.filterwarnings('error', module='gtk')
try:
from gi.repository import GObject
GObject.threads_init()
GObject.set_prgname('gajim')
from gi.repository import Gtk
from gi.repository import Gdk
@ -464,13 +463,6 @@ if __name__ == '__main__':
interface.run()
try:
if os.name != 'nt':
# This makes Gajim unusable under windows, and threads are used only
# for GPG, so not under windows
Gdk.threads_init()
Gdk.threads_enter()
Gtk.main()
if os.name != 'nt':
Gdk.threads_leave()
except KeyboardInterrupt:
print('KeyboardInterrupt', file=sys.stderr)

View File

@ -1958,8 +1958,8 @@ class GroupchatControl(ChatControlBase):
self.last_sent_msg = msg
if self.correcting:
self.correcting = False
self.msg_textview.modify_base(Gtk.StateType.NORMAL,
self.old_message_tv_color)
self.msg_textview.override_background_color(
Gtk.StateType.NORMAL, self.old_message_tv_color)
if self.correcting and self.last_sent_msg:
correction_msg = self.last_sent_msg

View File

@ -59,7 +59,7 @@ def _info(type_, value, tb):
# Details
textview = Gtk.TextView()
textview.set_editable(False)
textview.modify_font(Pango.FontDescription('Monospace'))
textview.override_font(Pango.FontDescription('Monospace'))
sw = Gtk.ScrolledWindow()
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
sw.add(textview)

View File

@ -2591,7 +2591,7 @@ class Interface:
sw = Gtk.ScrolledWindow()
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
view = IPythonView()
view.modify_font(Pango.FontDescription(font))
view.override_font(Pango.FontDescription(font))
view.set_wrap_mode(Gtk.WrapMode.CHAR)
sw.add(view)
window.add(sw)

View File

@ -349,7 +349,7 @@ class ConsoleView(Gtk.TextView):
Initialize console view
"""
GObject.GObject.__init__(self)
self.modify_font(Pango.FontDescription('Mono'))
self.override_font(Pango.FontDescription('Mono'))
self.set_cursor_visible(True)
self.text_buffer = self.get_buffer()
self.mark = self.text_buffer.create_mark('scroll_mark',

View File

@ -151,7 +151,6 @@ class BaseTooltip:
self.preferred_position = [pointer_x, preferred_y]
self.widget_height = widget_height
self.win.ensure_style()
self.win.show_all()
def hide_tooltip(self):
@ -678,7 +677,6 @@ class RosterTooltip(NotificationAreaTooltip):
self.win.destroy()
self.win = None
self.populate(self.cur_data)
self.win.ensure_style()
self.win.show_all()
def _append_pep_info(self, contact, properties):