Example #1
0
def saveDirectory(alias):
	"""save a directory to a certain alias/nickname"""
	if not settings.platformCompatible():
		return False
	dataFile = open(settings.getDataFile(), "wb")
	currentDirectory = os.path.abspath(".")
	directory = {alias : currentDirectory}
	pickle.dump(directory, dataFile)
	speech.success(alias + " will now link to " + currentDirectory + ".")
	speech.success("Tip: use 'hallie go to " + alias + "' to change to this directory.")
Example #2
0
def saveDirectory(alias):
    """save a directory to a certain alias/nickname"""
    if not settings.platformCompatible():
        return False
    dataFile = open(settings.getDataFile(), "wb")
    currentDirectory = os.path.abspath(".")
    directory = {alias: currentDirectory}
    pickle.dump(directory, dataFile)
    speech.success(alias + " will now link to " + currentDirectory + ".")
    speech.success("Tip: use 'hallie go to " + alias +
                   "' to change to this directory.")
Example #3
0
def goToDirectory(alias):
	"""go to a saved directory"""
	if not settings.platformCompatible():
		return False
	data = pickle.load(open(settings.getDataFile(), "rb"))
	try:
		data[alias]
	except KeyError:
		speech.fail("Sorry, it doesn't look like you have saved " + alias + " yet.")
		speech.fail("Go to the directory you'd like to save and type 'hallie save as " + alias + "\'")
		return
	try:
		(output, error) = subprocess.Popen(["osascript", "-e", CHANGE_DIR % (data[alias])], stdout=subprocess.PIPE).communicate()
	except:
		speech.fail("Something seems to have gone wrong. Please report this error to [email protected].")
		return
	speech.success("Successfully navigating to " + data[alias])
Example #4
0
def goToDirectory(alias):
    """go to a saved directory"""
    if not settings.platformCompatible():
        return False
    data = pickle.load(open(settings.getDataFile(), "rb"))
    try:
        data[alias]
    except KeyError:
        speech.fail("Sorry, it doesn't look like you have saved " + alias +
                    " yet.")
        speech.fail(
            "Go to the directory you'd like to save and type 'hallie save as "
            + alias + "\'")
        return
    try:
        (output, error) = subprocess.Popen(
            ["osascript", "-e", CHANGE_DIR % (data[alias])],
            stdout=subprocess.PIPE).communicate()
    except:
        speech.fail(
            "Something seems to have gone wrong. Please report this error to [email protected]."
        )
        return
    speech.success("Successfully navigating to " + data[alias])