def __init__(self, parent=None): super(LogsWindow, self).__init__(parent) self.setStyleSheet(style.load_stylesheet()) self.resize(1200, 800) logs_widget = LogsWidget(parent=self) log_detail = OutputWidget(parent=self) main_layout = QtWidgets.QHBoxLayout() log_splitter = QtWidgets.QSplitter() log_splitter.setOrientation(QtCore.Qt.Horizontal) log_splitter.addWidget(logs_widget) log_splitter.addWidget(log_detail) log_splitter.setStretchFactor(0, 65) log_splitter.setStretchFactor(1, 35) main_layout.addWidget(log_splitter) self.logs_widget = logs_widget self.log_detail = log_detail self.setLayout(main_layout) self.setWindowTitle("Logs") self.logs_widget.active_changed.connect(self.on_selection_changed)
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 __init__(self, parent): if os.getenv("PYPE_DEV"): icon_file_name = "icon_dev.png" else: icon_file_name = "icon.png" self.icon = QtGui.QIcon(get_resource(icon_file_name)) QtWidgets.QSystemTrayIcon.__init__(self, self.icon, parent) # Store parent - QtWidgets.QMainWindow() self.parent = parent # Setup menu in Tray self.menu = QtWidgets.QMenu() self.menu.setStyleSheet(style.load_stylesheet()) # Set modules self.tray_man = TrayManager(self, self.parent) self.tray_man.process_presets() # Catch activate event self.activated.connect(self.on_systray_activated) # Add menu to Context of SystemTrayIcon self.setContextMenu(self.menu)
def __init__(self, parent): super(WidgetUserIdle, self).__init__() self.bool_is_showed = False self.bool_not_stopped = True self.parent_widget = parent self.setWindowIcon(parent.tray_widget.icon) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint) self._translate = QtCore.QCoreApplication.translate self.font = QtGui.QFont() self.font.setFamily("DejaVu Sans Condensed") self.font.setPointSize(9) self.font.setBold(True) self.font.setWeight(50) self.font.setKerning(True) self.resize(self.SIZE_W, self.SIZE_H) self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H)) self.setMaximumSize(QtCore.QSize(self.SIZE_W + 100, self.SIZE_H + 100)) self.setStyleSheet(style.load_stylesheet()) self.setLayout(self._main()) self.refresh_context() self.setWindowTitle('Pype - Stop timers')
def main(): os.environ["AVALON_APP"] = HOST_NAME # Allow to change icon of running process in windows taskbar if os.name == "nt": ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( u"standalonepublish") qt_app = QtWidgets.QApplication([]) # app.setQuitOnLastWindowClosed(False) qt_app.setStyleSheet(style.load_stylesheet()) icon = QtGui.QIcon(resources.pype_icon_filepath()) qt_app.setWindowIcon(icon) def signal_handler(sig, frame): print("You pressed Ctrl+C. Process ended.") qt_app.quit() signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) modules_manager = ModulesManager() module = modules_manager.modules_by_name["standalonepublish_tool"] window = Window(module.publish_paths) window.show() sys.exit(qt_app.exec_())
def __init__(self, module, parent=None): super(MusterLogin, self).__init__(parent) self.module = module # Icon icon = QtGui.QIcon(resources.pype_icon_filepath()) self.setWindowIcon(icon) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint) self._translate = QtCore.QCoreApplication.translate # Font self.font = QtGui.QFont() self.font.setFamily("DejaVu Sans Condensed") self.font.setPointSize(9) self.font.setBold(True) self.font.setWeight(50) self.font.setKerning(True) # Size setting self.resize(self.SIZE_W, self.SIZE_H) self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H)) self.setMaximumSize(QtCore.QSize(self.SIZE_W + 100, self.SIZE_H + 100)) self.setStyleSheet(style.load_stylesheet()) self.setLayout(self._main()) self.setWindowTitle('Muster login')
def __init__(self, parent=None, is_event=False): super(Login_Dialog_ui, self).__init__() self.parent = parent self.is_event = is_event if hasattr(parent, 'icon'): self.setWindowIcon(self.parent.icon) elif hasattr(parent, 'parent') and hasattr(parent.parent, 'icon'): self.setWindowIcon(self.parent.parent.icon) else: icon = QtGui.QIcon(resources.pype_icon_filepath()) self.setWindowIcon(icon) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint) self.loginSignal.connect(self.loginWithCredentials) self._translate = QtCore.QCoreApplication.translate self.font = QtGui.QFont() self.font.setFamily("DejaVu Sans Condensed") self.font.setPointSize(9) self.font.setBold(True) self.font.setWeight(50) self.font.setKerning(True) self.resize(self.SIZE_W, self.SIZE_H) self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H)) self.setMaximumSize(QtCore.QSize(self.SIZE_W + 100, self.SIZE_H + 100)) self.setStyleSheet(style.load_stylesheet()) self.setLayout(self._main()) self.setWindowTitle('Pype - Ftrack Login')
def __init__(self, parent=None, messages=[], title="Message"): super(MessageWidget, self).__init__() self._parent = parent # Icon if parent and hasattr(parent, 'icon'): self.setWindowIcon(parent.icon) else: from pypeapp.resources import get_resource self.setWindowIcon(QtGui.QIcon(get_resource('icon.png'))) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint) # Font self.font = QtGui.QFont() self.font.setFamily("DejaVu Sans Condensed") self.font.setPointSize(9) self.font.setBold(True) self.font.setWeight(50) self.font.setKerning(True) # Size setting self.resize(self.SIZE_W, self.SIZE_H) self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H)) self.setMaximumSize(QtCore.QSize(self.SIZE_W + 100, self.SIZE_H + 100)) # Style self.setStyleSheet(style.load_stylesheet()) self.setLayout(self._ui_layout(messages)) self.setWindowTitle(title)
def message(self, text): msgBox = QtWidgets.QMessageBox() msgBox.setText(text) msgBox.setStyleSheet(style.load_stylesheet()) msgBox.setWindowFlags(msgBox.windowFlags() | QtCore.Qt.FramelessWindowHint) msgBox.exec_()
def __init__(self, messages, title): super(MessageWidget, self).__init__() # Icon icon = QtGui.QIcon(resources.pype_icon_filepath()) self.setWindowIcon(icon) self.setWindowFlags( QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint ) # Font self.font = QtGui.QFont() self.font.setFamily("DejaVu Sans Condensed") self.font.setPointSize(9) self.font.setBold(True) self.font.setWeight(50) self.font.setKerning(True) # Size setting self.resize(self.SIZE_W, self.SIZE_H) self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H)) self.setMaximumSize(QtCore.QSize(self.SIZE_W+100, self.SIZE_H+100)) # Style self.setStyleSheet(style.load_stylesheet()) self.setLayout(self._ui_layout(messages)) self.setWindowTitle(title)
def __init__(self, clockapi, optional=True): super(ClockifySettings, self).__init__() self.clockapi = clockapi self.optional = optional self.validated = False # Icon icon = QtGui.QIcon(resources.pype_icon_filepath()) self.setWindowIcon(icon) self.setWindowFlags( QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint ) self._translate = QtCore.QCoreApplication.translate # Font self.font = QtGui.QFont() self.font.setFamily("DejaVu Sans Condensed") self.font.setPointSize(9) self.font.setBold(True) self.font.setWeight(50) self.font.setKerning(True) # Size setting self.resize(self.SIZE_W, self.SIZE_H) self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H)) self.setMaximumSize(QtCore.QSize(self.SIZE_W+100, self.SIZE_H+100)) self.setStyleSheet(style.load_stylesheet()) self.setLayout(self._main()) self.setWindowTitle('Clockify settings')
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(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 on_rendernode_clicked(self): from avalon import style print("Clicked Set Render Mode") if self.render_mode_widget is None: window = set_rendermode.SetRenderMode() window.setStyleSheet(style.load_stylesheet()) window.show() self.render_mode_widget = window else: self.render_mode_widget.show()
def _show_message_box(self, title, message, details=None): dialog = QtWidgets.QMessageBox() icon = QtGui.QIcon(resources.pype_icon_filepath()) dialog.setWindowIcon(icon) dialog.setStyleSheet(style.load_stylesheet()) dialog.setWindowTitle(title) dialog.setText(message) if details: dialog.setDetailedText(details) dialog.exec_()
def main(launch_args): # Be sure server won't crash at any moment but just print traceback sys.excepthook = safe_excepthook # Create QtApplication for tools # - QApplicaiton is also main thread/event loop of the server qt_app = QtWidgets.QApplication([]) # Execute pipeline installation api.install(tvpaint) # Create Communicator object and trigger launch # - this must be done before anything is processed communicator = CommunicationWrapper.create_communicator(qt_app) communicator.launch(launch_args) def process_in_main_thread(): """Execution of `MainThreadItem`.""" item = communicator.main_thread_listen() if item: item.execute() timer = QtCore.QTimer() timer.setInterval(100) timer.timeout.connect(process_in_main_thread) timer.start() # Register terminal signal handler def signal_handler(*_args): print("You pressed Ctrl+C. Process ended.") communicator.stop() signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) qt_app.setQuitOnLastWindowClosed(False) qt_app.setStyleSheet(style.load_stylesheet()) # Load avalon icon icon_path = get_icon_path() if icon_path: icon = QtGui.QIcon(icon_path) qt_app.setWindowIcon(icon) # Set application name to be able show application icon in task bar if platform.system().lower() == "windows": ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( u"WebsocketServer") # Run Qt application event processing sys.exit(qt_app.exec_())
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 __init__(self, parent=None): super(Window, self).__init__(parent=parent) self._db.install() self.setWindowTitle("Standalone Publish") self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setStyleSheet(style.load_stylesheet()) # Validators self.valid_parent = False # assets widget widget_assets = AssetWidget(dbcon=self._db, parent=self) # family widget widget_family = FamilyWidget(dbcon=self._db, parent=self) # components widget widget_components = ComponentsWidget(parent=self) # Body body = QtWidgets.QSplitter() body.setContentsMargins(0, 0, 0, 0) body.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) body.setOrientation(QtCore.Qt.Horizontal) body.addWidget(widget_assets) body.addWidget(widget_family) body.addWidget(widget_components) body.setStretchFactor(body.indexOf(widget_assets), 2) body.setStretchFactor(body.indexOf(widget_family), 3) body.setStretchFactor(body.indexOf(widget_components), 5) layout = QtWidgets.QVBoxLayout(self) layout.addWidget(body) self.resize(self.WIDTH, self.HEIGHT) # signals widget_assets.selection_changed.connect(self.on_asset_changed) widget_family.stateChanged.connect(self.set_valid_family) self.widget_assets = widget_assets self.widget_family = widget_family self.widget_components = widget_components # on start self.on_start()
def tray_init(self): # Add library tool try: from avalon.tools.libraryloader import app from avalon import style from Qt import QtGui self.libraryloader = app.Window(icon=QtGui.QIcon( resources.pype_icon_filepath()), show_projects=True, show_libraries=True) self.libraryloader.setStyleSheet(style.load_stylesheet()) except Exception: self.log.warning("Couldn't load Library loader tool for tray.", exc_info=True)
def tray_menu(self, parent): """ Add **change credentials** option to tray menu. """ # Menu for Tray App self.menu = QtWidgets.QMenu('Muster', parent) self.menu.setProperty('submenu', 'on') self.menu.setStyleSheet(style.load_stylesheet()) # Actions self.aShowLogin = QtWidgets.QAction("Change login", self.menu) self.menu.addAction(self.aShowLogin) self.aShowLogin.triggered.connect(self.show_login) parent.addMenu(self.menu)
def show(parent=None): from avalon import style from ...tools import lib try: module.window.close() del module.window except (RuntimeError, AttributeError): pass with lib.application(): window = App(parent) window.setStyleSheet(style.load_stylesheet()) window.show() module.window = window
def __init__(self, module): super(UserWidget, self).__init__() self.module = module # Style icon = QtGui.QIcon(resources.pype_icon_filepath()) self.setWindowIcon(icon) self.setWindowTitle("Username Settings") self.setMinimumWidth(self.MIN_WIDTH) self.setStyleSheet(style.load_stylesheet()) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint) self.setLayout(self._main())
def show_error_messagebox(title, message, detail_message=None): """Function will show message and process ends after closing it.""" from Qt import QtWidgets, QtCore from avalon import style app = QtWidgets.QApplication([]) app.setStyleSheet(style.load_stylesheet()) msgbox = QtWidgets.QMessageBox() msgbox.setWindowTitle(title) msgbox.setText(message) if detail_message: msgbox.setDetailedText(detail_message) msgbox.setWindowModality(QtCore.Qt.ApplicationModal) msgbox.show() sys.exit(app.exec_())
def __init__(self, parent=None): super(PypeInfoWidget, self).__init__(parent) self.setStyleSheet(style.load_stylesheet()) icon = QtGui.QIcon(resources.pype_icon_filepath()) self.setWindowIcon(icon) self.setWindowTitle("OpenPype info") main_layout = QtWidgets.QVBoxLayout(self) main_layout.setAlignment(QtCore.Qt.AlignTop) main_layout.addWidget(self._create_openpype_info_widget(), 0) main_layout.addWidget(self._create_separator(), 0) main_layout.addWidget(self._create_workstation_widget(), 0) main_layout.addWidget(self._create_separator(), 0) main_layout.addWidget(self._create_local_settings_widget(), 0) main_layout.addWidget(self._create_separator(), 0) main_layout.addWidget(self._create_environ_widget(), 1) main_layout.addWidget(self._create_btns_section(), 0)
def get_color_picker(self, color): """Launch color picker and return chosen color Args: color(QtGui.QColor): Start color to display Returns: QtGui.QColor """ color_dialog = QtWidgets.QColorDialog(color) color_dialog.setStyleSheet(style.load_stylesheet()) accepted = color_dialog.exec_() if not accepted: return return color_dialog.selectedColor()
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 tray_menu(self, parent_menu): # Menu for Tray App self.menu = QtWidgets.QMenu('Clockify', parent_menu) self.menu.setProperty('submenu', 'on') self.menu.setStyleSheet(style.load_stylesheet()) # Actions self.aShowSettings = QtWidgets.QAction("Settings", self.menu) self.aStopTimer = QtWidgets.QAction("Stop timer", self.menu) self.menu.addAction(self.aShowSettings) self.menu.addAction(self.aStopTimer) self.aShowSettings.triggered.connect(self.show_settings) self.aStopTimer.triggered.connect(self.stop_timer) self.set_menu_visibility() parent_menu.addMenu(self.menu)
def __init__(self, main_parent=None, parent=None, optional=True): super(ClockifySettings, self).__init__() self.parent = parent self.main_parent = main_parent self.clockapi = parent.clockapi self.optional = optional self.validated = False # Icon if hasattr(parent, 'icon'): self.setWindowIcon(self.parent.icon) elif hasattr(parent, 'parent') and hasattr(parent.parent, 'icon'): self.setWindowIcon(self.parent.parent.icon) else: pype_setup = os.getenv('PYPE_SETUP_PATH') items = [pype_setup, "app", "resources", "icon.png"] fname = os.path.sep.join(items) icon = QtGui.QIcon(fname) self.setWindowIcon(icon) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint) self._translate = QtCore.QCoreApplication.translate # Font self.font = QtGui.QFont() self.font.setFamily("DejaVu Sans Condensed") self.font.setPointSize(9) self.font.setBold(True) self.font.setWeight(50) self.font.setKerning(True) # Size setting self.resize(self.SIZE_W, self.SIZE_H) self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H)) self.setMaximumSize(QtCore.QSize(self.SIZE_W + 100, self.SIZE_H + 100)) self.setStyleSheet(style.load_stylesheet()) self.setLayout(self._main()) self.setWindowTitle('Clockify settings')
def __init__(self, parent): self.icon = QtGui.QIcon(resources.pype_icon_filepath()) QtWidgets.QSystemTrayIcon.__init__(self, self.icon, parent) # Store parent - QtWidgets.QMainWindow() self.parent = parent # Setup menu in Tray self.menu = QtWidgets.QMenu() self.menu.setStyleSheet(style.load_stylesheet()) # Set modules self.tray_man = TrayManager(self, self.parent) self.tray_man.process_presets() # Catch activate event self.activated.connect(self.on_systray_activated) # Add menu to Context of SystemTrayIcon self.setContextMenu(self.menu)