Пример #1
0
def openTextEditor():
    if (not os.path.exists("config.yml")):
        printLogo("logo.txt")
        editor = input("\n\n\t\t\t\tName of text editor: ")
        with open("config.yml", "a") as file:
            yaml.dump({"editor": editor}, file)
    with open("config.yml", "r") as file:
        data = yaml.load(file)
    editor = data["editor"]
    os.system(editor)
Пример #2
0
def addNewStartSite():
    try:
        sites = getDict("sitesOnStartUp.yaml")
    except:
        sites = {}
    printLogo("logo.txt")
    name = input("\n\n\n\t\t\tName of website: ")
    url = input("\n\n\t\t\tAddress of website (www.example.com): ")
    sites[name] = url
    update("sitesOnStartUp.yaml", sites)
Пример #3
0
def addSite():
    try:
        sites = getDict("sites.yaml")
    except:
        #file not found, create new dict
        sites = {}
    printLogo("logo.txt")
    name = input("\n\n\t\t\tName of website: ")
    url = input("\n\n\t\t\tAddress of website: ")
    sites[name] = url
    update("sites.yaml", sites)
Пример #4
0
def addNewStartupScript():
    try:
        scripts = getDict("startupScripts.yml")
    except:
        scripts = {}
    printLogo("logo.txt")
    name = input("\n\n\t\t\t Enter the name you wish to call the executable: ")
    path = ''
    while (not os.path.exists(path)):
        path = input(
            "\n\n\t\t\t Enter a valid path to where the exec is located: ")
    scripts[name] = path
    update("startupScripts.yml", scripts)
Пример #5
0
def addScript():
    try:
        scripts = getDict("scripts.yml")
    except:
        scripts = {}
    printLogo("logo.txt")
    name = input("\n\n\n\t\t\tEnter the name of the script: ")
    path = ''
    while (not os.path.exists(path)):
        path = input(
            "\n\n\t\t\tEnter a valid path to where the script is located:")
    scripts[name] = path
    update("scripts.yml", scripts)
Пример #6
0
def removeScript(filename):
    try:
        scripts = getDict(filename)
    except:
        printLogo("logo.txt")
        print("\n\n\t\t\tError: There are no scripts to remove")
        getch()
        return None
    options = list(scripts.keys())
    options.append("GO BACK")
    instructions = "\t  What should I remove?"
    menu = Menu(options, instructions, "logo.txt")
    temp = menu.prompt()
    if (temp != len(options) - 1):
        del scripts[options[temp]]
        update(filename, scripts)
Пример #7
0
def openSite():
    try:
        sites = getDict("sites.yaml")
    except:
        printLogo("logo.txt")
        print("\n\t\t\t\tError: There were no sites found.")
        getch()
        return None
    options = list(sites.keys())
    options.append("GO BACK")
    instructions = "\t\t  What should I open?"
    menu = Menu(options, instructions, "logo.txt")
    temp = 0
    while (temp != len(options) - 1):
        temp = menu.prompt()
        if (temp != len(options) - 1):
            webbrowser.open_new_tab("https://" + sites[options[temp]])
Пример #8
0
def runScript():
    try:
        scripts = getDict("scripts.yml")
    except:
        printLogo("logo.txt")
        print("\n\n\t\t\t\tError: There were no executables found")
        getch()
        return None
    options = list(scripts.keys())
    options.append("GO BACK")
    instructions = "\t  Select the executable you want to run"
    menu = Menu(options, instructions, "logo.txt")
    temp = 0
    while (temp != len(options) - 1):
        temp = menu.prompt()
        if (temp != len(options) - 1):
            run(scripts[options[temp]])
Пример #9
0
def addExistingStartSite():
    try:
        sites = getDict("sites.yaml")
    except:
        printLogo("logo.txt")
        print("\n\n\t\t\t\tError: No websites were found")
        getch()
        return None
    options = list(sites.keys())
    options.append("GO BACK")
    instructions = "\n\t\t\t\tWhat website should I add?"
    menu = Menu(options, instructions, "logo.txt")
    temp = menu.prompt()
    if (temp != len(options) - 1):
        try:
            startupSites = getDict("sitesOnStartUp.yaml")
        except:
            startupSites = {}
        finally:
            startupSites[options[temp]] = sites[options[temp]]
            update("sitesOnStartUp.yaml", startupSites)
Пример #10
0
def addExistingStartupScript():
    try:
        existing_scripts = getDict("scripts.yml")
    except:
        printLogo("logo.txt")
        print("\n\n\t\t\t\tError: No scripts were found")
        getch()
        return None
    options = list(existing_scripts.keys())
    options.append("GO BACK")
    instructions = "\tWhat executable should I add?"
    menu = Menu(options, instructions, "logo.txt")
    temp = menu.prompt()
    if (temp != len(options) - 1):
        try:
            scripts = getDict("startupScripts.yml")
        except:
            scripts = {}
        finally:
            scripts[options[temp]] = existing_scripts[options[temp]]
            update("startupScripts.yml", scripts)