modify_fg/bg/font -> override_*
This commit is contained in:
		
							parent
							
								
									2ad5b544c4
								
							
						
					
					
						commit
						025f879f25
					
				
					 10 changed files with 38 additions and 36 deletions
				
			
		| 
						 | 
					@ -648,16 +648,20 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
 | 
				
			||||||
        self.disconnect_style_event(banner_name_label)
 | 
					        self.disconnect_style_event(banner_name_label)
 | 
				
			||||||
        self.disconnect_style_event(self.banner_status_label)
 | 
					        self.disconnect_style_event(self.banner_status_label)
 | 
				
			||||||
        if bgcolor:
 | 
					        if bgcolor:
 | 
				
			||||||
            banner_eventbox.modify_bg(Gtk.StateType.NORMAL,
 | 
					            color = Gdk.RGBA()
 | 
				
			||||||
                    Gdk.color_parse(bgcolor))
 | 
					            Gdk.RGBA.parse(color, bgcolor)
 | 
				
			||||||
 | 
					            banner_eventbox.override_background_color(Gtk.StateType.NORMAL,
 | 
				
			||||||
 | 
					                color)
 | 
				
			||||||
            default_bg = False
 | 
					            default_bg = False
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            default_bg = True
 | 
					            default_bg = True
 | 
				
			||||||
        if textcolor:
 | 
					        if textcolor:
 | 
				
			||||||
            banner_name_label.modify_fg(Gtk.StateType.NORMAL,
 | 
					            color = Gdk.RGBA()
 | 
				
			||||||
                    Gdk.color_parse(textcolor))
 | 
					            Gdk.RGBA.parse(color, textcolor)
 | 
				
			||||||
            self.banner_status_label.modify_fg(Gtk.StateType.NORMAL,
 | 
					            banner_name_label.override_background_color(Gtk.StateType.NORMAL,
 | 
				
			||||||
                    Gdk.color_parse(textcolor))
 | 
					                color)
 | 
				
			||||||
 | 
					            self.banner_status_label.override_background_color(
 | 
				
			||||||
 | 
					                Gtk.StateType.NORMAL, color)
 | 
				
			||||||
            default_fg = False
 | 
					            default_fg = False
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            default_fg = True
 | 
					            default_fg = True
 | 
				
			||||||
| 
						 | 
					@ -1183,8 +1187,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def update_font(self):
 | 
					    def update_font(self):
 | 
				
			||||||
        font = Pango.FontDescription(gajim.config.get('conversation_font'))
 | 
					        font = Pango.FontDescription(gajim.config.get('conversation_font'))
 | 
				
			||||||
        self.conv_textview.tv.modify_font(font)
 | 
					        self.conv_textview.tv.override_font(font)
 | 
				
			||||||
        self.msg_textview.modify_font(font)
 | 
					        self.msg_textview.override_font(font)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def update_tags(self):
 | 
					    def update_tags(self):
 | 
				
			||||||
        self.conv_textview.update_tags()
 | 
					        self.conv_textview.update_tags()
 | 
				
			||||||
| 
						 | 
					@ -2434,8 +2438,8 @@ class ChatControl(ChatControlBase):
 | 
				
			||||||
                self.conv_textview.correct_last_sent_message(message, xhtml,
 | 
					                self.conv_textview.correct_last_sent_message(message, xhtml,
 | 
				
			||||||
                    self.get_our_nick(), old_txt)
 | 
					                    self.get_our_nick(), old_txt)
 | 
				
			||||||
                self.correcting = False
 | 
					                self.correcting = False
 | 
				
			||||||
                self.msg_textview.modify_base(Gtk.StateType.NORMAL,
 | 
					                self.msg_textview.override_background_color(
 | 
				
			||||||
                    self.old_message_tv_color)
 | 
					                    Gtk.StateType.NORMAL, self.old_message_tv_color)
 | 
				
			||||||
                return
 | 
					                return
 | 
				
			||||||
            self.print_conversation(message, self.contact.jid,
 | 
					            self.print_conversation(message, self.contact.jid,
 | 
				
			||||||
                encrypted=encrypted, xep0184_id=xep0184_id, xhtml=xhtml,
 | 
					                encrypted=encrypted, xep0184_id=xep0184_id, xhtml=xhtml,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -240,7 +240,7 @@ class ConversationTextview(GObject.GObject):
 | 
				
			||||||
        self.last_time_printout = 0
 | 
					        self.last_time_printout = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        font = Pango.FontDescription(gajim.config.get('conversation_font'))
 | 
					        font = Pango.FontDescription(gajim.config.get('conversation_font'))
 | 
				
			||||||
        self.tv.modify_font(font)
 | 
					        self.tv.override_font(font)
 | 
				
			||||||
        buffer_ = self.tv.get_buffer()
 | 
					        buffer_ = self.tv.get_buffer()
 | 
				
			||||||
        end_iter = buffer_.get_end_iter()
 | 
					        end_iter = buffer_.get_end_iter()
 | 
				
			||||||
        buffer_.create_mark('end', end_iter, False)
 | 
					        buffer_.create_mark('end', end_iter, False)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2919,7 +2919,9 @@ class PopupNotificationWindow:
 | 
				
			||||||
            GLib.markup_escape_text(title))
 | 
					            GLib.markup_escape_text(title))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # set colors [ http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html ]
 | 
					        # 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
 | 
					        # default image
 | 
				
			||||||
        if not path_to_image:
 | 
					        if not path_to_image:
 | 
				
			||||||
