we now have themes for roster colors / fonts
This commit is contained in:
parent
3f417a2fba
commit
fbdae750c2
|
@ -57,6 +57,7 @@ class Config:
|
||||||
'outmsgcolor': [ opt_color, '#0000ff' ],
|
'outmsgcolor': [ opt_color, '#0000ff' ],
|
||||||
'statusmsgcolor': [ opt_color, '#1eaa1e' ],
|
'statusmsgcolor': [ opt_color, '#1eaa1e' ],
|
||||||
'hiddenlines': [ opt_str, '' ],
|
'hiddenlines': [ opt_str, '' ],
|
||||||
|
'roster_theme': [ opt_str, 'green' ],
|
||||||
'accounttextcolor': [ opt_color, '#ffffff' ],
|
'accounttextcolor': [ opt_color, '#ffffff' ],
|
||||||
'accountbgcolor': [ opt_color, '#94aa8c' ],
|
'accountbgcolor': [ opt_color, '#94aa8c' ],
|
||||||
'accountfont': [ opt_str, 'Sans Bold 10' ],
|
'accountfont': [ opt_str, 'Sans Bold 10' ],
|
||||||
|
|
110
src/config.py
110
src/config.py
|
@ -151,31 +151,43 @@ class Preferences_window:
|
||||||
def on_user_text_fontbutton_font_set(self, widget):
|
def on_user_text_fontbutton_font_set(self, widget):
|
||||||
self.on_widget_font_set(widget, 'userfont')
|
self.on_widget_font_set(widget, 'userfont')
|
||||||
|
|
||||||
def on_reset_colors_and_fonts_button_clicked(self, widget):
|
def on_theme_combobox_changed(self, widget):
|
||||||
for i in ['accounttextcolor', 'grouptextcolor', \
|
color_widgets = {
|
||||||
'usertextcolor', 'accountbgcolor', 'groupbgcolor', \
|
'account_text_colorbutton': 'accounttextcolor',
|
||||||
'userbgcolor', 'accountfont', 'groupfont','userfont' ]:
|
'group_text_colorbutton': 'grouptextcolor',
|
||||||
|
'user_text_colorbutton': 'usertextcolor',
|
||||||
|
'account_text_bg_colorbutton': 'accountbgcolor',
|
||||||
|
'group_text_bg_colorbutton': 'groupbgcolor',
|
||||||
|
'user_text_bg_colorbutton': 'userbgcolor'
|
||||||
|
}
|
||||||
|
font_widgets = {
|
||||||
|
'account_text_fontbutton': 'accountfont',
|
||||||
|
'group_text_fontbutton': 'groupfont',
|
||||||
|
'user_text_fontbutton': 'userfont'
|
||||||
|
}
|
||||||
|
model = widget.get_model()
|
||||||
|
active = widget.get_active()
|
||||||
|
theme = model[active][0]
|
||||||
|
for w in color_widgets:
|
||||||
|
widg = self.xml.get_widget(w)
|
||||||
|
if theme == 'Custom':
|
||||||
|
widg.set_color(gtk.gdk.color_parse(gajim.config.get(
|
||||||
|
color_widgets[w])))
|
||||||
|
widg.set_sensitive(True)
|
||||||
|
else:
|
||||||
|
widg.set_color(gtk.gdk.color_parse(self.theme_default[theme]\
|
||||||
|
[color_widgets[w]]))
|
||||||
|
widg.set_sensitive(False)
|
||||||
|
for w in font_widgets:
|
||||||
|
widg = self.xml.get_widget(w)
|
||||||
|
if theme == 'Custom':
|
||||||
|
widg.set_font_name(gajim.config.get(font_widgets[w]))
|
||||||
|
widg.set_sensitive(True)
|
||||||
|
else:
|
||||||
|
widg.set_font_name(self.theme_default[theme][font_widgets[w]])
|
||||||
|
widg.set_sensitive(False)
|
||||||
|
|
||||||
gajim.config.set(i, gajim.config.get_default(i))
|
gajim.config.set('roster_theme', theme)
|
||||||
|
|
||||||
self.xml.get_widget('account_text_colorbutton').set_color(\
|
|
||||||
gtk.gdk.color_parse(gajim.config.get_default('accounttextcolor')))
|
|
||||||
self.xml.get_widget('group_text_colorbutton').set_color(\
|
|
||||||
gtk.gdk.color_parse(gajim.config.get_default('grouptextcolor')))
|
|
||||||
self.xml.get_widget('user_text_colorbutton').set_color(\
|
|
||||||
gtk.gdk.color_parse(gajim.config.get_default('usertextcolor')))
|
|
||||||
self.xml.get_widget('account_text_bg_colorbutton').set_color(\
|
|
||||||
gtk.gdk.color_parse(gajim.config.get_default('accountbgcolor')))
|
|
||||||
self.xml.get_widget('group_text_bg_colorbutton').set_color(\
|
|
||||||
gtk.gdk.color_parse(gajim.config.get_default('groupbgcolor')))
|
|
||||||
self.xml.get_widget('user_text_bg_colorbutton').set_color(\
|
|
||||||
gtk.gdk.color_parse(gajim.config.get_default('userbgcolor')))
|
|
||||||
self.xml.get_widget('account_text_fontbutton').set_font_name(\
|
|
||||||
gajim.config.get_default('accountfont'))
|
|
||||||
self.xml.get_widget('group_text_fontbutton').set_font_name(\
|
|
||||||
gajim.config.get_default('groupfont'))
|
|
||||||
self.xml.get_widget('user_text_fontbutton').set_font_name(\
|
|
||||||
gajim.config.get_default('userfont'))
|
|
||||||
self.plugin.roster.draw_roster()
|
self.plugin.roster.draw_roster()
|
||||||
self.plugin.save_config()
|
self.plugin.save_config()
|
||||||
|
|
||||||
|
@ -642,27 +654,37 @@ class Preferences_window:
|
||||||
if gajim.config.get('iconset') == l[i]:
|
if gajim.config.get('iconset') == l[i]:
|
||||||
self.iconset_combobox.set_active(i)
|
self.iconset_combobox.set_active(i)
|
||||||
|
|
||||||
# update color widget(%2) = color(%1)
|
# Roster colors / font
|
||||||
tab = { 'accounttextcolor': 'account_text_colorbutton', \
|
self.theme_default = {
|
||||||
'grouptextcolor': 'group_text_colorbutton', \
|
'Green': {
|
||||||
'usertextcolor': 'user_text_colorbutton', \
|
'accounttextcolor': '#ffffff',
|
||||||
'accountbgcolor': 'account_text_bg_colorbutton', \
|
'grouptextcolor': '#0000ff',
|
||||||
'groupbgcolor': 'group_text_bg_colorbutton', \
|
'usertextcolor': '#000000',
|
||||||
'userbgcolor': 'user_text_bg_colorbutton', }
|
'accountbgcolor': '#94aa8c',
|
||||||
for i in tab:
|
'groupbgcolor': '#eff3e7',
|
||||||
col = gtk.gdk.color_parse(gajim.config.get(i))
|
'userbgcolor': '#ffffff',
|
||||||
self.xml.get_widget(tab[i]).set_color(col)
|
'accountfont': 'Sans Bold 10',
|
||||||
|
'groupfont': 'Sans Italic 10',
|
||||||
|
'userfont': 'Sans 10',
|
||||||
# update font widget(%2) = font(%1)
|
},
|
||||||
tab = { 'accountfont': 'account_text_fontbutton', \
|
}
|
||||||
'groupfont': 'group_text_fontbutton', \
|
|
||||||
'userfont': 'user_text_fontbutton', }
|
|
||||||
|
|
||||||
for i in tab:
|
|
||||||
font = gajim.config.get(i)
|
|
||||||
self.xml.get_widget(tab[i]).set_font_name(font)
|
|
||||||
|
|
||||||
|
theme_combobox = self.xml.get_widget('theme_combobox')
|
||||||
|
cell = gtk.CellRendererText()
|
||||||
|
theme_combobox.pack_start(cell, True)
|
||||||
|
theme_combobox.add_attribute(cell, 'text', 0)
|
||||||
|
model = gtk.ListStore(gobject.TYPE_STRING)
|
||||||
|
theme_combobox.set_model(model)
|
||||||
|
i = 0
|
||||||
|
for t in self.theme_default:
|
||||||
|
model.append([t])
|
||||||
|
if gajim.config.get('roster_theme') == t:
|
||||||
|
theme_combobox.set_active(i)
|
||||||
|
i += 1
|
||||||
|
model.append(['Custom'])
|
||||||
|
if gajim.config.get('roster_theme') == 'Custom':
|
||||||
|
theme_combobox.set_active(i)
|
||||||
|
self.on_theme_combobox_changed(theme_combobox)
|
||||||
|
|
||||||
#use tabbed chat window
|
#use tabbed chat window
|
||||||
st = gajim.config.get('usetabbedchat')
|
st = gajim.config.get('usetabbedchat')
|
||||||
|
|
|
@ -3276,79 +3276,16 @@
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="reset_colors_and_fonts_button">
|
<widget class="GtkComboBox" id="theme_combobox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<signal name="changed" handler="on_theme_combobox_changed" last_modification_time="Fri, 29 Apr 2005 11:44:52 GMT"/>
|
||||||
<property name="focus_on_click">False</property>
|
|
||||||
<signal name="clicked" handler="on_reset_colors_and_fonts_button_clicked" last_modification_time="Sun, 06 Mar 2005 20:29:53 GMT"/>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkAlignment" id="alignment50">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="xalign">0.5</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xscale">0</property>
|
|
||||||
<property name="yscale">0</property>
|
|
||||||
<property name="top_padding">0</property>
|
|
||||||
<property name="bottom_padding">0</property>
|
|
||||||
<property name="left_padding">0</property>
|
|
||||||
<property name="right_padding">0</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkHBox" id="hbox2935">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="homogeneous">False</property>
|
|
||||||
<property name="spacing">2</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImage" id="image438">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-revert-to-saved</property>
|
|
||||||
<property name="icon_size">4</property>
|
|
||||||
<property name="xalign">0.5</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label215">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">_Reset to default colors & fonts</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
|
||||||
<property name="wrap">False</property>
|
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0.5</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="right_attach">3</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="top_attach">4</property>
|
<property name="top_attach">4</property>
|
||||||
<property name="bottom_attach">5</property>
|
<property name="bottom_attach">5</property>
|
||||||
<property name="x_options">fill</property>
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Reference in New Issue