Exemplo n.º 1
0
def main():
    app = QApplication(sys.argv)
    app.setApplicationVersion("v1.3.1")
    app.setQuitOnLastWindowClosed(False)

    socket = QLocalSocket()
    socket.connectToServer("blender-launcher-server")
    is_running = socket.waitForConnected()

    if not is_running:
        socket.close()
        BlenderLauncher(app)
        app.exec_()
Exemplo n.º 2
0
def main():
    if "-update" in sys.argv:
        platform = get_platform()
        temp = Path(tempfile.gettempdir())
        cwd = Path.cwd()

        if platform == 'Windows':
            bl_exe = "Blender Launcher.exe"
        elif platform == 'Linux':
            bl_exe = "Blender Launcher"

        source = (temp / bl_exe).as_posix()
        dist = (cwd / bl_exe).as_posix()

        with open(source, 'rb') as f1, open(dist, 'wb') as f2:
            copyfileobj(f1, f2)

        if platform == 'Windows':
            _popen([dist])
        elif platform == 'Linux':
            os.chmod(dist, 0o744)
            _popen('nohup "' + dist + '"')

        sys.exit(0)

    app = QApplication(sys.argv)
    app.setStyle('Fusion')
    app.setApplicationVersion(version)
    app.setQuitOnLastWindowClosed(False)

    socket = QLocalSocket()
    socket.connectToServer("blender-launcher-server")
    is_running = socket.waitForConnected()

    if not is_running:
        socket.close()
        BlenderLauncher(app)
        app.exec_()