| 
						 | 
					@ -2945,9 +2947,11 @@ class PopupNotificationWindow:
 | 
				
			||||||
            bg_color = gajim.config.get('notif_status_color')
 | 
					            bg_color = gajim.config.get('notif_status_color')
 | 
				
			||||||
        else: # Unknown event! Shouldn't happen but deal with it
 | 
					        else: # Unknown event! Shouldn't happen but deal with it
 | 
				
			||||||
            bg_color = gajim.config.get('notif_other_color')
 | 
					            bg_color = gajim.config.get('notif_other_color')
 | 
				
			||||||
        popup_bg_color = Gdk.color_parse(bg_color)
 | 
					        popup_bg_color = Gdk.RGBA()
 | 
				
			||||||
        close_button.modify_bg(Gtk.StateType.NORMAL, popup_bg_color)
 | 
					        Gdk.RGBA.parse(popup_bg_color, bg_color)
 | 
				
			||||||
        eventbox.modify_bg(Gtk.StateType.NORMAL, popup_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>' %
 | 
					        event_description_label.set_markup('<span foreground="black">%s</span>' %
 | 
				
			||||||
            GLib.markup_escape_text(text))
 | 
					            GLib.markup_escape_text(text))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3337,8 +3341,9 @@ class XMLConsoleWindow:
 | 
				
			||||||
        self.enabled = True
 | 
					        self.enabled = True
 | 
				
			||||||
        self.xml.get_object('enable_checkbutton').set_active(True)
 | 
					        self.xml.get_object('enable_checkbutton').set_active(True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.input_textview.modify_text(
 | 
					        col = Gdk.RGBA()
 | 
				
			||||||
            Gtk.StateType.NORMAL, Gdk.color_parse(color))
 | 
					        Gdk.RGBA.parse(col, color)
 | 
				
			||||||
 | 
					        self.input_textview.override_color(Gtk.StateType.NORMAL, col)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if len(gajim.connections) > 1:
 | 
					        if len(gajim.connections) > 1:
 | 
				
			||||||
            title = _('XML Console for %s') % self.account
 | 
					            title = _('XML Console for %s') % self.account
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										11
									
								
								src/disco.py
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/disco.py
									
										
									
									
									
								
							| 
						 | 
					@ -645,15 +645,18 @@ _('Without a connection, you can not browse available services'))
 | 
				
			||||||
        textcolor = gajim.config.get_per('themes', theme, 'bannertextcolor')
 | 
					        textcolor = gajim.config.get_per('themes', theme, 'bannertextcolor')
 | 
				
			||||||
        self.disconnect_style_event()
 | 
					        self.disconnect_style_event()
 | 
				
			||||||
        if bgcolor:
 | 
					        if bgcolor:
 | 
				
			||||||
            color = Gdk.color_parse(bgcolor)
 | 
					            color = Gdk.RGBA()
 | 
				
			||||||
            self.banner_eventbox.modify_bg(Gtk.StateType.NORMAL, color)
 | 
					            Gdk.RGBA.parse(color, bgcolor)
 | 
				
			||||||
 | 
					            self.banner_eventbox.override_background_color(Gtk.StateType.NORMAL,
 | 
				
			||||||
 | 
					                color)
 | 
				
			||||||
            default_bg = False
 | 
					            default_bg = False
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            default_bg = True
 | 
					            default_bg = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if textcolor:
 | 
					        if textcolor:
 | 
				
			||||||
            color = Gdk.color_parse(textcolor)
 | 
					            color = Gdk.RGBA()
 | 
				
			||||||
            self.banner.modify_fg(Gtk.StateType.NORMAL, color)
 | 
					            Gdk.RGBA.parse(color, textcolor)
 | 
				
			||||||
 | 
					            self.banner.override_color(Gtk.StateType.NORMAL, color)
 | 
				
			||||||
            default_fg = False
 | 
					            default_fg = False
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            default_fg = True
 | 
					            default_fg = True
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -193,7 +193,6 @@ if os.name == 'nt':
 | 
				
			||||||
warnings.filterwarnings('error', module='gtk')
 | 
					warnings.filterwarnings('error', module='gtk')
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
    from gi.repository import GObject
 | 
					    from gi.repository import GObject
 | 
				
			||||||
    GObject.threads_init()
 | 
					 | 
				
			||||||
    GObject.set_prgname('gajim')
 | 
					    GObject.set_prgname('gajim')
 | 
				
			||||||
    from gi.repository import Gtk
 | 
					    from gi.repository import Gtk
 | 
				
			||||||
    from gi.repository import Gdk
 | 
					    from gi.repository import Gdk
 | 
				
			||||||
