From 7bea0341fa547ef69b802208a5fae71ba267cd99 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 23 Oct 2003 18:29:15 +0000 Subject: [PATCH] showoffline in .gajimrc and convertion "~/" -> "/home/user" in optparser.py --- common/optparser.py | 3 ++- core/core.py | 9 ++------- plugins/gtkgui.py | 8 +++++++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/common/optparser.py b/common/optparser.py index af9edfcfc..9125bbcbe 100644 --- a/common/optparser.py +++ b/common/optparser.py @@ -20,12 +20,13 @@ import ConfigParser import logging +import os log = logging.getLogger('common.options') class OptionsParser: def __init__(self, fname): - self.__fname = fname + self.__fname = os.path.expanduser(fname) # END __init__ def parseCfgFile(self): diff --git a/core/core.py b/core/core.py index 7b5003c4b..68d5a3542 100644 --- a/core/core.py +++ b/core/core.py @@ -21,7 +21,6 @@ import Queue import socket import sys -import os import time import logging @@ -32,17 +31,13 @@ import common.optparser log = logging.getLogger('core.core') log.setLevel(logging.DEBUG) -if 'HOME' in os.environ: - home = os.environ['HOME'] -elif os.name == 'posix': - home = os.path.expanduser("~/") -CONFPATH = os.path.join(home,".gajimrc") +CONFPATH = "~/.gajimrc" class GajimCore: def __init__(self): self.connected = 0 self.cfgParser = common.optparser.OptionsParser(CONFPATH) - print '%s\n' % self.cfgParser.Server_hostname; +# print '%s\n' % self.cfgParser.Server_hostname; self.hub = common.hub.GajimHub() self.cfgParser.parseCfgFile() # END __init__ diff --git a/plugins/gtkgui.py b/plugins/gtkgui.py index 37325a31c..748a75efc 100644 --- a/plugins/gtkgui.py +++ b/plugins/gtkgui.py @@ -23,6 +23,9 @@ pygtk.require('2.0') import gtk import gtk.glade import gobject +import string +import common.optparser +CONFPATH = "~/.gajimrc" class user: def __init__(self, *args): @@ -214,6 +217,8 @@ class roster: def __init__(self, queueOUT): #initialisation des variables # FIXME : handle no file ... + self.cfgParser = common.optparser.OptionsParser(CONFPATH) + self.cfgParser.parseCfgFile() self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Gajim') self.tree = self.xml.get_widget('treeview') self.treestore = gtk.TreeStore(gtk.gdk.Pixbuf, str, str) @@ -225,7 +230,8 @@ class roster: self.optionmenu = self.xml.get_widget('optionmenu') self.optionmenu.set_history(6) self.tab_messages = {} - self.showOffline=0 + self.showOffline=string.atoi(self.cfgParser.GtkGui_showoffline) + print self.showOffline #colonnes self.col = gtk.TreeViewColumn()