def ui(self): super(SliderPanelExample, self).ui() add_icon = tpDcc.ResourcesMgr().icon('add', color=QColor(125, 0, 0)) self._button_grp = group.RadioButtonGroup() self._button_grp.set_button_list( ['top', { 'text': 'right', 'checked': True }, 'bottom', 'left']) self._open_btn_2 = buttons.BaseButton('Open', parent=self).tiny() lyt = layouts.HorizontalLayout() lyt.addWidget(self._button_grp) lyt.addSpacing(20) lyt.addWidget(self._open_btn_2) lyt.addStretch() self._new_account_btn = buttons.BaseButton(text='New account', icon=add_icon).primary() lyt1 = layouts.HorizontalLayout() lyt1.addWidget(label.BaseLabel('Submit form in drawer')) lyt1.addWidget(self._new_account_btn) lyt1.addStretch() self.main_layout.addWidget(dividers.Divider('Custom Placement')) self.main_layout.addLayout(lyt) self.main_layout.addWidget(dividers.Divider('Submit form in drawer')) self.main_layout.addLayout(lyt1)
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)
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)
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')
def ui(self): super(InterpolateItView, self).ui() central_layout = layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0)) central_widget = QWidget() central_widget.setLayout(central_layout) central_widget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) scroll = QScrollArea() scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroll.setWidgetResizable(True) scroll.setFocusPolicy(Qt.NoFocus) self.main_layout.addWidget(scroll) scroll.setWidget(central_widget) self._interpolator_layout = layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0)) self._interpolator_layout.setAlignment(Qt.AlignTop) button_layout = layouts.HorizontalLayout(spacing=2, margins=(0, 0, 0, 0)) self._load_btn = buttons.BaseButton('Load', parent=self) self._save_btn = buttons.BaseButton('Save', parent=self) self._add_btn = buttons.BaseButton('New', parent=self) button_layout.addWidget(self._save_btn) button_layout.addWidget(self._load_btn) button_layout.addStretch() button_layout.addWidget(self._add_btn) central_layout.addLayout(self._interpolator_layout) self.main_layout.addLayout(button_layout)
def ui(self): super(ToastExample, self).ui() btn1 = buttons.BaseButton('Normal Message').primary() btn2 = buttons.BaseButton('Success Message').success() btn3 = buttons.BaseButton('Warning Message').warning() btn4 = buttons.BaseButton('Error Message').danger() btn1.clicked.connect( partial(self._on_show_toast, toast.BaseToast.info, {'text': 'Normal'})) btn2.clicked.connect( partial(self._on_show_toast, toast.BaseToast.success, {'text': 'Success'})) btn3.clicked.connect( partial(self._on_show_toast, toast.BaseToast.warning, {'text': 'Warning'})) btn4.clicked.connect( partial(self._on_show_toast, toast.BaseToast.error, {'text': 'Error'})) sub_lyt1 = layouts.HorizontalLayout() sub_lyt1.addWidget(btn1) sub_lyt1.addWidget(btn2) sub_lyt1.addWidget(btn3) sub_lyt1.addWidget(btn4) loading_btn = buttons.BaseButton('Loading Toast').primary() loading_btn.clicked.connect(self._on_show_loading_toast) self.main_layout.addWidget(dividers.Divider('different type')) self.main_layout.addLayout(sub_lyt1) self.main_layout.addWidget(dividers.Divider('loading')) self.main_layout.addWidget(loading_btn) self.main_layout.addStretch()
def ui(self): super(BaseSaveWidget, self).ui() title_layout = layouts.HorizontalLayout() title_layout.setContentsMargins(2, 2, 0, 0) title_layout.setSpacing(2) self._icon_lbl = QLabel() self._icon_lbl.setMaximumSize(QSize(14, 14)) self._icon_lbl.setMinimumSize(QSize(14, 14)) self._icon_lbl.setScaledContents(True) self._title_lbl = QLabel() title_layout.addWidget(self._icon_lbl) title_layout.addWidget(self._title_lbl) self._folder_widget = directory.SelectFolder('Folder', use_app_browser=True) buttons_layout = layouts.HorizontalLayout() buttons_layout.setContentsMargins(4, 4, 4, 4) buttons_layout.setSpacing(4) buttons_frame = QFrame() buttons_frame.setFrameShape(QFrame.NoFrame) buttons_frame.setFrameShadow(QFrame.Plain) buttons_frame.setLayout(buttons_layout) buttons_layout.addStretch() self.save_btn = buttons.BaseButton('Save') self.cancel_btn = buttons.BaseButton('Cancel') buttons_layout.addWidget(self.save_btn, parent=self) buttons_layout.addWidget(self.cancel_btn, parent=self) buttons_layout.addStretch() self._options_layout = layouts.VerticalLayout() self._options_layout.setContentsMargins(0, 0, 0, 0) self._options_layout.setSpacing(2) self._options_frame = QFrame() self._options_frame.setFrameShape(QFrame.NoFrame) self._options_frame.setFrameShadow(QFrame.Plain) self._options_frame.setLineWidth(0) self._options_frame.setLayout(self._options_layout) self._extra_layout = layouts.VerticalLayout() self._extra_layout.setContentsMargins(0, 0, 0, 0) self._extra_layout.setSpacing(2) self.main_layout.addLayout(title_layout) self.main_layout.addWidget(self._folder_widget) self._extra_layout.addWidget(self._options_frame) self.main_layout.addWidget(dividers.Divider()) self.main_layout.addLayout(self._extra_layout) self.main_layout.addWidget(dividers.Divider()) self.main_layout.addWidget(buttons_frame)
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)
def ui(self): super(RenamerView, self).ui() renamer_widget = QWidget() renamer_widget.setLayout( layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0))) renamer_widget.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.main_layout.addWidget(renamer_widget) rename_layout = layouts.HorizontalLayout(spacing=2, margins=(0, 0, 0, 0)) rename_layout.setAlignment(Qt.AlignLeft) renamer_widget.layout().addLayout(rename_layout) self._base_name_cbx = checkbox.BaseCheckBox(parent=self) rename_layout.addWidget(self._base_name_cbx) self._renamer_line = lineedit.BaseLineEdit(parent=self) self._renamer_line.setPlaceholderText('New Name') rename_layout.addWidget(self._renamer_line) reg_ex = QRegExp("^(?!^_)[a-zA-Z_]+") text_validator = QRegExpValidator(reg_ex, self._renamer_line) self._renamer_line.setValidator(text_validator) self._renamer_btn = buttons.BaseButton(parent=self) self._renamer_btn.setIcon(resources.icon('rename')) rename_layout.addWidget(self._renamer_btn)
def ui(self): super(LineEditExample, self).ui() size_lyt = layouts.HorizontalLayout() line_edit_small = lineedit.BaseLineEdit().small() line_edit_small.setPlaceholderText('small size') line_edit_medium = lineedit.BaseLineEdit().medium() line_edit_medium.setPlaceholderText('default size') line_edit_large = lineedit.BaseLineEdit().large() line_edit_large.setPlaceholderText('large size') size_lyt.addWidget(line_edit_small) size_lyt.addWidget(line_edit_medium) size_lyt.addWidget(line_edit_large) line_edit_tool_btn = lineedit.BaseLineEdit(text='BaseToolButton') line_edit_tool_btn.set_prefix_widget( buttons.BaseToolButton().image('user').icon_only()) line_edit_label = lineedit.BaseLineEdit(text='BaseLabel') line_lbl = label.BaseLabel('User').mark().secondary() line_lbl.setAlignment(Qt.AlignCenter) line_lbl.setFixedWidth(80) line_edit_label.set_prefix_widget(line_lbl) line_edit_btn = lineedit.BaseLineEdit('BaseButton') push_btn = buttons.BaseButton('Go').primary() line_edit_btn.set_suffix_widget(push_btn) search_engine_line = lineedit.BaseLineEdit().search_engine().large() search_engine_line.returnPressed.connect(self._on_search) line_edit_options = lineedit.BaseLineEdit() combo_box = combobox.BaseComboBox() option_menu = menu.BaseMenu() option_menu.set_separator('|') option_menu.set_data([r'http://', r'https://']) combo_box.set_menu(option_menu) combo_box.set_value('http://') combo_box.setFixedWidth(90) line_edit_options.set_prefix_widget(combo_box) self.main_layout.addWidget(dividers.Divider('different size')) self.main_layout.addLayout(size_lyt) self.main_layout.addWidget( dividers.Divider('custom prefix and suffix widget')) self.main_layout.addWidget(line_edit_tool_btn) self.main_layout.addWidget(line_edit_label) self.main_layout.addWidget(line_edit_btn) self.main_layout.addWidget(dividers.Divider('preset')) self.main_layout.addWidget(label.BaseLabel('error')) self.main_layout.addWidget( lineedit.BaseLineEdit( 'waring: file d:/ddd/ccc.jpg not exists.').error()) self.main_layout.addWidget(label.BaseLabel('search')) self.main_layout.addWidget(lineedit.BaseLineEdit().search().small()) self.main_layout.addWidget(label.BaseLabel('search engine')) self.main_layout.addWidget(search_engine_line) self.main_layout.addWidget(label.BaseLabel('file')) self.main_layout.addWidget(lineedit.BaseLineEdit().file().small()) self.main_layout.addWidget(label.BaseLabel('folder')) self.main_layout.addWidget(lineedit.BaseLineEdit().folder().small()) self.main_layout.addWidget(label.BaseLabel('options')) self.main_layout.addWidget(line_edit_options) self.main_layout.addStretch()
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(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)
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)
def __init__(self, *args, **kwargs): super(ButtonGroupFieldWidget, self).__init__(*args, **kwargs) self._value = '' self._buttons = dict() items = self.data().get('items') widget = QFrame(self) layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0)) widget.setLayout(layout) index = 0 for item in items: index += 1 button = buttons.BaseButton(item, parent=self) button.setCheckable(True) button_callback = partial(self.set_value, item) button.clicked.connect(button_callback) self._buttons[item] = button if index == 1: button.setProperty('first', True) if index == len(items): button.setProperty('last', True) self.set_widget(widget)
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)
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
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)
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)
def ui(self): super(BoneHierarchyWidget, self).ui() self._tree_hierarchy = QTreeWidget() self._node_line = lineedit.BaseLineEdit(parent=self) self._node_line.setReadOnly(True) self._ok_btn = buttons.BaseButton('Ok') self._cancel_btn = buttons.BaseButton('Cancel') buttons_layout = layouts.HorizontalLayout() buttons_layout.addStretch() buttons_layout.addWidget(self._ok_btn) buttons_layout.addWidget(self._cancel_btn) self.main_layout.addWidget(self._tree_hierarchy) self.main_layout.addWidget(self._node_line) self.main_layout.addWidget(dividers.Divider()) self.main_layout.addLayout(buttons_layout)
def ui(self): super(ControlLineEdit, self).ui() self._line = lineedit.BaseLineEdit() self._btn = buttons.BaseButton(text='...') self.main_layout.addWidget(self._line) self.main_layout.addWidget(self._btn)
def ui(self): super(SaveFileWidet, self).ui() self.setContentsMargins(1, 1, 1, 1) self._save_button = buttons.BaseButton('Save', parent=self) self._load_button = buttons.BaseButton('Open', parent=self) self._save_button.setMaximumWidth(100) self._load_button.setMaximumWidth(100) self._save_button.setMinimumWidth(60) self._load_button.setMinimumWidth(60) self._save_button.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self._load_button.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self._save_button.setIcon(resources.icon('save')) self._load_button.setIcon(resources.icon('folder')) self.main_layout.addWidget(self._save_button) self.main_layout.addWidget(self._load_button)
def ui(self): super(PreferencesWidget, self).ui() self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self._splitter = QSplitter() self._splitter.setOrientation(Qt.Horizontal) self._splitter.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self._scroll_area = QScrollArea() self._scroll_area.setWidgetResizable(True) self._scroll_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) # self._scroll_area.setMinimumWidth(200) self._scroll_area_widget_contents = QWidget() # self._scroll_area_widget_contents.setGeometry(QRect(0, 0, 480, 595)) self._scroll_area_layout = layouts.VerticalLayout(spacing=2, margins=(1, 1, 1, 1)) self._scroll_area_layout.setAlignment(Qt.AlignTop) self._scroll_area_widget_contents.setLayout(self._scroll_area_layout) self._categories_layout = layouts.VerticalLayout() self._stack = stack.SlidingStackedWidget() self._stack.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self._stack.set_vertical_mode() self._buttons_layout = layouts.HorizontalLayout(spacing=1, margins=(0, 0, 0, 0)) self._save_prefs_close_btn = buttons.BaseButton( 'Save and Close', icon=resources.icon('save'), parent=self) self._close_btn = buttons.BaseButton('Close', icon=resources.icon('cancel'), parent=self) self._buttons_layout.addStretch() self._buttons_layout.addWidget(self._save_prefs_close_btn) self._buttons_layout.addWidget(self._close_btn) self._scroll_area_layout.addLayout(self._categories_layout) self._scroll_area.setWidget(self._scroll_area_widget_contents) self._splitter.addWidget(self._scroll_area) self._splitter.addWidget(self._stack) self._splitter.setSizes([150, 450]) self.main_layout.addWidget(self._splitter) self.main_layout.addWidget(dividers.Divider(parent=self)) self.main_layout.addLayout(self._buttons_layout)
def __init__(self, parent=None, form=None): super(FormDialog, self).__init__(parent) self._settings = None self.main_layout = layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0)) self.setLayout(self.main_layout) self._widgets = list() self._validator = None self._title = label.BaseLabel(parent=self) self._title.setObjectName('title') self._title.setText('FORM') self._description = label.BaseLabel(parent=self) self._description.setObjectName('description') self._form_widget = FormWidget(self) self._form_widget.setObjectName('formWidget') self._form_widget.validated.connect(self._on_validated) btn_layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0)) self._accept_btn = buttons.BaseButton(parent=self) self._accept_btn.setObjectName('acceptButton') self._accept_btn.setText('Accept') self._accept_btn.clicked.connect(self.accept) self._reject_btn = buttons.BaseButton(parent=self) self._reject_btn.setObjectName('rejectButton') self._reject_btn.setText('Cancel') self._reject_btn.clicked.connect(self.reject) btn_layout.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Preferred)) btn_layout.addWidget(self._accept_btn) btn_layout.addWidget(self._reject_btn) self.main_layout.addWidget(self._title) self.main_layout.addWidget(self._description) self.main_layout.addWidget(self._form_widget) self.main_layout.addStretch(1) self.main_layout.addLayout(btn_layout) if form: self.set_settings(form)
def ui(self): super(JointUtilsView, self).ui() utils_layout = layouts.GridLayout() self.main_layout.addLayout(utils_layout) self._display_lra_btn = buttons.BaseButton('Display LRA', parent=self) self._hide_lra_btn = buttons.BaseButton('Hide LRA', parent=self) self._reset_orient_to_world_btn = buttons.BaseButton('Reset to World', parent=self) self._select_hierarchy_btn = buttons.BaseButton('Select Hierarchy', parent=self) self._display_lra_btn.setIcon(resources.icon('eye')) self._hide_lra_btn.setIcon(resources.icon('eye_closed')) self._reset_orient_to_world_btn.setIcon(resources.icon('reset')) self._select_hierarchy_btn.setIcon(resources.icon('cursor')) utils_layout.addWidget(self._display_lra_btn, 0, 0) utils_layout.addWidget(self._hide_lra_btn, 0, 1) utils_layout.addWidget(self._reset_orient_to_world_btn, 0, 2) utils_layout.addWidget(self._select_hierarchy_btn, 1, 0)
def ui(self): super(BaseExportWidget, self).ui() self.setWindowTitle('Export Item') self._export_button = buttons.BaseButton('Export', parent=self) self._export_button.setIcon(resources.icon('export')) self._preview_buttons_layout.insertWidget(1, self._export_button) self._save_button.setVisible(False) self._thumbnail_frame.setVisible(False)
def _setup_types(self): for i, category_type in enumerate(self._types): for type_name, type_data in category_type.items(): dcc_type = type_data.get('type', None) dcc_fn = type_data.get('fn', None) dcc_args = type_data.get('args', dict()) type_btn = buttons.BaseButton(type_name, parent=self) type_btn.setCheckable(True) type_btn.setProperty('dcc_type', dcc_type) type_btn.setProperty('dcc_fn', dcc_fn) type_btn.setProperty('dcc_args', dcc_args) if i == 0: type_btn.setChecked(True) self._types_layout.addWidget(type_btn) self._category_buttons.append(type_btn) type_btn.toggled.connect(self._on_toggle_type) self._others_btn = buttons.BaseButton('Others', parent=self) self._others_btn.setCheckable(True) self._types_layout.addWidget(self._others_btn) self._others_btn.toggled.connect(self._on_toggle_type)
def ui(self): super(HistoryFileWidget, self).ui() self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self._btn_layout = layouts.HorizontalLayout() self._open_btn = buttons.BaseButton('Open') self._open_btn.setIcon(resources.icon('folder')) self._open_btn.setMaximumWidth(100) self._btn_layout.addWidget(self._open_btn) self._version_list = self.VERSION_LIST() self.main_layout.addWidget(self._version_list) self.main_layout.addLayout(self._btn_layout)
def refresh(self): """ Syncs view to the current state of its model """ self._hierarchy_cbx.setChecked(self._model.hierarchy_check) self._node_types_combo.clear() for btn in self._buttons_grp.buttons(): self._buttons_grp.removeButton(btn) node_types = self._model.node_types if not node_types: self._node_types_combo.setVisible(False) else: self._node_types_combo.setVisible(True) for node_type in node_types: self._node_types_combo.addItem(str(node_type).split('.')[-1]) categories = self._model.categories or dict() nodes_to_discard = self._model.nodes_to_discard types_to_discard = self._model.types_to_discard for node_type in types_to_discard: nodes_to_discard.extend(dcc.list_nodes(node_type=node_type)) for i, category in enumerate(categories): for category_name, category_data in category.items(): title = category_data.get('title', category) icon = category_data.get('icon', None) types = category_data.get('types', dict()) category_btn = buttons.BaseButton(title) category_btn.setCheckable(True) if icon: category_btn.setIcon(resources.icon(icon)) if i == 0: category_btn.setChecked(True) self._buttons_grp.addButton(category_btn) self._categories_layout.addWidget(category_btn) category_widget = categorywidget.CategoryWidget( types=types, nodes_to_discard=nodes_to_discard) self._stack.addWidget(category_widget) # category_widget.doRefresh.connect(self._on_refresh_category) # category_widget.doPreview.connect(self._set_preview_names) # category_widget.togglePreview.connect(self.update_current_items) # category_widget.doRename.connect(self._on_rename) # category_btn.clicked.connect(partial(self._on_category_selected, i + 1)) self._auto_rename_widget.refresh() self._controller.update_rules()
def ui(self): super(VersionHistoryWidget, self).ui() self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self._btn_layout = layouts.HorizontalLayout() self._sync_btn = buttons.BaseButton('Sync', parent=self) self._sync_btn.setIcon(resources.icon('sync')) self._sync_btn.setMaximumWidth(100) self._sync_btn.setEnabled(False) self._btn_layout.addWidget(self._sync_btn) self._versions_tree = VersionHistoryTreeWidget(parent=self) self.main_layout.addWidget(self._versions_tree) self.main_layout.addLayout(self._btn_layout)
def search_engine(self, text='Search'): """ Adds a search push button to line edit :param text: str :return: self """ _suffix_btn = buttons.BaseButton(text).primary() _suffix_btn.clicked.connect(self.returnPressed) _suffix_btn.setFixedWidth(100) self.set_suffix_widget(_suffix_btn) self.setPlaceholderText('Enter keyword to search ...') return self