| 
						 | 
					@ -464,13 +463,6 @@ if __name__ == '__main__':
 | 
				
			||||||
    interface.run()
 | 
					    interface.run()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    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()
 | 
					        Gtk.main()
 | 
				
			||||||
        if os.name != 'nt':
 | 
					 | 
				
			||||||
            Gdk.threads_leave()
 | 
					 | 
				
			||||||
    except KeyboardInterrupt:
 | 
					    except KeyboardInterrupt:
 | 
				
			||||||
        print('KeyboardInterrupt', file=sys.stderr)
 | 
					        print('KeyboardInterrupt', file=sys.stderr)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1958,8 +1958,8 @@ class GroupchatControl(ChatControlBase):
 | 
				
			||||||
                self.last_sent_msg = msg
 | 
					                self.last_sent_msg = msg
 | 
				
			||||||
                if self.correcting:
 | 
					                if self.correcting:
 | 
				
			||||||
                    self.correcting = False
 | 
					                    self.correcting = False
 | 
				
			||||||
                    self.msg_textview.modify_base(Gtk.StateType.NORMAL,
 | 
					                    self.msg_textview.override_background_color(
 | 
				
			||||||
                        self.old_message_tv_color)
 | 
					                        Gtk.StateType.NORMAL, self.old_message_tv_color)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if self.correcting and self.last_sent_msg:
 | 
					            if self.correcting and self.last_sent_msg:
 | 
				
			||||||
                correction_msg = self.last_sent_msg
 | 
					                correction_msg = self.last_sent_msg
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ def _info(type_, value, tb):
 | 
				
			||||||
    # Details
 | 
					    # Details
 | 
				
			||||||
    textview = Gtk.TextView()
 | 
					    textview = Gtk.TextView()
 | 
				
			||||||
    textview.set_editable(False)
 | 
					    textview.set_editable(False)
 | 
				
			||||||
    textview.modify_font(Pango.FontDescription('Monospace'))
 | 
					    textview.override_font(Pango.FontDescription('Monospace'))
 | 
				
			||||||
    sw = Gtk.ScrolledWindow()
 | 
					    sw = Gtk.ScrolledWindow()
 | 
				
			||||||
    sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
 | 
					    sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
 | 
				
			||||||
    sw.add(textview)
 | 
					    sw.add(textview)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2591,7 +2591,7 @@ class Interface:
 | 
				
			||||||
        sw = Gtk.ScrolledWindow()
 | 
					        sw = Gtk.ScrolledWindow()
 | 
				
			||||||
        sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
 | 
					        sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
 | 
				
			||||||
        view = IPythonView()
 | 
					        view = IPythonView()
 | 
				
			||||||
        view.modify_font(Pango.FontDescription(font))
 | 
					        view.override_font(Pango.FontDescription(font))
 | 
				
			||||||
        view.set_wrap_mode(Gtk.WrapMode.CHAR)
 | 
					        view.set_wrap_mode(Gtk.WrapMode.CHAR)
 | 
				
			||||||
        sw.add(view)
 | 
					        sw.add(view)
 | 
				
			||||||
        window.add(sw)
 | 
					        window.add(sw)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -349,7 +349,7 @@ class ConsoleView(Gtk.TextView):
 | 
				
			||||||
        Initialize console view
 | 
					        Initialize console view
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        GObject.GObject.__init__(self)
 | 
					        GObject.GObject.__init__(self)
 | 
				
			||||||
        self.modify_font(Pango.FontDescription('Mono'))
 | 
					        self.override_font(Pango.FontDescription('Mono'))
 | 
				
			||||||
        self.set_cursor_visible(True)
 | 
					        self.set_cursor_visible(True)
 | 
				
			||||||
        self.text_buffer = self.get_buffer()
 | 
					        self.text_buffer = self.get_buffer()
 | 
				
			||||||
        self.mark = self.text_buffer.create_mark('scroll_mark',
 | 
					        self.mark = self.text_buffer.create_mark('scroll_mark',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,7 +151,6 @@ class BaseTooltip:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.preferred_position = [pointer_x, preferred_y]
 | 
					        self.preferred_position = [pointer_x, preferred_y]
 | 
				
			||||||
        self.widget_height = widget_height
 | 
					        self.widget_height = widget_height
 | 
				
			||||||
        self.win.ensure_style()
 | 
					 | 
				
			||||||
        self.win.show_all()
 | 
					        self.win.show_all()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def hide_tooltip(self):
 | 
					    def hide_tooltip(self):
 | 
				
			||||||
| 
						 | 
					@ -678,7 +677,6 @@ class RosterTooltip(NotificationAreaTooltip):
 | 
				
			||||||
            self.win.destroy()
 | 
					            self.win.destroy()
 | 
				
			||||||
            self.win = None
 | 
					            self.win = None
 | 
				
			||||||
            self.populate(self.cur_data)
 | 
					            self.populate(self.cur_data)
 | 
				
			||||||
            self.win.ensure_style()
 | 
					 | 
				
			||||||
            self.win.show_all()
 | 
					            self.win.show_all()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _append_pep_info(self, contact, properties):
 | 
					    def _append_pep_info(self, contact, properties):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue