def run(self, dist): platform = get_platform() cwd = Path.cwd() if platform == 'Windows': bl_exe = "Blender Launcher.exe" blu_exe = "Blender Launcher Updater.exe" elif platform == 'Linux': bl_exe = "Blender Launcher" blu_exe = "Blender Launcher Updater" source = cwd / bl_exe dist = cwd / blu_exe with open(source.as_posix(), 'rb') as f1, open(dist.as_posix(), 'wb') as f2: copyfileobj(f1, f2) if platform == 'Windows': _popen([dist.as_posix(), "-update"]) elif platform == 'Linux': os.chmod(dist.as_posix(), 0o744) _popen('nohup "' + dist.as_posix() + '" -update') self.parent.destroy()
def launch(self): self.item.setSelected(True) if hasattr(self, "NewItemLabel"): self.NewItemLabel.hide() platform = get_platform() library_folder = Path(get_library_folder()) blender_args = get_blender_startup_arguments() if platform == 'Windows': b3d_exe = library_folder / self.link / "blender.exe" if blender_args == "": proc = _popen(b3d_exe.as_posix()) else: args = [b3d_exe.as_posix()] args.extend(blender_args.split(' ')) proc = _popen(args) elif platform == 'Linux': bash_args = get_bash_arguments() if bash_args != '': bash_args = bash_args + " nohup" else: bash_args = "nohup" b3d_exe = library_folder / self.link / "blender" proc = _popen('{0} "{1}" {2}'.format( bash_args, b3d_exe.as_posix(), blender_args)) if self.observer is None: self.observer = Observer(self) self.observer.count_changed.connect(self.proc_count_changed) self.observer.started.connect(self.observer_started) self.observer.finished.connect(self.observer_finished) self.observer.start() self.observer.append_proc(proc)
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_()
def launch(self): self.item.setSelected(True) if hasattr(self, "NewItemLabel"): self.NewItemLabel.hide() platform = get_platform() library_folder = Path(get_library_folder()) if platform == 'Windows': b3d_exe = library_folder / self.link / "blender.exe" proc = _popen(b3d_exe.as_posix()) elif platform == 'Linux': b3d_exe = library_folder / self.link / "blender" proc = _popen('nohup "' + b3d_exe.as_posix() + '"') if self.observer is None: self.observer = Observer(self) self.observer.count_changed.connect(self.proc_count_changed) self.observer.started.connect(self.observer_started) self.observer.finished.connect(self.observer_finished) self.observer.start() self.observer.append_proc(proc)