def show(callback=None, with_keys=None, parent=None): """Display Main GUI""" # Remember window if module.window is not None: try: module.window.show() # If the window is minimized then unminimize it. if module.window.windowState() & QtCore.Qt.WindowMinimized: module.window.setWindowState(QtCore.Qt.WindowActive) # Raise and activate the window module.window.raise_() # for MacOS module.window.activateWindow() # for Windows return except RuntimeError as e: if not str(e).rstrip().endswith("already deleted."): raise # Garbage collected module.window = None with tools_lib.application(): window = Window(callback=callback, with_keys=with_keys, parent=parent) window.show() window.setStyleSheet(style.load_stylesheet()) module.window = window
def show(parent=None): """Display Loader GUI Arguments: debug (bool, optional): Run loader in debug-mode, defaults to False """ try: module.window.close() del module.window except (RuntimeError, AttributeError): pass with tools_lib.application(): if parent is None: app = QtWidgets.QApplication.instance() parent = next(i for i in app.topLevelWidgets() if i.objectName() == "MayaWindow") print(">>", parent) window = App(parent) window.show() module.window = window
def show(): """Display Loader GUI Arguments: debug (bool, optional): Run loader in debug-mode, defaults to False """ try: module.window.close() del module.window except (RuntimeError, AttributeError): pass # Get Maya main window top_level_widgets = QtWidgets.QApplication.topLevelWidgets() mainwindow = next(widget for widget in top_level_widgets if widget.objectName() == "MayaWindow") with lib.application(): window = App(parent=mainwindow) window.setStyleSheet(style.load_stylesheet()) window.show() module.window = window
def show(session=None): io.install() with toolslib.application(): window = Window(session) window.setStyleSheet(style.load_stylesheet()) window.show()
def show_on_stray(root, sequences, framerange, parent=None): """Used for renderlayer loader to pick up nu-documented sequences DEPRECATED """ start, end = framerange min_length = 1 if start == end else 2 # Resolve path _resolved = dict() for aov_name, data in sequences.items(): if "fname" in data: tail = "%s/%s" % (aov_name, data["fname"]) else: tail = data["fpattern"] padding = tail.count("#") if padding: frame_str = "%%0%dd" % padding tail = tail.replace("#" * padding, frame_str) data["fpattern"] = tail.replace("\\", "/") path = os.path.join(root, tail).replace("\\", "/") data["_resolved"] = path data["name"] = aov_name _resolved[path] = data # Find stray sequence stray = list() for item in command.ls_sequences(root, min_length): part = (item["root"], "/", item["fpattern"]) if "".join(part) not in _resolved: stray.append(item) if stray: resolved = list() for path, data in _resolved.items(): fpattern = os.path.relpath(path, root).replace("\\", "/") files = [fpattern % i for i in range(int(start), int(end) + 1)] item = command.assemble(root, files, min_length) item.update(data) resolved.append(item) with tools_lib.application(): window = Window(root=root, parent=parent) # window.setModal(True) window.setStyleSheet(style.load_stylesheet()) window.add_sequences(stray + resolved) if window.exec_(): sequences = window.collected(with_keys=["name", "resolution"]) # (TODO) Remember resolved ? return sequences
def show(parent=None, debug=False): try: module.window.close() del module.window except (RuntimeError, AttributeError): pass with parentlib.application(): window = Window(parent) window.show() module.window = window
def show(): """Display Main GUI""" try: module.window.close() del module.window except (RuntimeError, AttributeError): pass with tools_lib.application(): window = Window(parent=None) window.setStyleSheet(style.load_stylesheet()) window.show() module.window = window
def show(): """Display Main GUI""" try: module.window.close() del module.window except (RuntimeError, AttributeError): pass # Get Maya main window top_level_widgets = QtWidgets.QApplication.topLevelWidgets() mainwindow = next(widget for widget in top_level_widgets if widget.objectName() == "MayaWindow") with lib.application(): window = Window(parent=mainwindow) window.setStyleSheet(style.load_stylesheet()) window.show() module.window = window
def show(root=None, debug=False, parent=None): """Display Loader GUI Arguments: debug (bool, optional): Run loader in debug-mode, defaults to False """ try: module.window.close() del module.window except (RuntimeError, AttributeError): pass with tools_lib.application(): window = App(parent) window.show() module.window = window
def show(root=None, debug=False, parent=None, use_context=True, save=True): """Show Work Files GUI""" # todo: remove `root` argument to show() try: module.window.close() del (module.window) except (AttributeError, RuntimeError): pass host = api.registered_host() validate_host_requirements(host) if debug: api.Session["AVALON_ASSET"] = "Mock" api.Session["AVALON_TASK"] = "Testing" with tools_lib.application(): window = Window(parent=parent) window.refresh() if use_context: context = { "asset": api.Session["AVALON_ASSET"], "silo": api.Session["AVALON_SILO"], "task": api.Session["AVALON_TASK"] } window.set_context(context) window.files_widget.btn_save.setEnabled(save) window.show() window.setStyleSheet(style.load_stylesheet()) module.window = window # Pull window to the front. module.window.raise_() module.window.activateWindow()
def show(): """Display Main GUI""" try: module.window.close() del module.window except (RuntimeError, AttributeError): pass # Get Maya main window top_level_widgets = QtWidgets.QApplication.topLevelWidgets() mainwindow = next(widget for widget in top_level_widgets if widget.objectName() == "MayaWindow") # Register method for selecting models from scene app.register_host_profiler(profile_from_host) app.register_host_selector(select_from_host) with lib.application(): window = app.Window(parent=mainwindow) window.setStyleSheet(style.load_stylesheet()) window.show() module.window = window
def show(parent=None, debug=False, context=None): """Display Loader GUI Arguments: debug (bool, optional): Run loader in debug-mode, defaults to False """ try: module.window.close() del module.window except (RuntimeError, AttributeError): pass if debug is True: io.install() with parentlib.application(): window = Window(parent, context) window.setStyleSheet(style.load_stylesheet()) window.show() module.window = window
def publish(sequences): """Run sequence publish Step: 1. Press "Accept" after sequences scavenged 2. Pop-up Avalon Creator, fill in Asset and Subset 3. Press "Create" 4. Run Pyblish if no error raised on create (close creator) 5. Check publish result after Pyblish server stopped 6. Close all window if completed or raise seqparser window Args: sequences: Returns: """ avalon.api.install(filesys) pyblish.api.register_target("localhost") pyblish.api.register_target("seqparser") filesys.new() with tools_lib.application(): seqparser_app = app.window created = {"_": False} window = creator.Window(parent=seqparser_app) # (NOTE) override `window.on_create`, this is a hack ! def on_create_hack(): filesys.put_data("renderCreatorData", { "sequences": sequences, "isStereo": seqparser_app.is_stereo, "stagingDir": seqparser_app.get_root_path(), }) try: window.on_create() except Exception: pass else: created["_"] = True window.close() window.data["Create Button"].clicked.disconnect() window.data["Subset"].returnPressed.disconnect() window.data["Create Button"].clicked.connect(on_create_hack) window.data["Subset"].returnPressed.connect(on_create_hack) window.setStyleSheet(style.load_stylesheet()) window.refresh() window.exec() if not created["_"]: raise Exception("Nothing created.") seqparser_app.hide() server = pyblish_qml.api.show() server.wait() context = server.service._context if not context.data.get("publishSucceed"): seqparser_app.show() again = plugins.message_box_warning("Nothing published", "Nothing published, try again ?", optional=True, parent=seqparser_app) if again: raise Exception("Nothing published.") seqparser_app.close()