Exemple #1
0
    def __init__(self,
                 title='',
                 title_editable=False,
                 icon=None,
                 item_icon_size=16,
                 collapsed=True,
                 shift_arrows_enabled=True,
                 delete_button_enabled=True,
                 parent=None):
        super(StackTitleFrame, self).__init__(parent)

        self._title = title
        self._item_icon = icon or 'tpdcc'
        self._title_editable = title_editable
        self._shift_arrows_enabled = shift_arrows_enabled
        self._delete_button_enabled = delete_button_enabled
        self._spaces_to_underscore = False
        self._collapsed = collapsed
        self._item_icon_size = item_icon_size

        self._collapsed_icon = resources.icon('sort_closed')
        self._expand_icon = resources.icon('sort_down')

        self.setObjectName('title')

        self.ui()
        self.setup_signals()

        self.setFixedHeight(self.sizeHint().height())
        self.setMinimumSize(self.sizeHint().width(),
                            self.sizeHint().height() + 1)
Exemple #2
0
    def contextMenuEvent(self, event):
        menu = QMenu(self)
        remove_icon = resources.icon(name='delete')
        remove_action = QAction(remove_icon, 'Remove', menu)
        remove_tooltip = 'Delete selected project'
        remove_action.setStatusTip(remove_tooltip)
        remove_action.setToolTip(remove_tooltip)
        remove_action.triggered.connect(self._on_remove_project)

        folder_icon = resources.icon(name='open_folder', extension='png')
        folder_action = QAction(folder_icon, 'Open in Browser', menu)
        open_project_in_explorer_tooltip = 'Open project folder in explorer'
        folder_action.setStatusTip(open_project_in_explorer_tooltip)
        folder_action.setToolTip(open_project_in_explorer_tooltip)
        folder_action.triggered.connect(self._on_open_in_browser)

        image_icon = resources.icon(name='picture', extension='png')
        set_image_action = QAction(image_icon, 'Set Project Image', menu)
        set_project_image_tooltip = 'Set the image used by the project'
        set_image_action.setToolTip(set_project_image_tooltip)
        set_image_action.setStatusTip(set_project_image_tooltip)
        set_image_action.triggered.connect(self._on_set_project_image)

        for action in [remove_action, None, folder_action, None, set_image_action]:
            if action is None:
                menu.addSeparator()
            else:
                menu.addAction(action)

        menu.exec_(self.mapToGlobal(event.pos()))
Exemple #3
0
    def set_icon(self, icon=None, highlight=False):
        """
        Sets the icon of the window dragger
        :param icon: QIcon
        :param highlight: bool
        """

        icon = icon or self._window.windowIcon()
        if icon and python.is_string(icon):
            icon = resources.icon(icon)
        if not icon or icon.isNull():
            icon = resources.icon('tpDcc')

        size = self.DEFAULT_LOGO_ICON_SIZE

        if highlight:
            self._logo_button.set_icon(
                [icon],
                colors=[None],
                tint_composition=QPainter.CompositionMode_Plus,
                size=size,
                icon_scaling=[1],
                color_offset=0,
                grayscale=True)
        else:
            self._logo_button.set_icon([icon],
                                       colors=None,
                                       size=size,
                                       icon_scaling=[1],
                                       color_offset=0)

        self._logo_button.set_icon_idle(icon)
    def _create_settings_menu(self, settings_menu):
        """
        Internal function that creates sidebar settings context menu
        :param settings_menu: Menu
        :return: Menu
        """

        show_filter_action = settings_menu.addAction(resources.icon('filter'), 'Show Filter')
        show_filter_action.setCheckable(True)
        show_filter_action.setChecked(self.is_filter_visible())
        show_filter_action_callback = partial(self._filter_visible_trigger, not self.is_filter_visible())
        show_filter_action.triggered.connect(show_filter_action_callback)

        show_icons_action = settings_menu.addAction(resources.icon('icons'), 'Show Icons')
        show_icons_action.setCheckable(True)
        show_icons_action.setChecked(self.icons_visible())
        show_icons_action_callback = partial(self.set_icons_visible, not self.icons_visible())
        show_icons_action.triggered.connect(show_icons_action_callback)

        show_root_folder_action = settings_menu.addAction(resources.icon('folder_tree'), 'Show Root Folder')
        show_root_folder_action.setCheckable(True)
        show_root_folder_action.setChecked(self.is_root_visible())
        show_root_folder_action_callback = partial(self.set_root_visible, not self.is_root_visible())
        show_root_folder_action.triggered.connect(show_root_folder_action_callback)

        return settings_menu
    def ui(self):
        super(SidebarWidget, self).ui()

        self._title_widget = QFrame(self)
        title_layout = layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0))
        self._title_widget.setLayout(title_layout)

        buttons_layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0))
        self._title_button = buttons.BaseButton(parent=self)
        self._title_button.setIcon(resources.icon('reset'))
        self._menu_button = buttons.BaseButton(parent=self)
        self._menu_button.setIcon(resources.icon('menu_dots'))
        buttons_layout.addWidget(self._title_button)
        buttons_layout.addStretch()
        buttons_layout.addWidget(self._menu_button)

        self._filter_search = search.SearchFindWidget(parent=self)
        self._filter_search.setVisible(False)

        title_layout.addLayout(buttons_layout)
        title_layout.addWidget(self._filter_search)

        self._tree_widget = SidebarTree(self)
        self._tree_widget.installEventFilter(self)
        self._tree_widget.itemDropped = self.itemDropped
        self._tree_widget.itemRenamed = self.itemRenamed
        self.itemSelectionChanged = self._tree_widget.itemSelectionChanged

        self._filter_search.set_text(self._tree_widget.filter_text())

        self.main_layout.addWidget(self._title_widget)
        self.main_layout.addWidget(self._tree_widget)
Exemple #6
0
    def __init__(self, search_line=None, parent=None):
        super(SearchFindWidget, self).__init__(parent=parent)

        self.setObjectName('SearchFindWidget')

        self.text = ''
        self._placeholder_text = ''

        main_layout = layouts.HorizontalLayout(spacing=2, margins=(2, 2, 2, 2))
        self.setLayout(main_layout)

        self._search_line = search_line or QLineEdit(self)
        self._search_menu = QMenu()
        self._search_menu.addAction('Test')

        icon_size = self.style().pixelMetric(QStyle.PM_SmallIconSize)

        delete_icon = resources.icon('delete')
        search_icon = QIcon(resources.icon('search'))

        self._clear_btn = buttons.IconButton(delete_icon,
                                             icon_padding=2,
                                             parent=self)
        self._clear_btn.setIconSize(QSize(icon_size, icon_size))
        self._clear_btn.setFixedSize(QSize(icon_size, icon_size))
        self._clear_btn.hide()

        self._search_btn = buttons.IconButton(search_icon,
                                              icon_padding=2,
                                              parent=self)
        self._search_btn.setIconSize(QSize(icon_size, icon_size))
        self._search_btn.setFixedSize(QSize(icon_size, icon_size))
        # self._search_btn.setStyleSheet('border: none;')
        # self._search_btn.setPopupMode(QToolButton.InstantPopup)
        self._search_btn.setEnabled(True)

        self._search_line.setStyleSheet("""
            QLineEdit { padding-left: %spx; padding-right: %spx; border-radius:10px; border:2px; border-color:red; }
            """ % (self._search_button_padded_width(),
                   self._clear_button_padded_width()))
        self._search_line.setMinimumSize(
            max(
                self._search_line.minimumSizeHint().width(),
                self._clear_button_padded_width() +
                self._search_button_padded_width()),
            max(
                self._search_line.minimumSizeHint().height(),
                max(self._clear_button_padded_width(),
                    self._search_button_padded_width())))

        main_layout.addWidget(self._search_line)

        self._search_line.setFocus()

        self._search_line.textChanged.connect(self.textChanged)
        self._search_line.textChanged.connect(self.set_text)
        # self._search_line.editingFinished.connect(self.editingFinished)
        # self._search_line.returnPressed.connect(self.returnPressed)
        self._clear_btn.clicked.connect(self.clear)
        self._search_btn.clicked.connect(self._popup_menu)
Exemple #7
0
    def _create_context_menu(self):
        self._context_menu = QMenu()

        move_up_icon = resources.icon('sort_up')
        move_down_icon = resources.icon('sort_down')
        rename_icon = resources.icon('rename')
        remove_icon = resources.icon('delete')
        copy_icon = resources.icon('copy')

        move_up_action = QAction(move_up_icon, 'Move Up', self._context_menu)
        self._context_menu.addAction(move_up_action)
        move_down_action = QAction(move_down_icon, 'Move Down',
                                   self._context_menu)
        self._context_menu.addAction(move_down_action)
        self._context_menu.addSeparator()
        copy_action = QAction(copy_icon, 'Copy', self._context_menu)
        self._context_menu.addAction(copy_action)
        rename_action = QAction(rename_icon, 'Rename', self._context_menu)
        self._context_menu.addAction(rename_action)
        remove_action = QAction(remove_icon, 'Remove', self._context_menu)
        self._context_menu.addAction(remove_action)

        move_up_action.triggered.connect(self.move_up)
        move_down_action.triggered.connect(self.move_down)
        rename_action.triggered.connect(self.rename)
        remove_action.triggered.connect(self.remove)
    def __init__(self, parent=None):
        super(DataSearcherWidget, self).__init__(parent=parent)

        self._library = None
        self._space_operator = 'and'

        self._icon_btn = buttons.BaseButton(parent=self)
        self._icon_btn.setIcon(resources.icon('search'))
        self._icon_btn.setObjectName('searchButton')
        self._icon_btn.setIconSize(QSize(12, 12))
        self._icon_btn.clicked.connect(self._on_icon_clicked)
        self._clear_btn = buttons.BaseButton(parent=self)
        self._clear_btn.setIcon(resources.icon('delete'))
        self._clear_btn.setObjectName('clearButton')
        self._clear_btn.setIconSize(QSize(12, 12))
        self._clear_btn.setCursor(Qt.ArrowCursor)
        self._clear_btn.setToolTip('Clear all search text')
        self._clear_btn.clicked.connect(self._on_clear_clicked)
        self.setPlaceholderText(self.PLACEHOLDER_TEXT)
        self.textChanged.connect(self._on_text_changed)
        self.update()

        tip = 'Search all current items.'
        self.setToolTip(tip)
        self.setStatusTip(tip)

        self._icon_btn.setStyleSheet('background-color: transparent')
        self._clear_btn.setStyleSheet('background-color: transparent')
Exemple #9
0
    def __init__(self,
                 parent=None,
                 size=16,
                 color=(255, 255, 255),
                 initial_index=FIRST_INDEX):
        super(DisplayModeButton, self).__init__(parent=parent)

        menu_icon_double_names = [
            'menu_double_empty', 'menu_double_one', 'menu_double_full'
        ]
        menu_icon_triple_names = [
            'menu_triple_empty', 'menu_triple_one', 'menu_triple_two',
            'menu_triple_full'
        ]
        self._menu_icon_double = [
            resources.icon(menu_icon) for menu_icon in menu_icon_double_names
        ]
        self._menu_icon_triple = [
            resources.icon(menu_icon) for menu_icon in menu_icon_triple_names
        ]

        self._current_icon = None
        self._icons = None
        self._displays = None
        self._initial_display = initial_index
        self._current_size = size
        self._icon_color = color
        self._highlight_offset = 40

        self.setIconSize(QSize(size, size))
        self.set_displays(ToolsetDisplays.Double)
Exemple #10
0
    def ui(self):
        item_icon = resources.icon(self._item_icon)
        if item_icon.isNull():
            item_icon = resources.icon('tpdcc')
        delete_icon = resources.icon('delete')

        self.setContentsMargins(*qtutils.margins_dpi_scale(0, 0, 0, 0))
        self._extras_layout = layouts.HorizontalLayout(margins=(0, 0, 0, 0),
                                                       spacing=0)
        self._horizontal_layout = layouts.HorizontalLayout(spacing=0)
        self.setLayout(self._horizontal_layout)

        self._line_edit = lineedit.ClickLineEdit(self._title)
        self._line_edit.setObjectName('lineEdit')
        self._line_edit.setFocusPolicy(Qt.NoFocus)
        self._line_edit.setVisible(False)
        self._line_edit.setAttribute(Qt.WA_TransparentForMouseEvents)
        if not self._title_editable:
            self._line_edit.setReadOnly(True)

        self._item_icon_btn = buttons.BaseMenuButton(parent=self)

        self._item_icon_btn.set_icon(icon=item_icon, size=self._item_icon_size)
        self._item_icon_btn.setAttribute(Qt.WA_TransparentForMouseEvents)

        self._horizontal_layout.addWidget(self._item_icon_btn)
        self._horizontal_layout.addStretch()
        self._horizontal_layout.addWidget(self._line_edit)
        self._horizontal_layout.addLayout(self._extras_layout)
        self._horizontal_layout.setStretchFactor(self._line_edit, 4)
Exemple #11
0
    def contextMenuEvent(self, event):
        menu = QMenu(self)
        remove_icon = resources.icon(name='delete')
        remove_action = QAction(remove_icon, 'Remove', menu)
        remove_action.setStatusTip(consts.DELETE_PROJECT_TOOLTIP)
        remove_action.setToolTip(consts.DELETE_PROJECT_TOOLTIP)
        remove_action.triggered.connect(self._on_remove_project)

        folder_icon = resources.icon(name='open_folder', extension='png')
        folder_action = QAction(folder_icon, 'Open in Browser', menu)
        folder_action.setStatusTip(consts.OPEN_PROJECT_IN_EXPLORER_TOOLTIP)
        folder_action.setToolTip(consts.OPEN_PROJECT_IN_EXPLORER_TOOLTIP)
        folder_action.triggered.connect(self._on_open_in_browser)

        image_icon = resources.icon(name='picture', extension='png')
        set_image_action = QAction(image_icon, 'Set Project Image', menu)
        set_image_action.setToolTip(consts.SET_PROJECT_IMAGE_TOOLTIP)
        set_image_action.setStatusTip(consts.SET_PROJECT_IMAGE_TOOLTIP)
        set_image_action.triggered.connect(self._on_set_project_image)

        for action in [
                remove_action, None, folder_action, None, set_image_action
        ]:
            if action is None:
                menu.addSeparator()
            else:
                menu.addAction(action)

        menu.exec_(self.mapToGlobal(event.pos()))
Exemple #12
0
 def _polish_icon(self, checked=None, **kwargs):
     if self._image:
         image_theme = kwargs.get('theme', self._image_theme)
         if image_theme:
             kwargs['theme'] = image_theme
         if self.isCheckable() and self.isChecked():
             self.setIcon(resources.icon(self._image, **kwargs))
         else:
             self.setIcon(resources.icon(self._image, **kwargs))
Exemple #13
0
    def __init__(self, dock_widget, renamable=False):
        super(DockTitleBar, self).__init__(dock_widget)

        self._renamable = renamable

        main_layout = layouts.HorizontalLayout(margins=(0, 0, 0, 1))
        self.setLayout(main_layout)

        self._buttons_box = QGroupBox('')
        self._buttons_box.setObjectName('Docked')
        self._buttons_layout = layouts.HorizontalLayout(spacing=1, margins=(2, 2, 2, 2))
        self._buttons_box.setLayout(self._buttons_layout)
        main_layout.addWidget(self._buttons_box)

        self._icon_label = QLabel(self)
        self._title_label = QLabel(self)
        self._title_label.setStyleSheet('background: transparent')
        self._title_edit = QLineEdit(self)
        self._title_edit.setVisible(False)

        self._button_size = QSize(14, 14)

        self._dock_btn = QToolButton(self)
        self._dock_btn.setIcon(resources.icon('restore_window', theme='color'))
        self._dock_btn.setMaximumSize(self._button_size)
        self._dock_btn.setAutoRaise(True)
        self._close_btn = QToolButton(self)
        self._close_btn.setIcon(resources.icon('close_window', theme='color'))
        self._close_btn.setMaximumSize(self._button_size)
        self._close_btn.setAutoRaise(True)

        self._buttons_layout.addSpacing(2)
        self._buttons_layout.addWidget(self._icon_label)
        self._buttons_layout.addWidget(self._title_label)
        self._buttons_layout.addWidget(self._title_edit)
        self._buttons_layout.addStretch()
        self._buttons_layout.addSpacing(5)
        self._buttons_layout.addWidget(self._dock_btn)
        self._buttons_layout.addWidget(self._close_btn)

        self._buttons_box.mouseDoubleClickEvent = self.mouseDoubleClickEvent
        self._buttons_box.mousePressEvent = self.mousePressEvent
        self._buttons_box.mouseMoveEvent = self.mouseMoveEvent
        self._buttons_box.mouseReleaseEvent = self.mouseReleaseEvent

        dock_widget.featuresChanged.connect(self._on_dock_features_changed)
        self._title_edit.editingFinished.connect(self._on_finish_edit)
        self._dock_btn.clicked.connect(self._on_dock_btn_clicked)
        self._close_btn.clicked.connect(self._on_close_btn_clicked)

        self._on_dock_features_changed(dock_widget.features())
        self.set_title(dock_widget.windowTitle())
        dock_widget.installEventFilter(self)
        dock_widget.topLevelChanged.connect(self._on_change_floating_style)

        if hasattr(dock_widget, 'icon') and callable(dock_widget.icon):
            self._icon_label.setPixmap(dock_widget.icon().pixmap(QSize(16, 16)))
Exemple #14
0
    def get_icon(self):
        """
        Returns toolset icon
        :return: QIcon
        """

        if not self._title_frame:
            return resources.icon('tpdcc')

        return resources.icon(self._title_frame.item_icon or 'tpdcc')
Exemple #15
0
    def set_icon_hover(self, icon=None):
        """
        Sets the icon hover of the window dragger
        :param icon: QIcon
        """

        icon = icon or self._window.windowIcon()
        if icon and python.is_string(icon):
            icon = resources.icon(icon)
        if not icon or icon.isNull():
            icon = resources.icon('tpDcc')

        self._logo_button.set_icon_hover(icon)
Exemple #16
0
 def enterEvent(self, event):
     if self._image:
         theme = self.theme()
         if theme:
             accent_color = theme.accent_color
             if self._image_theme:
                 self.setIcon(
                     resources.icon(self._image,
                                    theme=self._image_theme,
                                    color=accent_color))
             else:
                 self.setIcon(
                     resources.icon(self._image, color=accent_color))
     return super(BaseToolButton, self).enterEvent(event)
Exemple #17
0
def init(import_libs=True):
    """
    Initializes tpRigToolkit module
    :param import_libs: bool, Whether to import deps libraries by default or not
    """

    logger = create_logger()

    if import_libs:
        dcc_loader.init()

    dcc_loader_module = core_dcc.get_dcc_loader_module('tpRigToolkit.dccs')
    if dcc_loader_module:
        dcc_loader_module.init()

    register_resources()

    # Register configuration files
    dev = strings.to_boolean(os.getenv('TPRIGTOOLKIT_DEV', 'False'))
    configs.register_package_configs(PACKAGE, os.path.dirname(tpRigToolkit.config.__file__))
    core_config = configs.get_config('tpRigToolkit-core', environment='development' if dev else 'production')
    if not core_config:
        logger.warning(
            'tpRigToolkit-core configuration file not found! '
            'Make sure that you have tpRigToolkit-config package installed!')
        return None

    libs_to_load = core_config.get('libs', list())
    tools_to_load = core_config.get('tools', list())

    with contexts.Timer('Libraries loaded', logger=logger):
        libs.LibsManager().register_package_libs(PACKAGE, libs_to_register=libs_to_load)

    with contexts.Timer('Tools loaded', logger=logger):
        tools.ToolsManager().register_package_tools(PACKAGE, tools_to_register=tools_to_load)

    tools_paths = tools.ToolsManager().paths(PACKAGE)
    with contexts.Timer('Toolsets loaded', logger=logger):
        qt_toolsets.ToolsetsManager().register_package_toolsets(
            PACKAGE, os.path.dirname(os.path.abspath(tpRigToolkit.toolsets.__file__)), tools_paths)

    with contexts.Timer('Menu created', logger=logger):
        main_menu = menus.create_main_menu(
            package_name=PACKAGE, force_creation=True, icon=resources.icon('tpRigToolkit'))
        if main_menu:
            hub_action = QAction(resources.icon('tpRigToolkit'), 'Hub', main_menu)
            main_menu.addAction(hub_action)
            hub_action.triggered.connect(run_hub)
        menus.create_menus(package_name=PACKAGE, dev=dev, force_main_menu_creation=False)
Exemple #18
0
    def ui(self):
        super(OptionsViewer, self).ui()

        edit_mode_icon = resources.icon('edit')
        move_up_icon = resources.icon('sort_up')
        move_down_icon = resources.icon('sort_down')
        remove_icon = resources.icon('delete')

        self._edit_widget = QWidget()
        top_layout = layouts.HorizontalLayout()
        top_layout.setContentsMargins(0, 0, 0, 0)
        top_layout.setSpacing(2)
        self._edit_widget.setLayout(top_layout)
        self.main_layout.addWidget(self._edit_widget)
        self._edit_mode_btn = buttons.BaseButton(parent=self)
        self._edit_mode_btn.setIcon(edit_mode_icon)
        self._edit_mode_btn.setCheckable(True)
        top_layout.addWidget(self._edit_mode_btn)

        horizontal_separator = QFrame()
        horizontal_separator.setFrameShape(QFrame.VLine)
        horizontal_separator.setFrameShadow(QFrame.Sunken)
        top_layout.addWidget(horizontal_separator)

        self._move_up_btn = buttons.BaseButton(parent=self)
        self.move_down_btn = buttons.BaseButton(parent=self)
        self.remove_btn = buttons.BaseButton(parent=self)
        self._move_up_btn.setIcon(move_up_icon)
        self.move_down_btn.setIcon(move_down_icon)
        self.remove_btn.setIcon(remove_icon)
        self._move_up_btn.setVisible(False)
        self.move_down_btn.setVisible(False)
        self.remove_btn.setVisible(False)
        top_layout.addWidget(self._move_up_btn)
        top_layout.addWidget(self.move_down_btn)
        top_layout.addWidget(self.remove_btn)
        top_layout.addStretch()
        self.main_layout.addWidget(dividers.Divider())

        self._scroll = QScrollArea()
        self._scroll.setSizePolicy(QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        self._scroll.setFocusPolicy(Qt.NoFocus)
        self._scroll.setWidgetResizable(True)
        self.setFocusPolicy(Qt.NoFocus)
        self._options_list = self.OPTION_LIST_CLASS(parent=self)
        self._scroll.setWidget(self._options_list)

        self.main_layout.addWidget(self._scroll)
Exemple #19
0
        def _add_tool_action(item_info, parent):
            tool_id = item_info.get('id', None)
            tool_type = item_info.get('type', 'tool')

            tool_data = tools.ToolsManager().get_tool_data_from_id(tool_id)
            if tool_data is None:
                LOGGER.warning(
                    'Menu : Failed to find Tool: {}, type {}'.format(
                        tool_id, tool_type))
                return

            tool_config = tool_data['config']
            if not tool_config:
                return

            tool_menu_ui_data = tool_data['config'].data.get('menu_ui', {})
            tool_icon_name = tool_menu_ui_data.get('icon', '')
            if not tool_icon_name:
                tool_icon_name = tool_data['config'].data.get('icon', None)
            if not tool_icon_name:
                tool_icon_name = 'tpDcc'
            tool_icon = resources.icon(tool_icon_name)
            if not tool_icon or tool_icon.isNull():
                tool_icon = resources.icon('tpDcc')

            label = tool_menu_ui_data.get('label', 'No_label')
            tagged_action = menu.SearchableTaggedAction(label=label,
                                                        icon=tool_icon,
                                                        parent=parent)
            is_checkable = tool_menu_ui_data.get('is_checkable', False)
            is_checked = tool_menu_ui_data.get('is_checked', False)
            if is_checkable:
                tagged_action.setCheckable(is_checkable)
                tagged_action.setChecked(is_checked)
                # tagged_action.connect(partial(self._launch_tool, tool_data))
                tagged_action.toggled.connect(
                    partial(_launch_tool_by_id, tool_id))
            else:
                tagged_action.triggered.connect(
                    partial(_launch_tool_by_id, tool_id))

            icon = tool_menu_ui_data.get('icon', 'tpDcc')
            if icon:
                pass

            tagged_action.tags = set(tool_data['config'].data.get('tags', []))

            parent.addAction(tagged_action)
Exemple #20
0
    def reload(self):
        """
        Reloads current menu data
        """

        self.clear()

        if self._enable_select_content:
            select_content_action = QAction(resources.icon('cursor'),
                                            'Select content', self)
            select_content_action.triggered.connect(self.item().select_content)
            self.addAction(select_content_action)
            self.addSeparator()

        selection_sets = self.selection_sets()
        if not selection_sets:
            action = QAction('No selection sets found!', self)
            action.setEnabled(False)
            self.addAction(action)
            return

        for selection_set in selection_sets:
            dirname = os.path.basename(os.path.dirname(selection_set.path()))
            basename = os.path.basename(selection_set.path()).replace(
                selection_set.EXTENSION, '')
            nice_name = '{}: {}'.format(dirname, basename)
            selection_set_action = QAction(nice_name, self)
            selection_set_action_callback = partial(
                selection_set.load, namespaces=self.namespaces())
            selection_set_action.triggered.connect(
                selection_set_action_callback)
            self.addAction(selection_set_action)
Exemple #21
0
    def ui(self):
        super(EditFileTreeWidget, self).ui()

        self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

        self._tree_widget = self.TREE_WIDGET(parent=self)

        self._manager_widget = self.MANAGER_WIDGET(parent=self)
        self._manager_widget.set_tree_widget(self._tree_widget)

        self._filter_widget = self.FILTER_WIDGET(parent=self)
        self._filter_widget.set_tree_widget(self._tree_widget)
        self._filter_widget.set_directory(self._directory)
        drag_reorder_icon = resources.icon('drag_reorder')
        edit_mode_layout = layouts.VerticalLayout(spacing=0,
                                                  margins=(0, 0, 0, 0))
        edit_mode_layout.setAlignment(Qt.AlignBottom)
        self._edit_mode_btn = buttons.BaseButton(parent=self)
        self._edit_mode_btn.setIcon(drag_reorder_icon)
        self._edit_mode_btn.setCheckable(True)
        edit_mode_layout.addWidget(self._edit_mode_btn)
        self._filter_widget.main_layout.addLayout(edit_mode_layout)

        self.main_layout.addWidget(self._filter_widget)
        self.main_layout.addWidget(self._tree_widget)
        self.main_layout.addWidget(self._manager_widget)
Exemple #22
0
    def icon():
        """
        Returns the icon of the tool
        :return: QIcon or None
        """

        return resources.icon('tpRigToolkit')
Exemple #23
0
    def ui(self):
        super(ManualRenameWidget, self).ui()

        manual_accordion = accordion.AccordionWidget()
        self.main_layout.addWidget(manual_accordion)

        self._renamer_widget = renamerwidget.renamer_widget(
            client=self._controller.client, parent=self)
        self._prefix_suffix_widget = prefixsuffixwidget.preffix_suffix_widget(
            client=self._controller.client,
            naming_config=self._model.naming_config,
            parent=self)
        self._number_side_widget = numbersidewidget.number_side_widget(
            client=self._controller.client, parent=self)
        self._namespace_widget = None
        if dcc.is_maya():
            self._namespace_widget = namespacewidget.namespace_widget(
                client=self._controller.client, parent=self)
        self._replacer_widget = replacerwidget.replacer_widget(
            client=self._controller.client, parent=self)
        self._utils_widget = utilswidget.utils_widget(
            client=self._controller.client, parent=self)

        manual_accordion.add_item('Name', self._renamer_widget)
        manual_accordion.add_item('Prefix/Suffix', self._prefix_suffix_widget)
        manual_accordion.add_item('Number & Side', self._number_side_widget)
        if self._namespace_widget:
            manual_accordion.add_item('Namespace', self._namespace_widget)
        manual_accordion.add_item('Search & Replace', self._replacer_widget)
        manual_accordion.add_item('Utils', self._utils_widget)

        self._rename_btn = buttons.BaseButton('Rename')
        self._rename_btn.setIcon(resources.icon('rename'))
        self.main_layout.addLayout(dividers.DividerLayout())
        self.main_layout.addWidget(self._rename_btn)
Exemple #24
0
    def _create_sequence_widget(self):
        """
        Internal function that creates a sequence widget to replace the static thumbnail widget
        """

        self._sequence_widget = sequence.ImageSequenceWidget(self)
        self._sequence_widget.setObjectName('thumbnailButton')
        self._thumbnail_frame.layout().insertWidget(0, self._sequence_widget)
        self._sequence_widget.clicked.connect(self._on_thumbnail_capture)
        self._sequence_widget.setToolTip(
            'Click to capture a thumbnail from the current model panel.\n'
            'CTRL + Click to show the capture window for better framing.')

        camera_icon = resources.get('icons',
                                    self.theme().style(), 'camera.png')
        expand_icon = resources.get('icons',
                                    self.theme().style(), 'full_screen.png')
        folder_icon = resources.get('icons',
                                    self.theme().style(), 'folder.png')

        self._sequence_widget.addAction(camera_icon, 'Capture new image',
                                        'Capture new image',
                                        self._on_thumbnail_capture)
        self._sequence_widget.addAction(expand_icon, 'Show Capture window',
                                        'Show Capture window',
                                        self._on_show_capture_window)
        self._sequence_widget.addAction(folder_icon, 'Load image from disk',
                                        'Load image from disk',
                                        self._on_show_browse_image_dialog)

        self._sequence_widget.setIcon(resources.icon('tpdcc'))
Exemple #25
0
    def set_widget(self, widget):
        """
        Sets the widget used to set and get the field value
        :param widget: QWidget
        """

        widget_layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0))

        self._widget = widget
        self._widget.setParent(self)
        self._widget.setObjectName('widget')
        # self._widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)

        self._menu_button = buttons.BaseButton()
        self._menu_button.setIcon(resources.icon('menu_dots'))
        self._menu_button.setHidden(True)
        self._menu_button.setObjectName('menuButton')
        # self._menu_button.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        self._menu_button.clicked.connect(self._on_menu_callback)

        widget_layout.addWidget(self._widget)
        widget_layout.addWidget(self._menu_button)

        layout = layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0))

        self._error_label = message.BaseMessage(parent=self).error().set_show_icon(False)
        self._error_label.setMaximumHeight(40)
        self._error_label.setHidden(True)
        self._error_label.setObjectName('errorLabel')
        self._error_label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)

        layout.addLayout(widget_layout)
        layout.addWidget(self._error_label)

        self._layout2.addLayout(layout)
Exemple #26
0
    def ui(self):
        super(NewProjectWidget, self).ui()

        self._search_widget = search.SearchFindWidget()
        self._search_widget.set_placeholder_text('Filter Templates ...')

        self._templates_list = self.TEMPLATES_VIEWER_CLASS(project_class=self._project_class)
        self._templates_list.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        project_layout = layouts.HorizontalLayout(spacing=1, margins=(0, 0, 0, 0))

        project_line_layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0))
        project_layout.addLayout(project_line_layout)
        self._project_line = lineedit.BaseLineEdit(parent=self)
        self._project_line.setPlaceholderText('Project Path')
        self._project_line.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self._project_btn = directory.SelectFolderButton(text='', use_app_browser=True)
        project_line_layout.addWidget(self._project_line)
        project_line_layout.addWidget(self._project_btn)
        self._name_line = lineedit.BaseLineEdit(parent=self)
        self._name_line.setPlaceholderText('Project Name')
        project_line_layout.addWidget(dividers.get_horizontal_separator_widget())
        project_line_layout.addWidget(self._name_line)
        self._create_btn = buttons.BaseButton('Create', parent=self)
        self._create_btn.setIcon(resources.icon('create'))
        project_line_layout.addSpacing(10)
        project_line_layout.addWidget(self._create_btn)

        self.main_layout.addWidget(self._search_widget)
        self.main_layout.addWidget(self._templates_list)
        self.main_layout.addLayout(project_layout)
    def ui(self):
        super(RotationAxisView, self).ui()

        set_rot_top_layout = layouts.HorizontalLayout(spacing=5)
        self._set_rot_axis_box = combobox.BaseComboBox(parent=self)
        set_rot_top_layout.addWidget(self._set_rot_axis_box)
        for rotAxis in ROTATION_AXES:
            self._set_rot_axis_box.addItem(rotAxis)
        set_rot_axis_common_btn = buttons.BaseButton('   <', parent=self)
        set_rot_axis_common_btn.setMaximumWidth(45)
        set_rot_axis_common_btn.setStyleSheet(
            "QPushButton::menu-indicator{image:url(none.jpg);}")
        self._set_rot_axis_common_btn_menu = QMenu(self)
        # self._set_common_rotation_axis()
        set_rot_axis_common_btn.setMenu(self._set_rot_axis_common_btn_menu)
        set_rot_top_layout.addWidget(set_rot_axis_common_btn)

        set_rot_axis_btn_layout = layouts.HorizontalLayout()
        set_rot_axis_btn_layout.setAlignment(Qt.AlignCenter)
        self._set_rot_axis_btn = buttons.BaseButton('Apply', parent=self)
        self._set_rot_axis_btn.setIcon(resources.icon('ok'))
        self._affect_children_cbx = checkbox.BaseCheckBox('Affect Children',
                                                          parent=self)
        self._set_rot_axis_btn.setMaximumWidth(100)
        set_rot_axis_btn_layout.addWidget(self._set_rot_axis_btn)
        set_rot_axis_btn_layout.addWidget(self._affect_children_cbx)

        self.main_layout.addLayout(set_rot_top_layout)
        self.main_layout.addLayout(set_rot_axis_btn_layout)
Exemple #28
0
    def ui(self):
        super(ReplacerView, self).ui()

        replace_layout = layouts.HorizontalLayout(spacing=2, margins=(0, 0, 0, 0))
        replace_layout.setAlignment(Qt.AlignLeft)
        self.main_layout.addLayout(replace_layout)

        self._find_replace_cbx = checkbox.BaseCheckBox(parent=self)
        replace_layout.addWidget(self._find_replace_cbx)

        self._replace_line = lineedit.BaseLineEdit(parent=self)
        self._replace_line.setPlaceholderText('Search')
        self._with_line = lineedit.BaseLineEdit(parent=self)
        self._with_line.setPlaceholderText('Replace')
        reg_ex = QRegExp("[a-zA-Z_0-9]+")
        text_validator = QRegExpValidator(reg_ex, self._replace_line)
        self._replace_line.setValidator(text_validator)
        self._with_line.setValidator(text_validator)
        self._search_replace_btn = buttons.BaseButton(parent=self)
        self._search_replace_btn.setIcon(resources.icon('find_replace'))

        replace_layout.addWidget(self._replace_line)
        replace_layout.addStretch()
        replace_layout.addWidget(self._with_line)
        replace_layout.addWidget(self._search_replace_btn)

        self._replace_line.setEnabled(False)
        self._with_line.setEnabled(False)
Exemple #29
0
    def _toolbar_example(self):

        def _collapse():
            tool_bar.collapse()

        def _set_icon_color():
            tool_bar.set_icon_color(QColor(255, 255, 0))

        toolbar_widget = QWidget(parent=self)
        toolbar_layout = layouts.VerticalLayout()
        toolbar_widget.setLayout(toolbar_layout)

        tool_bar = toolbar.ToolBar(parent=self)
        tool_bar.set_children_height(50)
        toolbar_layout.addWidget(tool_bar)
        line_edit = lineedit.BaseLineEdit(parent=self)
        line_edit.setObjectName('hello')

        collapse_action = tool_bar.addAction('Collapse')
        tool_bar.addWidget(line_edit)
        tool_bar.addAction(resources.icon('add'), 'Plus')
        color_action = QAction('Yellow', None)
        tool_bar.insertAction('Plus', color_action)

        collapse_action.triggered.connect(_collapse)
        color_action.triggered.connect(_set_icon_color)

        self.main_layout.addWidget(buttons.BaseButton('Hello'))
        self.main_layout.addStretch()

        return toolbar_widget
Exemple #30
0
    def ui(self):
        super(MayaSaveWidget, self).ui()

        self._selection_set_button = buttons.BaseButton(parent=self)
        self._selection_set_button.setIcon(resources.icon('group_objects'))
        self._preview_buttons_layout.insertWidget(2,
                                                  self._selection_set_button)