コード例 #1
0
ファイル: open.py プロジェクト: kstanoev/enso-portable
def reload_shortcuts_map():
    desktop_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_DESKTOPDIRECTORY, 0, 0)
    quick_launch_dir = os.path.join(
        shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0),
        "Microsoft",
        "Internet Explorer",
        "Quick Launch")
    start_menu_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_STARTMENU, 0, 0)
    common_start_menu_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_STARTMENU, 0, 0)
    #control_panel = shell.SHGetFolderPath(0, shellcon.CSIDL_CONTROLS, 0, 0)


    shortcuts = get_shortcuts(LEARN_AS_DIR) + \
        get_shortcuts(desktop_dir) + \
        get_shortcuts(quick_launch_dir) + \
        get_shortcuts(start_menu_dir) + \
        get_shortcuts(common_start_menu_dir) + \
        get_universal_windows_apps() + \
        control_panel_applets

    return dict((s[1], s) for s in shortcuts)
コード例 #2
0
def check_addon(name):
    """
    Extracts the addon from zip and installs it into the AddOn folder of eso
    """
    try:
        # noinspection PyUnresolvedReferences
        from win32com.shell import shell, shellcon
        documents = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
        addon_dir = os.path.join(documents, "Elder Scrolls Online", "live",
                                 "Addons")
        if not os.path.exists(os.path.join(addon_dir, name)):
            logging.info(f"{name} Addon not found, installing it...")
            with ZipFile(manifest_file(f"{name}.zip"), 'r') as z:
                z.extractall(path=addon_dir)
            logging.info(
                "Please make sure you enable \"Allow outdated addons\" in-game"
            )
    except Exception:
        logging.error("couldn't install addon, try doing it manually")
コード例 #3
0
ファイル: open.py プロジェクト: kstanoev/enso-portable
import operator
import re
import time
import win32api
import win32con
import win32process
import pythoncom
import logging

import xml.etree.ElementTree as etree
import ctypes as ct
import subprocess

unlearn_open_undo = []

my_documents_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, 0, 0)
LEARN_AS_DIR = os.path.join(os.path.expanduser("~"), ".enso", "commands", "learned")

SHLoadIndirectString = ct.windll.shlwapi.SHLoadIndirectString
SHLoadIndirectString.argtypes = [ct.c_wchar_p, ct.c_wchar_p, ct.c_uint, ct.POINTER(ct.c_void_p)]
SHLoadIndirectString.restype = ct.HRESULT

# Check if Learn-as dir exist and create it if not
if (not os.path.isdir(LEARN_AS_DIR)):
    os.makedirs(LEARN_AS_DIR)

SHORTCUT_TYPE_EXECUTABLE = 'x'
SHORTCUT_TYPE_FOLDER = 'f'
SHORTCUT_TYPE_URL = 'u'
SHORTCUT_TYPE_DOCUMENT = 'd'
SHORTCUT_TYPE_CONTROL_PANEL = 'c'
コード例 #4
0
                      headers={
                          **headers, 'Content-Type': 'application/octet-stream'
                      })
    requests.post(
        f'{github_api}/repos/{USERNAME}/music-caster/releases/{release_id}',
        headers=headers,
        json={
            'body': body,
            'draft': False
        })
    if not VERSION.endswith('.0'):
        # delete old release if not a new major build
        requests.delete(
            f'{github_api}/repos/{USERNAME}/music-caster/releases/{old_release_id}',
            headers=headers)
    print(f'Published Release v{VERSION}')
    print(f'v{VERSION} Total Time Taken:', round(time.time() - start_time, 2),
          'seconds')
if tests_passed and not args.dry and not args.debug:
    print('Installing Music Caster [Will Launch After]')
    startup_dir = shell.SHGetFolderPath(0, (shellcon.CSIDL_STARTUP,
                                            shellcon.CSIDL_COMMON_STARTUP)[0],
                                        None, 0)
    shortcut_path = startup_dir + '\\Music Caster.lnk'
    shell = win32com.client.Dispatch('WScript.Shell')
    shortcut = shell.CreateShortCut(shortcut_path)
    exe = shortcut.Targetpath
    install_cmd = '"dist\\Music Caster Setup.exe" /FORCECLOSEAPPLICATIONS /VERYSILENT /MERGETASKS="!desktopicon"'
    cmd = f'{install_cmd} && "{exe}"'
    Popen(cmd, shell=True)
コード例 #5
0
def get_documents():
    return shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
コード例 #6
0
def get_addondir():
    # noinspection PyUnresolvedReferences
    from win32com.shell import shell, shellcon
    documents = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
    return os.path.join(documents, "Elder Scrolls Online", "live", "Addons")