From e1fd6f4c68d35a42904c2f4d81ef4194ffc870d6 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 30 Dec 2003 01:07:38 +0000 Subject: [PATCH] iconstyle choice in preference window --- plugins/gtkgui/gtkgui.glade | 66 +++++++++++++++++++++++++++++++++++++ plugins/gtkgui/gtkgui.py | 45 ++++++++++++++++++------- 2 files changed, 99 insertions(+), 12 deletions(-) diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 61ec2e178..fbc3ff7f5 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -2741,6 +2741,72 @@ David Ferlier (david@yazzy.org) 0 + + + + 150 + 70 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + True + False + False + True + False + + + + True + True + True + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + + + + + True + Icon Style + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 210 + 0 + + False diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index 9a8a33b94..4337ba47f 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -119,6 +119,11 @@ class prefs: else: self.r.cfgParser.set('GtkGui', 'autopopup', '0') self.r.autopopup = 0 + #IconStyle + ist = self.combo_iconstyle.entry.get_text() + self.r.cfgParser.set('GtkGui', 'iconstyle', ist) + self.r.iconstyle = ist + self.r.mkpixbufs() self.r.cfgParser.writeCfgFile() self.r.cfgParser.parseCfgFile() @@ -135,6 +140,7 @@ class prefs: self.da_out = self.xml.get_widget("drawing_out") self.da_status = self.xml.get_widget("drawing_status") self.chk_autopp = self.xml.get_widget("chk_autopopup") + self.combo_iconstyle = self.xml.get_widget("combo_iconstyle") #Color for incomming messages colSt = self.r.cfgParser.GtkGui_inmsgcolor @@ -166,6 +172,18 @@ class prefs: st = '0' pp = string.atoi(st) self.chk_autopp.set_active(pp) + + #iconStyle + list_style = os.listdir('plugins/gtkgui/icons/') + l = [] + for i in list_style: + if i != 'CVS': + l.append(i) + if l.count == 0: + l.append(" ") + self.combo_iconstyle.set_popdown_strings(l) + if self.r.iconstyle in l: + self.combo_iconstyle.entry.set_text(self.r.iconstyle) self.xml.signal_connect('gtk_widget_destroy', self.delete_event) self.xml.signal_connect('on_but_col_clicked', self.on_color_button_clicked) @@ -805,6 +823,17 @@ class roster: if not Wbrowser: Wbrowser = browser(self) + def mkpixbufs(self): + self.path = 'plugins/gtkgui/icons/' + self.iconstyle + '/' + self.pixbufs = {} + for state in ('online', 'away', 'xa', 'dnd', 'offline', 'requested', 'message', 'opened', 'closed'): + if not os.path.exists(self.path + state + '.xpm'): + print 'No such file : ' + self.path + state + '.xpm' + self.pixbufs[state] = None + else: + pix = gtk.gdk.pixbuf_new_from_file (self.path + state + '.xpm') + self.pixbufs[state] = pix + def __init__(self, queueOUT, plug): # FIXME : handle no file ... self.cfgParser = common.optparser.OptionsParser(CONFPATH) @@ -815,18 +844,10 @@ class roster: self.plug = plug #(icon, name, jid, editable, background color, show_icon) self.treestore = gtk.TreeStore(gtk.gdk.Pixbuf, str, str, gobject.TYPE_BOOLEAN, str, gobject.TYPE_BOOLEAN) - iconstyle = self.cfgParser.GtkGui_iconstyle - if not iconstyle: - iconstyle = 'sun' - self.path = 'plugins/gtkgui/icons/' + iconstyle + '/' - self.pixbufs = {} - for state in ('online', 'away', 'xa', 'dnd', 'offline', 'requested', 'message', 'opened', 'closed'): - if not os.path.exists(self.path + state + '.xpm'): - print 'No such file : ' + self.path + state + '.xpm' - self.pixbufs[state] = None - else: - pix = gtk.gdk.pixbuf_new_from_file (self.path + state + '.xpm') - self.pixbufs[state] = pix + self.iconstyle = self.cfgParser.GtkGui_iconstyle + if not self.iconstyle: + self.iconstyle = 'sun' + self.mkpixbufs() self.tree.set_model(self.treestore) # map = self.tree.get_colormap() # colour = map.alloc_color("red") # light red