update banner font with theme font
This commit is contained in:
parent
c40692a779
commit
8945173e51
|
@ -747,7 +747,7 @@ class ChatControl(ChatControlBase):
|
|||
|
||||
def notify_on_new_messages(self):
|
||||
return gajim.config.get('trayicon_notification_on_new_messages')
|
||||
|
||||
|
||||
def on_avatar_eventbox_enter_notify_event(self, widget, event):
|
||||
'''we enter the eventbox area so we under conditions add a timeout
|
||||
to show a bigger avatar after 0.5 sec'''
|
||||
|
@ -833,7 +833,7 @@ class ChatControl(ChatControlBase):
|
|||
|
||||
def draw_banner(self, chatstate = None):
|
||||
'''Draw the fat line at the top of the window that
|
||||
houses the status icon, name, jid, and avatar. The chatstate arg should
|
||||
houses the status icon, name, jid. The chatstate arg should
|
||||
only be used if the control's chatstate member is NOT to be use, such as
|
||||
composing, paused, etc.
|
||||
'''
|
||||
|
@ -870,6 +870,30 @@ class ChatControl(ChatControlBase):
|
|||
#label_text = '<span weight="heavy" size="x-large">%s</span>\n%s' \
|
||||
# % (name, fulljid)
|
||||
|
||||
# get banner font settings
|
||||
theme = gajim.config.get('roster_theme')
|
||||
bannerfont = gajim.config.get_per('themes', theme, 'bannerfont')
|
||||
bannerfontattrs = gajim.config.get_per('themes', theme, 'bannerfontattrs')
|
||||
|
||||
if bannerfont:
|
||||
font = pango.FontDescription(bannerfont)
|
||||
else:
|
||||
font = pango.FontDescription('Normal')
|
||||
if bannerfontattrs:
|
||||
# B is attribute set by default
|
||||
if 'B' in bannerfontattrs:
|
||||
font.set_weight(pango.WEIGHT_HEAVY)
|
||||
if 'I' in bannerfontattrs:
|
||||
font.set_style(pango.STYLE_ITALIC)
|
||||
|
||||
font_attrs = 'font_desc="%s"' % font.to_string()
|
||||
font_size = font.get_size()
|
||||
|
||||
# in case there is no font specified we use x-large font size
|
||||
if font_size == 0:
|
||||
font_size = 'x-large'
|
||||
font_attrs = '%s size="%s"' % (font_attrs, font_size)
|
||||
|
||||
st = gajim.config.get('chat_state_notifications')
|
||||
cs = contact.chatstate
|
||||
if cs and st in ('composing_only', 'all'):
|
||||
|
@ -884,18 +908,19 @@ class ChatControl(ChatControlBase):
|
|||
else:
|
||||
chatstate = ''
|
||||
label_text = \
|
||||
'<span weight="heavy" size="x-large">%s</span>%s %s' % \
|
||||
(name, acct_info, chatstate)
|
||||
'<span %s>%s</span>%s %s' % \
|
||||
(font_attrs, name, acct_info, chatstate)
|
||||
else:
|
||||
label_text = '<span weight="heavy" size="x-large">%s</span>%s' % \
|
||||
(name, acct_info)
|
||||
# weight="heavy" size="x-large"
|
||||
label_text = '<span %s>%s</span>%s' % \
|
||||
(font_attrs, name, acct_info)
|
||||
|
||||
if status is not None:
|
||||
label_text += '\n%s' % status
|
||||
|
||||
# setup the label that holds name and jid
|
||||
banner_name_label.set_markup(label_text)
|
||||
|
||||
|
||||
def _update_gpg(self):
|
||||
tb = self.xml.get_widget('gpg_togglebutton')
|
||||
if self.contact.keyID: # we can do gpg
|
||||
|
|
|
@ -260,7 +260,9 @@ class Config:
|
|||
'contactfontattrs': [ opt_str, '' ],
|
||||
'bannertextcolor': [ opt_color, 'black' ],
|
||||
'bannerbgcolor': [ opt_color, '' ],
|
||||
|
||||
'bannerfont': [ opt_str, '' ],
|
||||
'bannerfontattrs': [ opt_str, 'B' ],
|
||||
|
||||
# http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html
|
||||
# FIXME: not black but the default color from gtk+ theme
|
||||
'state_active_color': [ opt_color, 'black' ],
|
||||
|
|
|
@ -162,7 +162,8 @@ class OptionsParser:
|
|||
d = ['accounttextcolor', 'accountbgcolor', 'accountfont',
|
||||
'accountfontattrs', 'grouptextcolor', 'groupbgcolor', 'groupfont',
|
||||
'groupfontattrs', 'contacttextcolor', 'contactbgcolor', 'contactfont',
|
||||
'contactfontattrs', 'bannertextcolor', 'bannerbgcolor']
|
||||
'contactfontattrs', 'bannertextcolor', 'bannerbgcolor', 'bannerfont',
|
||||
'bannerfontattrs']
|
||||
for theme_name in (_('grocery'), _('plain')):
|
||||
if theme_name not in gajim.config.get_per('themes'):
|
||||
gajim.config.add_per('themes', theme_name)
|
||||
|
|
|
@ -417,6 +417,8 @@ class PreferencesWindow:
|
|||
self.on_msg_treemodel_row_changed)
|
||||
self.msg_tree.get_model().connect('row-deleted',
|
||||
self.on_msg_treemodel_row_deleted)
|
||||
|
||||
self.theme_preferences = None
|
||||
|
||||
def on_preferences_window_show(self, widget):
|
||||
self.update_preferences_window()
|
||||
|
@ -532,7 +534,10 @@ class PreferencesWindow:
|
|||
gajim.interface.roster.reload_jabber_state_images()
|
||||
|
||||
def on_manage_theme_button_clicked(self, widget):
|
||||
dialogs.GajimThemesWindow()
|
||||
if self.theme_preferences is None:
|
||||
self.theme_preferences = dialogs.GajimThemesWindow()
|
||||
else:
|
||||
self.theme_preferences.window.present()
|
||||
|
||||
def on_theme_combobox_changed(self, widget):
|
||||
model = widget.get_model()
|
||||
|
|
|
@ -74,12 +74,17 @@ class GajimThemesWindow:
|
|||
self.set_theme_options(self.current_theme, self.current_option)
|
||||
|
||||
self.xml.signal_autoconnect(self)
|
||||
self.window.connect('delete-event', self.on_themese_window_delete_event)
|
||||
self.themes_tree.get_selection().connect('changed',
|
||||
self.selection_changed)
|
||||
self.window.show_all()
|
||||
|
||||
|
||||
def on_themese_window_delete_event(self, widget, event):
|
||||
self.window.hide()
|
||||
return True # do NOT destroy the window
|
||||
|
||||
def on_close_button_clicked(self, widget):
|
||||
self.window.destroy()
|
||||
self.window.hide()
|
||||
|
||||
def on_theme_cell_edited(self, cell, row, new_name):
|
||||
model = self.themes_tree.get_model()
|
||||
|
|
Loading…
Reference in New Issue