home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import os
- import sys
- from os.path import join, exists, isdir, isfile, dirname, abspath, expanduser
- import gtk
- import gtk.gdk as gtk
- import gconf
- import gobject
- import cPickle
- from defs import *
- DEBUGGING = False
- UNINSTALLED_INVEST = False
-
- def _check(path):
- if exists(path) and isdir(path):
- pass
- return isfile(path + '/ChangeLog')
-
- name = join(dirname(__file__), '..')
- if _check(name):
- UNINSTALLED_INVEST = True
-
- if UNINSTALLED_INVEST:
- SHARED_DATA_DIR = abspath(join(dirname(__file__), '..', 'data'))
- BUILDER_DATA_DIR = SHARED_DATA_DIR
- ART_DATA_DIR = join(SHARED_DATA_DIR, 'art')
- else:
- SHARED_DATA_DIR = join(DATA_DIR, 'gnome-applets', 'invest-applet')
- BUILDER_DATA_DIR = BUILDERDIR
- ART_DATA_DIR = SHARED_DATA_DIR
- if DEBUGGING:
- print 'Data Dir: %s' % SHARED_DATA_DIR
-
- USER_INVEST_DIR = expanduser('~/.gnome2/invest-applet')
- if not exists(USER_INVEST_DIR):
-
- try:
- os.makedirs(USER_INVEST_DIR, 484)
- except Exception:
- msg = None
- print 'Error:could not create user dir (%s): %s' % (USER_INVEST_DIR, msg)
- except:
- None<EXCEPTION MATCH>Exception
-
-
- None<EXCEPTION MATCH>Exception
- os.chdir(expanduser('~'))
- GCONF_CLIENT = gconf.client_get_default()
- GCONF_DIR = '/apps/invest'
- STOCKS_FILE = join(USER_INVEST_DIR, 'stocks.pickle')
-
- try:
- STOCKS = cPickle.load(file(STOCKS_FILE))
- except Exception:
- msg = None
- STOCKS = { }
-
- client = gconf.client_get_default()
-
- def get_gnome_proxy(client):
- if client.get_bool('/system/http_proxy/use_http_proxy'):
- host = client.get_string('/system/http_proxy/host')
- port = client.get_int('/system/http_proxy/port')
- if host is None and host == '' or port == 0:
- return None
- if client.get_bool('/system/http_proxy/use_authentication'):
- user = client.get_string('/system/http_proxy/authentication_user')
- password = client.get_string('/system/http_proxy/authentication_password')
- if user and user != '':
- url = 'http://%s:%s@%s:%d' % (user, password, host, port)
- else:
- url = 'http://%s:%d' % (host, port)
- else:
- url = 'http://%s:%d' % (host, port)
- return {
- 'http': url }
- return None
-
- PROXY = get_gnome_proxy(client)
-