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' ],
|
||||
'statusmsgcolor': [ opt_color, '#1eaa1e' ],
|
||||
'hiddenlines': [ opt_str, '' ],
|
||||
'roster_theme': [ opt_str, 'green' ],
|
||||
'accounttextcolor': [ opt_color, '#ffffff' ],
|
||||
'accountbgcolor': [ opt_color, '#94aa8c' ],
|
||||
'accountfont': [ opt_str, 'Sans Bold 10' ],
|
||||
|
|
114
src/config.py
114
src/config.py
|
@ -151,31 +151,43 @@ class Preferences_window:
|
|||
def on_user_text_fontbutton_font_set(self, widget):
|
||||
self.on_widget_font_set(widget, 'userfont')
|
||||
|
||||
def on_reset_colors_and_fonts_button_clicked(self, widget):
|
||||
for i in ['accounttextcolor', 'grouptextcolor', \
|
||||
'usertextcolor', 'accountbgcolor', 'groupbgcolor', \
|
||||
'userbgcolor', 'accountfont', 'groupfont','userfont' ]:
|
||||
|
||||
gajim.config.set(i, gajim.config.get_default(i))
|
||||
|
||||
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'))
|
||||
def on_theme_combobox_changed(self, widget):
|
||||
color_widgets = {
|
||||
'account_text_colorbutton': 'accounttextcolor',
|
||||
'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('roster_theme', theme)
|
||||
self.plugin.roster.draw_roster()
|
||||
self.plugin.save_config()
|
||||
|
||||
|
@ -642,28 +654,38 @@ class Preferences_window:
|
|||
if gajim.config.get('iconset') == l[i]:
|
||||
self.iconset_combobox.set_active(i)
|
||||
|
||||
# update color widget(%2) = color(%1)
|
||||
tab = { 'accounttextcolor': 'account_text_colorbutton', \
|
||||
'grouptextcolor': 'group_text_colorbutton', \
|
||||
'usertextcolor': 'user_text_colorbutton', \
|
||||
'accountbgcolor': 'account_text_bg_colorbutton', \
|
||||
'groupbgcolor': 'group_text_bg_colorbutton', \
|
||||
'userbgcolor': 'user_text_bg_colorbutton', }
|
||||
for i in tab:
|
||||
col = gtk.gdk.color_parse(gajim.config.get(i))
|
||||
self.xml.get_widget(tab[i]).set_color(col)
|
||||
|
||||
|
||||
# update font widget(%2) = font(%1)
|
||||
tab = { 'accountfont': 'account_text_fontbutton', \
|
||||
'groupfont': 'group_text_fontbutton', \
|
||||
'userfont': 'user_text_fontbutton', }
|
||||
# Roster colors / font
|
||||
self.theme_default = {
|
||||
'Green': {
|
||||
'accounttextcolor': '#ffffff',
|
||||
'grouptextcolor': '#0000ff',
|
||||
'usertextcolor': '#000000',
|
||||
'accountbgcolor': '#94aa8c',
|
||||
'groupbgcolor': '#eff3e7',
|
||||
'userbgcolor': '#ffffff',
|
||||
'accountfont': 'Sans Bold 10',
|
||||
'groupfont': 'Sans Italic 10',
|
||||
'userfont': 'Sans 10',
|
||||
},
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
for i in tab:
|
||||
font = gajim.config.get(i)
|
||||
self.xml.get_widget(tab[i]).set_font_name(font)
|
||||
|
||||
|
||||
#use tabbed chat window
|
||||
st = gajim.config.get('usetabbedchat')
|
||||
self.xml.get_widget('use_tabbed_chat_window_checkbutton').set_active(st)
|
||||
|
|
|
@ -3276,79 +3276,16 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="reset_colors_and_fonts_button">
|
||||
<widget class="GtkComboBox" id="theme_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<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>
|
||||
<signal name="changed" handler="on_theme_combobox_changed" last_modification_time="Fri, 29 Apr 2005 11:44:52 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<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="bottom_attach">5</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue