Example #1
0
    def next(self):
        sig_name = self.gale_user.get()
        gale_env.set('GALE_ID', sig_name)
        gale_dir = gale_env.get('GALE_DIR',
                                os.path.join(userinfo.home_dir, '.gale'))
        privkey = os.path.join(gale_dir, 'auth', 'private', sig_name)
        privkey_gpri = os.path.join(gale_dir, 'auth', 'private',
                                    sig_name + '.gpri')
        self.vars['sig_name'] = sig_name
        if os.path.exists(privkey_gpri):
            file_exists = 1
            sigfile = privkey_gpri
        elif os.path.exists(privkey):
            file_exists = 1
            sigfile = privkey
        else:
            file_exists = 0
            sigfile = None
        next_is_sigscreen = self.wizard.next_screen_is(self, FindSignature)
        if not file_exists and not next_is_sigscreen:
            self.wizard.add_screen_after(self, FindSignature)
        elif not file_exists and next_is_sigscreen:
            pass
        elif file_exists and not next_is_sigscreen:
            pass
        elif file_exists and next_is_sigscreen:
            self.wizard.del_screen_after(self)

        if file_exists:
            self.vars['sig_file_name'] = sigfile
Example #2
0
	def next(self):
		sig_name = self.gale_user.get()
		gale_env.set('GALE_ID', sig_name)
		gale_dir = gale_env.get('GALE_DIR',
			os.path.join(userinfo.home_dir, '.gale'))
		privkey = os.path.join(gale_dir, 'auth', 'private', sig_name)
		privkey_gpri = os.path.join(gale_dir, 'auth', 'private',
			sig_name + '.gpri')
		self.vars['sig_name'] = sig_name
		if os.path.exists(privkey_gpri):
			file_exists = 1
			sigfile = privkey_gpri
		elif os.path.exists(privkey):
			file_exists = 1
			sigfile = privkey
		else:
			file_exists = 0
			sigfile = None
		next_is_sigscreen = self.wizard.next_screen_is(self, FindSignature)
		if not file_exists and not next_is_sigscreen:
			self.wizard.add_screen_after(self, FindSignature)
		elif not file_exists and next_is_sigscreen:
			pass
		elif file_exists and not next_is_sigscreen:
			pass
		elif file_exists and next_is_sigscreen:
			self.wizard.del_screen_after(self)

		if file_exists:
			self.vars['sig_file_name'] = sigfile			
Example #3
0
def get_gale_sys_env():	
	pygaledir = gale_env.get('PYGALE_DIR',
		os.path.join(userinfo.home_dir, '.gale'))
	fname = os.path.join(pygaledir, PYGALE_CONF)
	if os.path.exists(fname):
		gale_env.load_file(fname)
		result = 'Reading PyGale settings from ' + fname
	else:
		# Assume some reasonable defaults
		try:
			gale_env.set('GALE_SYS_DIR', os.path.join(string.strip(
				os.popen('gale-config --prefix', 'r').read()),
				'etc', 'gale'))
		except:			
			# Can't find gale-config; Gale probably isn't installed
			if sys.platform == 'win32':
				gale_env.set('GALE_SYS_DIR', get_start_dir())
			else:
				gale_env.set('GALE_SYS_DIR', '/usr/local/etc/gale')
		conffile = os.path.join(gale_env.get('GALE_SYS_DIR'), 'conf')
		if os.path.exists(conffile):
			confvars = gale_env.parse_sys_conf(conffile)
			result = 'Reading Gale settings from ' + conffile
		else:
			confvars = {}
			result = 'No existing Gale configuration found'
		if confvars.has_key('GALE_DOMAIN'):
			gale_env.set('GALE_DOMAIN', confvars['GALE_DOMAIN'])
		
	return result
Example #4
0
def get_gale_sys_env():
    pygaledir = gale_env.get('PYGALE_DIR',
                             os.path.join(userinfo.home_dir, '.gale'))
    fname = os.path.join(pygaledir, PYGALE_CONF)
    if os.path.exists(fname):
        gale_env.load_file(fname)
        result = 'Reading PyGale settings from ' + fname
    else:
        # Assume some reasonable defaults
        try:
            gale_env.set(
                'GALE_SYS_DIR',
                os.path.join(
                    string.strip(os.popen('gale-config --prefix', 'r').read()),
                    'etc', 'gale'))
        except:
            # Can't find gale-config; Gale probably isn't installed
            if sys.platform == 'win32':
                gale_env.set('GALE_SYS_DIR', get_start_dir())
            else:
                gale_env.set('GALE_SYS_DIR', '/usr/local/etc/gale')
        conffile = os.path.join(gale_env.get('GALE_SYS_DIR'), 'conf')
        if os.path.exists(conffile):
            confvars = gale_env.parse_sys_conf(conffile)
            result = 'Reading Gale settings from ' + conffile
        else:
            confvars = {}
            result = 'No existing Gale configuration found'
        if confvars.has_key('GALE_DOMAIN'):
            gale_env.set('GALE_DOMAIN', confvars['GALE_DOMAIN'])

    return result
Example #5
0
class GetPygaleDir(Tkinter.Frame):
    def __init__(self, master, wizard, vars):
        Tkinter.Frame.__init__(self, master)
        self.wizard = wizard
        self.vars = vars
        self.title = 'PyGale configuration'
        self.galedir = gale_env.get('PYGALE_DIR',
                                    os.path.join(userinfo.home_dir, '.gale'))
        if not os.path.exists(self.galedir):
            create_str = "\n\nThis directory does not exist.  I'll " +\
                  'create it for you.\n'
        else:
            create_str = '\n\nGood!  This directory already exists.\n'

        conffile = os.path.join(self.galedir, PYGALE_CONF)
        if os.path.exists(conffile):
            create_str = create_str + "I'll read the settings from " +\
             'your existing conf file.\n'
            gale_env.load_file(conffile)

        self.label = Tkinter.Label(
            self,
            wraplength=310,
            anchor='nw',
            justify='left',
            text='PyGale configuration, version %s\n\n' % version.VERSION +
            'By default, this configuration will be stored in the ' +
            '.gale directory in your home directory.  Optionally, you ' +
            'can set the environment variable PYGALE_DIR to a directory ' +
            'where the configuration file will be stored.\n\n' +
            'Your Gale directory is: ' + self.galedir + create_str)

    def display(self):
        self.grid(row=0, column=0, sticky='wens')
        self.label.grid(row=0, column=0, sticky='news')

    def undisplay(self):
        self.grid_forget()
        self.label.grid_forget()

    def next(self):
        try:
            make_path(self.galedir)
        except OSError, e:
            m = tkMessageBox.showerror(title='Cannot create directory',
                                       parent=self,
                                       message='Unable to create directory ' +
                                       self.galedir + ':\n' + e[1] + '\n\n' +
                                       'Aborting configuration...')
            self.wizard.abort = 1
        gale_env.set('PYGALE_DIR', self.galedir)
Example #6
0
	def next(self):
		gale_env.set('GALE_NAME', self.user_name.get())
Example #7
0
	def next(self):
		gale_env.set('GALE_DOMAIN', self.gale_domain.get())
Example #8
0
	def next(self):
		abspath = os.path.abspath(self.gale_sys_dir.get())
		gale_env.set('GALE_SYS_DIR', abspath)
Example #9
0
 def next(self):
     gale_env.set('GALE_NAME', self.user_name.get())
Example #10
0
 def next(self):
     gale_env.set('GALE_DOMAIN', self.gale_domain.get())
Example #11
0
 def next(self):
     abspath = os.path.abspath(self.gale_sys_dir.get())
     gale_env.set('GALE_SYS_DIR', abspath)