Пример #1
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        # look manager layout
        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(10)

        # Looks from database
        title = QtWidgets.QLabel("Looks")
        title.setAlignment(QtCore.Qt.AlignCenter)
        title.setStyleSheet("font-weight: bold; font-size: 12px")
        title.setAlignment(QtCore.Qt.AlignCenter)

        model = models.LookModel()

        # Proxy for dynamic sorting
        proxy = QtCore.QSortFilterProxyModel()
        proxy.setSourceModel(model)

        view = views.View()
        view.setModel(proxy)
        view.setMinimumHeight(180)
        view.setToolTip("Use right mouse button menu for direct actions")
        view.customContextMenuRequested.connect(self.right_mouse_menu)
        view.sortByColumn(0, QtCore.Qt.AscendingOrder)

        layout.addWidget(title)
        layout.addWidget(view)

        self.view = view
        self.model = model
Пример #2
0
    def right_mouse_menu(self, pos):
        """Build RMB menu for look view"""

        active = self.view.currentIndex()  # index under mouse
        active = active.sibling(active.row(), 0)  # get first column
        globalpos = self.view.viewport().mapToGlobal(pos)

        if not active.isValid():
            return

        menu = QtWidgets.QMenu(self.view)

        # Direct assignment
        apply_action = QtWidgets.QAction(menu, text="Assign looks..")
        apply_action.triggered.connect(self.menu_apply_action)

        menu.addAction(apply_action)

        # Assign via UUID-UV relation
        apply_via_uv_action = QtWidgets.QAction(menu,
                                                text="Assign looks via UV..")
        apply_via_uv_action.triggered.connect(self.menu_apply_via_uv_action)

        menu.addAction(apply_via_uv_action)

        menu.exec_(globalpos)
Пример #3
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent=parent)

        self.setWindowIcon(qtawesome.icon("fa.users", color="#F0F3F4"))
        self.setWindowTitle("Project Member")
        self.setWindowFlags(QtCore.Qt.Window)

        widget = {
            "refresh": QtWidgets.QPushButton(),
            "projects": QtWidgets.QComboBox(),
            "btnAdd": QtWidgets.QPushButton(),
            "btnDel": QtWidgets.QPushButton(),
        }

        layout = QtWidgets.QHBoxLayout(self)
        layout.addWidget(widget["refresh"])
        layout.addWidget(widget["projects"], stretch=True)
        layout.addWidget(widget["btnAdd"])
        layout.addWidget(widget["btnDel"])

        widget["refresh"].setIcon(qtawesome.icon("fa.refresh",
                                                 color="#E5E7E9"))
        widget["btnAdd"].setIcon(
            qtawesome.icon("fa.user-plus", color="#58D68D"))
        widget["btnDel"].setIcon(
            qtawesome.icon("fa.user-times", color="#A93226"))

        widget["projects"].currentTextChanged.connect(self.on_text_changed)
        widget["refresh"].clicked.connect(self.on_refresh_clicked)
        widget["btnAdd"].clicked.connect(self.on_add_clicked)
        widget["btnDel"].clicked.connect(self.on_del_clicked)

        self.widget = widget
        self.init_projects()
        self.resize(480, 40)
Пример #4
0
    def build_queue_menu(self, pos):

        active = self.queue_view.currentIndex()  # index under mouse
        active = active.sibling(active.row(), 0)  # get first column
        globalpos = self.queue_view.viewport().mapToGlobal(pos)

        menu = QtWidgets.QMenu(self.document_view)

        if active.isValid():
            apply_action = QtWidgets.QAction(menu, text="Apply looks")
            apply_action.triggered.connect(self._apply_from_queue)

            rem_action = QtWidgets.QAction(menu, text="Remove Selected Queue")
            rem_action.triggered.connect(self._remove_selected_queued)

            menu.addAction(apply_action)
            menu.addAction(rem_action)
            menu.addSeparator()

        save_action = QtWidgets.QAction(menu, text="Save Queue")
        save_action.triggered.connect(self._on_save_queue)

        clear_action = QtWidgets.QAction(menu, text="Clear Queue")
        clear_action.triggered.connect(self._clear_queue)

        menu.addAction(save_action)
        menu.addAction(clear_action)

        menu.exec_(globalpos)
Пример #5
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        layout = QtWidgets.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(10)

        title = QtWidgets.QLabel("Rigs:")
        title.setAlignment(QtCore.Qt.AlignLeft)
        title.setStyleSheet("font-weight: bold; font-size: 12px")

        model = models.AssetModel()
        view = views.View()
        view.setModel(model)
        view.setSortingEnabled(False)
        view.setHeaderHidden(True)
        view.setMinimumHeight(180)
        view.setIndentation(10)

        layout.addWidget(title)
        layout.addWidget(view)

        selection_model = view.selectionModel()
        selection_model.selectionChanged.connect(self.selection_changed)

        self.view = view
        self.model = model
        self._selection_model = selection_model

        self.setLayout(layout)
Пример #6
0
    def __init__(self, logger, parent=None):
        super(StatusLineWidget, self).__init__(parent)

        icon = _LogLevelIconButton()

        line = QtWidgets.QLineEdit()
        line.setReadOnly(True)
        line.setStyleSheet("""
            QLineEdit {
                border: 0px;
                border-radius: 6px;
                padding: 0 6px;
                color: #AAAAAA;
                background: #363636;
            }
        """)

        body = QtWidgets.QHBoxLayout(self)
        body.addWidget(icon)
        body.addWidget(line)

        handler = _WidgetLogHandler(self)
        logger.addHandler(handler)

        self.icon = icon
        self.line = line

        self.echo.connect(self.on_echo)
        self.icon.clicked.connect(lambda: self._echo(0, "", True))
Пример #7
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent=parent)

        layout = QtWidgets.QVBoxLayout()

        text = QtWidgets.QLabel("Under development!")
        tab_widget = QtWidgets.QTabWidget()

        button_hlayout = QtWidgets.QHBoxLayout()
        button_hlayout.addStretch()

        # Generic update button
        update_button = QtWidgets.QPushButton("Update")
        update_button.setMinimumWidth(120)
        update_button.setStyleSheet(style.flat_button)

        button_hlayout.addWidget(update_button)

        # Create basic layout
        layout.addWidget(text)
        layout.addWidget(tab_widget)
        layout.addLayout(button_hlayout)

        self.setLayout(layout)

        self.tab_widget = tab_widget
        self.update_button = update_button

        self.connect_signals()
Пример #8
0
    def add_data(self, header, data):
        """Add information which needs to be displayed"""

        if header in self.data_table:
            print("Cannot add similar header, please use `update` in stead")
            return

        data_widget = QtWidgets.QWidget()
        data_widget.setFixedHeight(self._tile_height)

        layout = QtWidgets.QVBoxLayout()

        title = QtWidgets.QLabel(header.upper())
        title.setStyleSheet(style.overview_tile_title)

        formlayout = QtWidgets.QFormLayout()
        for label, value in data.items():
            value_label = QtWidgets.QLabel(value)
            formlayout.addRow("%s :" % label, value_label)

        layout.addWidget(title)
        layout.addLayout(formlayout)
        layout.addStretch()

        data_widget.setLayout(layout)

        self.data_table[header] = {"widget": data_widget, "data": data}

        position = self.layout.count() + 1

        self.layout.insertWidget(position, data_widget)
Пример #9
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        layout = QtWidgets.QHBoxLayout()

        context = QtWidgets.QLabel()
        context.setMinimumWidth(50)
        context.setStyleSheet("QLabel {font-weight: bold}")

        set_context_icon = qta.icon("fa.arrow-right",
                                    color=style.colors.default)
        set_context_button = QtWidgets.QPushButton()
        set_context_button.setIcon(set_context_icon)
        set_context_button.setFixedWidth(28)

        layout.addWidget(context)
        layout.addWidget(set_context_button)

        self.setLayout(layout)

        self.set_context_btn = set_context_button
        self.context_label = context

        self.connections()

        self._set_context_label()
Пример #10
0
    def __init__(self, parent=None):
        super(ComparingTable, self).__init__(parent=parent)

        data = {
            "model": models.ComparerModel(),
            "proxy": QtCore.QSortFilterProxyModel(),
            "view": QtWidgets.QTreeView(),
            "diff": delegates.DiffDelegate(),
            "path": delegates.PathTextDelegate(),
        }

        data["view"].setIndentation(20)
        data["view"].setStyleSheet("""
            QTreeView::item{
                padding: 6px 1px;
                border: 0px;
            }
        """)
        data["view"].setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        data["view"].setAllColumnsShowFocus(True)
        data["view"].setAlternatingRowColors(True)
        data["view"].setSortingEnabled(True)
        data["view"].setSelectionBehavior(
            QtWidgets.QAbstractItemView.SelectItems)
        data["view"].setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)

        header = data["view"].header()
        header.setMinimumSectionSize(delegates.DiffDelegate.ICON_SPACE)

        # Delegate
        diff_delegate = data["diff"]
        column = data["model"].Columns.index("diff")
        data["view"].setItemDelegateForColumn(column, diff_delegate)

        path_delegate = data["path"]
        column = data["model"].Columns.index(SIDE_A)
        data["view"].setItemDelegateForColumn(column, path_delegate)
        column = data["model"].Columns.index(SIDE_B)
        data["view"].setItemDelegateForColumn(column, path_delegate)

        # Set Model
        data["proxy"].setSourceModel(data["model"])
        data["view"].setModel(data["proxy"])

        layout = QtWidgets.QHBoxLayout(self)
        layout.addWidget(data["view"])

        # Connect
        data["view"].customContextMenuRequested.connect(self.on_context_menu)

        # Init

        data["view"].setColumnWidth(0, 90)  # "diff" column
        data["view"].setColumnWidth(1, 310)   # "side A" column

        self.data = data
Пример #11
0
    def setup_ui(self):
        """Build the UI"""

        # Assets (left)
        asset_outliner = widgets.AssetOutliner()

        # Looks (right)
        looks_widget = QtWidgets.QWidget()
        looks_layout = QtWidgets.QVBoxLayout(looks_widget)

        look_outliner = widgets.LookOutliner()  # Database look overview

        assign_selected = QtWidgets.QCheckBox("Assign to selected only")
        assign_selected.setToolTip("Whether to assign only to selected nodes "
                                   "or to the full asset")
        remove_unused_btn = QtWidgets.QPushButton("Remove Unused Looks")

        looks_layout.addWidget(look_outliner)
        looks_layout.addWidget(assign_selected)
        looks_layout.addWidget(remove_unused_btn)

        # Footer
        status = QtWidgets.QStatusBar()
        status.setSizeGripEnabled(False)
        status.setFixedHeight(25)
        warn_layer = QtWidgets.QLabel("Current Layer is not "
                                      "defaultRenderLayer")
        warn_layer.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        warn_layer.setStyleSheet("color: #DD5555; font-weight: bold;")
        warn_layer.setFixedHeight(25)

        footer = QtWidgets.QHBoxLayout()
        footer.setContentsMargins(0, 0, 0, 0)
        footer.addWidget(status)
        footer.addWidget(warn_layer)

        # Build up widgets
        main_layout = QtWidgets.QVBoxLayout(self)
        main_layout.setSpacing(0)
        main_splitter = QtWidgets.QSplitter()
        main_splitter.setStyleSheet("QSplitter{ border: 0px; }")
        main_splitter.addWidget(asset_outliner)
        main_splitter.addWidget(looks_widget)
        main_splitter.setSizes([350, 200])
        main_layout.addWidget(main_splitter)
        main_layout.addLayout(footer)

        # Set column width
        asset_outliner.view.setColumnWidth(0, 200)
        look_outliner.view.setColumnWidth(0, 150)

        # Open widgets
        self.asset_outliner = asset_outliner
        self.look_outliner = look_outliner
        self.status = status
        self.warn_layer = warn_layer

        # Buttons
        self.remove_unused = remove_unused_btn
        self.assign_selected = assign_selected
Пример #12
0
    def __init__(self, parent=None):
        super(SequenceWidget, self).__init__(parent=parent)

        data = {
            "model": SequenceModel(),
            "proxy": QtCore.QSortFilterProxyModel(),
            "view": QtWidgets.QTreeView(),
            "fpatternDel": None,
            "nameDel": None,
        }

        data["proxy"].setSourceModel(data["model"])
        data["view"].setModel(data["proxy"])
        data["fpatternDel"] = delegates.LineHTMLDelegate(data["view"])
        data["nameDel"] = delegates.NameEditDelegate()

        fpattern_delegate = data["fpatternDel"]
        column = data["model"].Columns.index("fpattern")
        data["view"].setItemDelegateForColumn(column, fpattern_delegate)

        name_delegate = data["nameDel"]
        column = data["model"].Columns.index("name")
        data["view"].setItemDelegateForColumn(column, name_delegate)

        data["proxy"].setSortCaseSensitivity(QtCore.Qt.CaseInsensitive)
        data["view"].setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        data["view"].setSelectionMode(ExtendedSelection)
        data["view"].setSortingEnabled(True)
        data["view"].sortByColumn(0, QtCore.Qt.AscendingOrder)
        data["view"].setAlternatingRowColors(True)
        data["view"].setAllColumnsShowFocus(True)
        data["view"].setIndentation(6)
        data["view"].setStyleSheet("""
            QTreeView::item{
                padding: 8px 1px;
                border: 0px;
            }
        """)

        data["view"].setColumnWidth(0, 360)  # fpattern
        data["view"].setColumnWidth(1, 100)  # name
        data["view"].setColumnWidth(2, 80)  # frames

        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(data["view"])
        layout.setContentsMargins(0, 0, 0, 0)

        data["view"].customContextMenuRequested.connect(self.on_context_menu)

        self.data = data
Пример #13
0
    def _build_menu(self, instances):

        _parent = self.collection_view
        menu = QtWidgets.QMenu(_parent)

        set_range_icon = qta.icon("fa.scissors", color=style.colors.default)
        set_range_action = QtWidgets.QAction(set_range_icon,
                                             "Update frame range", menu)
        set_range_action.triggered.connect(
            lambda: self._show_update_frame_range(instances))

        menu.addAction(set_range_action)

        return menu
Пример #14
0
Файл: app.py Проект: kalisp/pype
    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()
Пример #15
0
    def __init__(self, parent=None):
        super(AssetWidget, self).__init__(parent=parent)
        self.setContentsMargins(0, 0, 0, 0)

        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(4)

        # Tree View
        model = AssetModel(self)
        proxy = RecursiveSortFilterProxyModel()
        proxy.setSourceModel(model)
        proxy.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive)

        view = DeselectableTreeView()
        view.setIndentation(15)
        view.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        view.setHeaderHidden(True)
        view.setModel(proxy)

        # Header
        header = QtWidgets.QHBoxLayout()

        icon = qtawesome.icon("fa.refresh", color=style.colors.light)
        refresh = QtWidgets.QPushButton(icon, "")
        refresh.setToolTip("Refresh items")

        filter = QtWidgets.QLineEdit()
        filter.textChanged.connect(proxy.setFilterFixedString)
        filter.setPlaceholderText("Filter assets..")

        header.addWidget(filter)
        header.addWidget(refresh)

        # Layout
        layout.addLayout(header)
        layout.addWidget(view)

        # Signals/Slots
        selection = view.selectionModel()
        selection.selectionChanged.connect(self.selection_changed)
        selection.currentChanged.connect(self.current_changed)
        refresh.clicked.connect(self.refresh)

        self.refreshButton = refresh
        self.model = model
        self.proxy = proxy
        self.view = view
Пример #16
0
    def __init__(self, parent=None):
        super(HostSelectorWidget, self).__init__(parent=parent)

        panel = {
            "selection": QtWidgets.QWidget(),
            "container": QtWidgets.QWidget(),
        }

        model = {
            "containerModel": models.HostContainerListModel(),
        }

        widget = {
            "selectionChk": QtWidgets.QCheckBox("Use Selection"),
            "selectionBtn": QtWidgets.QPushButton("Compare Selection"),
            "containerChk": QtWidgets.QCheckBox("Use Container"),
            "containerBox": QtWidgets.QComboBox(),
        }

        widget["containerBox"].setModel(model["containerModel"])

        layout = QtWidgets.QVBoxLayout(panel["selection"])
        layout.addWidget(widget["selectionChk"])
        layout.addWidget(widget["selectionBtn"])

        layout = QtWidgets.QVBoxLayout(panel["container"])
        layout.addWidget(widget["containerChk"])
        layout.addWidget(widget["containerBox"])

        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(panel["selection"])
        layout.addWidget(panel["container"])

        # Connect

        widget["selectionChk"].stateChanged.connect(self.on_use_selection)
        widget["containerChk"].stateChanged.connect(self.on_use_container)
        widget["selectionBtn"].pressed.connect(self.on_selection_pressed)
        widget["containerBox"].currentIndexChanged.connect(
            self.on_container_picked)

        # Init

        self.widget = widget
        self.model = model

        widget["containerChk"].setCheckState(QtCore.Qt.Checked)

        # Confirm host registered
        if not has_host():
            # Disable all widgets
            for widget in self.widget.values():
                widget.setEnabled(False)
Пример #17
0
    def add_button(self, label, order, widget=None):
        """Add a button to the navigation panel with the given label and order

        Args:
            label(str): Name displayed on the button
            order(int): Number which dictates its order in the panel
            widget(QtWidgets.QWidget): Instance of a widget

        Returns:
            None
        """

        if order < 0:
            layout = self.static_layout
        else:
            layout = self.dynamic_layout

        # Check new position
        widget_at_item = layout.itemAt(abs(order))
        if widget_at_item:
            self.log.warning("Found multiple items for the same order: `%i`" %
                             order)
            return

        button = QtWidgets.QPushButton(label)
        if widget:
            button.clicked.connect(partial(widget.show))

        layout.insertWidget(order, button)

        return button
Пример #18
0
    def _on_load_queue(self):

        _dir = commands.get_workfolder()
        fdialog = QtWidgets.QFileDialog()
        filepath, ext = fdialog.getOpenFileName(self,
                                                "Open File",
                                                _dir,
                                                "*.json")

        with open(filepath, "r") as fp:
            queue_data = json.load(fp)

        if "queue" not in queue_data:
            raise RuntimeError("Invalid queue data")

        valid_items = []
        items = commands.create_queue_in_data(queue_data["queue"])
        for item in items:
            if self._validate_queue_entry(item):
                valid_items.append(item)

        self.log.info("Found %d new item(s)" % len(valid_items))

        if self.queue_widgets.currentIndex() != 1:
            self.queue_widgets.setCurrentIndex(1)

        self.queue_model.add_items(valid_items)
Пример #19
0
 def build_panel(level):
     label[level].setFixedWidth(60)
     label[level].setAlignment(QtCore.Qt.AlignVCenter |
                               QtCore.Qt.AlignRight)
     layout = QtWidgets.QHBoxLayout(panel[level])
     layout.addWidget(label[level])
     layout.addWidget(widget[level])
Пример #20
0
def main():
    import sys
    app = QtWidgets.QApplication(sys.argv)
    panel = Project_name_get()
    panel.show()

    sys.exit(app.exec_())
Пример #21
0
    def calculate_window_geometry(self):
        """Respond to status changes

        On creation, align window with screen bottom right.

        """

        window = self

        width = window.width()
        width = max(width, window.minimumWidth())

        height = window.height()
        height = max(height, window.sizeHint().height())

        desktop_geometry = QtWidgets.QDesktopWidget().availableGeometry()
        screen_geometry = window.geometry()

        screen_width = screen_geometry.width()
        screen_height = screen_geometry.height()

        # Calculate width and height of system tray
        systray_width = screen_geometry.width() - desktop_geometry.width()
        systray_height = screen_geometry.height() - desktop_geometry.height()

        padding = 10

        x = screen_width - width
        y = screen_height - height

        x -= systray_width + padding
        y -= systray_height + padding

        return QtCore.QRect(x, y, width, height)
Пример #22
0
 def message(self, text):
     msgBox = QtWidgets.QMessageBox()
     msgBox.setText(text)
     msgBox.setStyleSheet(style.load_stylesheet())
     msgBox.setWindowFlags(msgBox.windowFlags()
                           | QtCore.Qt.FramelessWindowHint)
     msgBox.exec_()
Пример #23
0
 def open_app(self):
     if self.context == 'maya':
         Popen("maya")
     else:
         message = QtWidgets.QMessageBox(self)
         message.setWindowTitle("App is not set")
         message.setIcon(QtWidgets.QMessageBox.Critical)
         message.show()
Пример #24
0
    def _create_label(self, text):
        """Lazy function to create a label"""

        title = QtWidgets.QLabel(text)
        title.setAlignment(QtCore.Qt.AlignCenter)
        title.setStyleSheet("font-weight: bold; font-size: 12px")

        return title
Пример #25
0
    def on_context_menu(self, point):
        view = self.data["view"]

        point_index = view.indexAt(point)
        if not point_index.isValid():
            return

        menu = QtWidgets.QMenu(view)
        icon_dir = qtawesome.icon("fa.folder-open", color="gray")

        dir_act = QtWidgets.QAction(menu, icon=icon_dir, text="Open Dir")
        dir_act.triggered.connect(self.action_open_dir)

        menu.addAction(dir_act)

        globalpos = view.mapToGlobal(point)
        menu.exec_(globalpos)
Пример #26
0
    def __init__(self, parent=None):
        super(_RenderGlobalsEditor, self).__init__(parent)
        self.setWindowTitle(api.Session["AVALON_LABEL"] + " Render Globals")
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        pools = QtWidgets.QComboBox()
        groups = QtWidgets.QComboBox()

        button = QtWidgets.QPushButton("Refresh")

        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(QtWidgets.QLabel("Current Pool"))
        layout.addWidget(pools)
        layout.addWidget(QtWidgets.QLabel("Current Group"))
        layout.addWidget(groups)
        layout.addWidget(QtWidgets.QLabel(""))
        layout.addWidget(button)

        self.pools = pools
        self.groups = groups
        self.render_globals = None

        self.resize(300, 100)
        self.setMinimumWidth(200)

        self.refresh()

        button.clicked.connect(self.refresh)
        pools.currentIndexChanged.connect(self.on_pool_changed)
        groups.currentIndexChanged.connect(self.on_group_changed)
Пример #27
0
    def _refresh(self):
        # Clear any existing items
        self._assets.clear()

        asset_names = [a["name"] for a in self.collect_assets()]
        completer = QtWidgets.QCompleter(asset_names)

        self._assets.setCompleter(completer)
        self._assets.addItems(asset_names)
Пример #28
0
    def on_context_menu(self, point):
        point_index = self.data["view"].indexAt(point)
        if not point_index.isValid():
            return

        menu = QtWidgets.QMenu(self)

        if lib.select_from_host is not NotImplemented:
            select_action = QtWidgets.QAction("Select", menu)
            select_action.triggered.connect(self.act_select_nodes)

            menu.addAction(select_action)

        # Show the context action menu
        global_point = self.data["view"].mapToGlobal(point)
        action = menu.exec_(global_point)
        if not action:
            return
Пример #29
0
    def right_mouse_menu(self, pos):
        """Build RMB menu for asset outliner"""

        active = self.view.currentIndex()  # index under mouse
        active = active.sibling(active.row(), 0)  # get first column
        globalpos = self.view.viewport().mapToGlobal(pos)

        menu = QtWidgets.QMenu(self.view)

        # Direct assignment
        apply_action = QtWidgets.QAction(menu, text="Select nodes")
        apply_action.triggered.connect(self.select_asset_from_items)

        if not active.isValid():
            apply_action.setEnabled(False)

        menu.addAction(apply_action)

        menu.exec_(globalpos)
Пример #30
0
    def populate_projects(self, projects):
        """Add projects to project dropdown menu"""

        completer = QtWidgets.QCompleter([p["name"] for p in projects])
        self._projects.setCompleter(completer)

        for idx, project in enumerate(projects):
            self._projects.insertItem(idx + 1,
                                      project["name"],
                                      userData=project["_id"])