showoffline in .gajimrc and convertion "~/" -> "/home/user" in optparser.py

This commit is contained in:
Yann Leboulanger 2003-10-23 18:29:15 +00:00
parent 7d6e55243e
commit 7bea0341fa
3 changed files with 11 additions and 9 deletions

View File

@ -20,12 +20,13 @@
import ConfigParser import ConfigParser
import logging import logging
import os
log = logging.getLogger('common.options') log = logging.getLogger('common.options')
class OptionsParser: class OptionsParser:
def __init__(self, fname): def __init__(self, fname):
self.__fname = fname self.__fname = os.path.expanduser(fname)
# END __init__ # END __init__
def parseCfgFile(self): def parseCfgFile(self):

View File

@ -21,7 +21,6 @@
import Queue import Queue
import socket import socket
import sys import sys
import os
import time import time
import logging import logging
@ -32,17 +31,13 @@ import common.optparser
log = logging.getLogger('core.core') log = logging.getLogger('core.core')
log.setLevel(logging.DEBUG) log.setLevel(logging.DEBUG)
if 'HOME' in os.environ: CONFPATH = "~/.gajimrc"
home = os.environ['HOME']
elif os.name == 'posix':
home = os.path.expanduser("~/")
CONFPATH = os.path.join(home,".gajimrc")
class GajimCore: class GajimCore:
def __init__(self): def __init__(self):
self.connected = 0 self.connected = 0
self.cfgParser = common.optparser.OptionsParser(CONFPATH) 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.hub = common.hub.GajimHub()
self.cfgParser.parseCfgFile() self.cfgParser.parseCfgFile()
# END __init__ # END __init__

View File

@ -23,6 +23,9 @@ pygtk.require('2.0')
import gtk import gtk
import gtk.glade import gtk.glade
import gobject import gobject
import string
import common.optparser
CONFPATH = "~/.gajimrc"
class user: class user:
def __init__(self, *args): def __init__(self, *args):
@ -214,6 +217,8 @@ class roster:
def __init__(self, queueOUT): def __init__(self, queueOUT):
#initialisation des variables #initialisation des variables
# FIXME : handle no file ... # FIXME : handle no file ...
self.cfgParser = common.optparser.OptionsParser(CONFPATH)
self.cfgParser.parseCfgFile()
self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Gajim') self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Gajim')
self.tree = self.xml.get_widget('treeview') self.tree = self.xml.get_widget('treeview')
self.treestore = gtk.TreeStore(gtk.gdk.Pixbuf, str, str) self.treestore = gtk.TreeStore(gtk.gdk.Pixbuf, str, str)
@ -225,7 +230,8 @@ class roster:
self.optionmenu = self.xml.get_widget('optionmenu') self.optionmenu = self.xml.get_widget('optionmenu')
self.optionmenu.set_history(6) self.optionmenu.set_history(6)
self.tab_messages = {} self.tab_messages = {}
self.showOffline=0 self.showOffline=string.atoi(self.cfgParser.GtkGui_showoffline)
print self.showOffline
#colonnes #colonnes
self.col = gtk.TreeViewColumn() self.col = gtk.TreeViewColumn()