Exemplo n.º 1
0
def _record_ipython(file, func, startup=None):
    call_echo(
        ["powershell", "-command", "Set-WinUserLanguageList -Force 'en-US'"])

    open_wt_ipython(startup=startup)

    recorder.rect = (0, 0, 1920, 1080)
    recorder.file = file

    recorder.start_record()

    func()

    sleep(2)
    recorder.stop_record()

    send_hotkey("alt", "f4")
    sleep(1)

    call_echo([
        "powershell", "-command",
        "Set-WinUserLanguageList -Force 'zh-CN', 'en-US'"
    ])

    return file
Exemplo n.º 2
0
def install_package(name):
    # choco list -lo
    lines = proc_lines(["choco", "list", "-lo"])
    lines = [x for x in lines if x.startswith(name)]

    if len(lines) > 0:
        print("Upgrade `%s`..." % name)
        call_echo(["choco", "upgrade", name, "-y"])
    else:
        print("Install `%s`..." % name)
        call_echo(["choco", "install", name, "-y"])
Exemplo n.º 3
0
def show_git_log():
    call_echo(
        [
            "git",
            "log",
            "--date=relative",
            "--pretty=format:%C(yellow)%h %Cblue%ad %Cgreen%aN%Cred%d %Creset%s",
            "--graph",
            "-10",
        ],
        check=False,
    )
Exemplo n.º 4
0
def commit(dry_run=False, amend=False):
    if dry_run:
        call_echo("git status --short")

    else:
        if get_output("git diff --shortstat"):
            call_echo("git add -A")

        if amend:
            call_echo("git commit --amend --no-edit --quiet")
        else:
            message = input("commit message: ")
            if not message:
                message = "Temporary commit @ %s" % get_time_str()

            call_echo(["git", "commit", "-m", message])
Exemplo n.º 5
0

def install_glslang():
    assert sys.platform == "win32"
    path = os.path.abspath("/tools/glslang")
    if not os.path.exists(path):
        cd(gettempdir())
        f = download(
            "https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip"
        )
        unzip(f, to=path)
    return os.path.abspath("/tools/glslang/bin/glslangValidator.exe")


if __name__ == "__main__":
    call_echo([sys.executable, "-m", "pip", "install", "pylint"])
    call_echo([sys.executable, "-m", "pip", "install", "autopep8"])

    print2("Update key bindings...")
    with open(os.path.expandvars(DATA_DIR + "/User/keybindings.json"),
              "w") as f:
        json.dump(
            [
                {
                    "key": "ctrl+shift+v",
                    "command": "markdown.showPreviewToSide",
                    "when":
                    "!notebookEditorFocused && editorLangId == 'markdown'",
                },
                {
                    "key": "shift+alt+r",
Exemplo n.º 6
0
    else:
        print("Install `%s`..." % name)
        call_echo(["choco", "install", name, "-y"])


if __name__ == "__main__":
    pkg_list = [cate for cate in PKGS if cate.startswith("@")] + sorted(
        set([app for cate in PKGS.values() for app in cate])
    )
    idx = Menu(items=pkg_list).get_selected_index()
    if idx < 0:
        sys.exit(1)

    call_echo(
        [
            "choco",
            "source",
            "add",
            "--name=chocolatey",
            "--priority=-1",
            '-s="https://chocolatey.org/api/v2/"',
        ]
    )

    if pkg_list[idx].startswith("@"):
        for pkg in PKGS[pkg_list[idx]]:
            install_package(pkg)

    else:
        install_package(pkg_list[idx])
Exemplo n.º 7
0
import os

cd("c:/Users/Ross/Google Drive/KidslogicVideo/ep35/animation/icons")


for f in get_files(cd=True):
    mkdir("shadow")
    out_file = os.path.join("shadow", os.path.basename(f))

    call_echo(
        [
            "magick",
            f,
            "(",
            "-clone",
            "0",
            "-background",
            "black",
            "-shadow",
            "80x5+0+0",
            ")",
            "-reverse",
            "-background",
            "none",
            "-layers",
            "merge",
            "+repage",
            out_file,
        ]
    )
Exemplo n.º 8
0
def git_push():
    call_echo("git push -u origin master --force")
Exemplo n.º 9
0
def revert():
    call_echo("git status --short")
    if not yes("Revert all files?"):
        return
    call_echo("git reset HEAD --hard")
Exemplo n.º 10
0
def switch_branch():
    call_echo(["git", "branch"])
    name = input("Switch to branch [master]: ")
    if not name:
        name = "master"
    call_echo(["git", "checkout", name])
Exemplo n.º 11
0
def create_bundle():
    if bundle_file is not None:
        print2("Create bundle: %s" % bundle_file)
        call_echo(["git", "bundle", "create", bundle_file, "master"])
Exemplo n.º 12
0

if __name__ == "__main__":
    repo_dir = r"{{GIT_REPO}}"
    repo_name = os.path.basename(repo_dir)

    if sync_github:
        FNULL = fnull()
        ret = subprocess.call("gh repo view rossning92/%s" % repo_name,
                              shell=True,
                              stdout=FNULL)
        if ret == 1:
            cd(os.path.dirname(repo_dir))
            if not yes('Create "%s" on GitHub?' % repo_name):
                sys.exit(1)
            call_echo("gh repo create %s" % repo_name)

    # Init repo
    cd(repo_dir)
    if not os.path.exists(".git"):
        call_echo("git init")
        call_echo(
            "git remote add origin https://github.com/rossning92/%s.git" %
            repo_name)

    # Add .gitignore
    add_gitignore()

    # .gitattribute
    if not os.path.exists(".gitattributes"):
        with open(".gitattributes", "w") as f: