From 3ca05afabaad4073fdcecabbdbca4c4350731c36 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos <kourem@gmail.com> Date: Fri, 10 Jun 2005 19:31:38 +0000 Subject: [PATCH] moving code away of config.py --- src/config.py | 56 +------------------------------------- src/gajim_themes_window.py | 55 +++++++++++++++++++++++++++++++++++++ src/groupchat_window.py | 1 - 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/config.py b/src/config.py index 4359dcab05..34e9074902 100644 --- a/src/config.py +++ b/src/config.py @@ -492,68 +492,14 @@ class Preferences_window: def on_manage_theme_button_clicked(self, widget): dialogs.GajimThemesWindow(self.plugin) - - - def on_roster_widget_color_set(self, widget, text): - color = widget.get_color() - color_string = mk_color_string(color) - gajim.config.set(text, color_string) - self.plugin.roster.draw_roster() - self.plugin.save_config() - - def on_account_text_colorbutton_color_set(self, widget): - self.on_roster_widget_color_set(widget, 'accounttextcolor') - - def on_group_text_colorbutton_color_set(self, widget): - self.on_roster_widget_color_set(widget, 'grouptextcolor') - - def on_user_text_colorbutton_color_set(self, widget): - self.on_roster_widget_color_set(widget, 'contacttextcolor') - - def on_account_text_bg_colorbutton_color_set(self, widget): - self.on_roster_widget_color_set(widget, 'accountbgcolor') - - def on_group_text_bg_colorbutton_color_set(self, widget): - self.on_roster_widget_color_set(widget, 'groupbgcolor') - - def on_user_text_bg_colorbutton_color_set(self, widget): - self.on_roster_widget_color_set(widget, 'contactbgcolor') - - def on_widget_font_set(self, widget, text): - font_string = widget.get_font_name() - gajim.config.set(text, font_string) - self.plugin.roster.draw_roster() - self.plugin.save_config() - - def on_account_text_fontbutton_font_set(self, widget): - self.on_widget_font_set(widget, 'accountfont') - - def on_group_text_fontbutton_font_set(self, widget): - self.on_widget_font_set(widget, 'groupfont') - - def on_user_text_fontbutton_font_set(self, widget): - self.on_widget_font_set(widget, 'userfont') def on_theme_combobox_changed(self, widget): - color_widgets = { - 'account_text_colorbutton': 'accounttextcolor', - 'group_text_colorbutton': 'grouptextcolor', - 'user_text_colorbutton': 'contacttextcolor', - 'account_text_bg_colorbutton': 'accountbgcolor', - 'group_text_bg_colorbutton': 'groupbgcolor', - 'user_text_bg_colorbutton': 'contactbgcolor' - } - 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] gajim.config.set('roster_theme', theme) + # begin repainting themed widgets throughout self.plugin.roster.repaint_themed_widgets() self.plugin.save_config() diff --git a/src/gajim_themes_window.py b/src/gajim_themes_window.py index b2b37ab640..41ad773224 100644 --- a/src/gajim_themes_window.py +++ b/src/gajim_themes_window.py @@ -39,6 +39,21 @@ class GajimThemesWindow: self.xml.signal_autoconnect(self) self.window.show_all() + + color_widgets = { + 'account_text_colorbutton': 'accounttextcolor', + 'group_text_colorbutton': 'grouptextcolor', + 'user_text_colorbutton': 'contacttextcolor', + 'account_text_bg_colorbutton': 'accountbgcolor', + 'group_text_bg_colorbutton': 'groupbgcolor', + 'user_text_bg_colorbutton': 'contactbgcolor' + } + font_widgets = { + 'account_text_fontbutton': 'accountfont', + 'group_text_fontbutton': 'groupfont', + 'user_text_fontbutton': 'userfont' + } + ''' fonts_colors_table = self.xml.get_widget('fonts_colors_table') if theme == 'custom': @@ -62,3 +77,43 @@ class GajimThemesWindow: widg.set_font_name(self.theme_default[theme][font_widgets[w]]) self.on_widget_font_set(widg, font_widgets[w]) ''' + + def on_roster_widget_color_set(self, widget, text): + color = widget.get_color() + color_string = mk_color_string(color) + gajim.config.set(text, color_string) + self.plugin.roster.draw_roster() + self.plugin.save_config() + + def on_account_text_colorbutton_color_set(self, widget): + self.on_roster_widget_color_set(widget, 'accounttextcolor') + + def on_group_text_colorbutton_color_set(self, widget): + self.on_roster_widget_color_set(widget, 'grouptextcolor') + + def on_user_text_colorbutton_color_set(self, widget): + self.on_roster_widget_color_set(widget, 'contacttextcolor') + + def on_account_text_bg_colorbutton_color_set(self, widget): + self.on_roster_widget_color_set(widget, 'accountbgcolor') + + def on_group_text_bg_colorbutton_color_set(self, widget): + self.on_roster_widget_color_set(widget, 'groupbgcolor') + + def on_user_text_bg_colorbutton_color_set(self, widget): + self.on_roster_widget_color_set(widget, 'contactbgcolor') + + def on_widget_font_set(self, widget, text): + font_string = widget.get_font_name() + gajim.config.set(text, font_string) + self.plugin.roster.draw_roster() + self.plugin.save_config() + + def on_account_text_fontbutton_font_set(self, widget): + self.on_widget_font_set(widget, 'accountfont') + + def on_group_text_fontbutton_font_set(self, widget): + self.on_widget_font_set(widget, 'groupfont') + + def on_user_text_fontbutton_font_set(self, widget): + self.on_widget_font_set(widget, 'userfont') diff --git a/src/groupchat_window.py b/src/groupchat_window.py index a04a03dba2..5233a9ef81 100644 --- a/src/groupchat_window.py +++ b/src/groupchat_window.py @@ -80,7 +80,6 @@ class Groupchat_window(chat.Chat): 'subject': self.subjects[jid], } - def load_var(self, jid, var): if not self.xmls.has_key(jid): return -- GitLab