def ui(self): super(JointsLabelDialog, self).ui() name_label = label.BaseLabel('Specify label sides', parent=self) left_side_label = label.BaseLabel('Left Side: ', parent=self) self._left_side_line = lineedit.BaseLineEdit(parent=self) right_side_label = label.BaseLabel('Right Side: ', parent=self) self._right_side_line = lineedit.BaseLineEdit(parent=self) info_widget = message.BaseMessage( 'You can disable auto joint label in tool\n button options (right click on it', parent=self).info() grid_layout = layouts.GridLayout() grid_layout.addWidget(name_label, 0, 0, 1, 2) grid_layout.addWidget(left_side_label, 1, 0, Qt.AlignRight) grid_layout.addWidget(self._left_side_line, 1, 1) grid_layout.addWidget(right_side_label, 2, 0, Qt.AlignRight) grid_layout.addWidget(self._right_side_line, 2, 1) self._button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.main_layout.addLayout(grid_layout) self.main_layout.addWidget(dividers.Divider()) self.main_layout.addWidget(self._button_box) self.main_layout.addWidget(dividers.Divider()) self.main_layout.addWidget(info_widget)
def ui(self): super(MetaCard, self).ui() self._title_layout = layouts.HorizontalLayout() self._cover_label = QLabel() self._cover_label.setFixedSize(QSize(200, 200)) self._avatar = avatar.Avatar() self._title_label = label.BaseLabel().h4() self._description_label = label.BaseLabel().secondary() self._description_label.setWordWrap(True) self._description_label.theme_elide_mode = Qt.ElideRight self._extra_btn = buttons.BaseToolButton( parent=self).image('more').icon_only() self._title_layout.addWidget(self._title_label) self._title_layout.addStretch() self._title_layout.addWidget(self._extra_btn) self._extra_btn.setVisible(self._extra) content_lyt = layouts.FormLayout(margins=(5, 5, 5, 5)) content_lyt.addRow(self._avatar, self._title_layout) content_lyt.addRow(self._description_label) self._btn_lyt = layouts.HorizontalLayout() self.main_layout.addWidget(self._cover_label) self.main_layout.addLayout(content_lyt) self.main_layout.addLayout(self._btn_lyt) self.main_layout.addStretch()
def ui(self): super(LoadingExample, self).ui() size_lyt = layouts.HorizontalLayout() size_list = [('Tiny', loading.CircleLoading.tiny), ('Small', loading.CircleLoading.small), ('Medium', loading.CircleLoading.medium), ('Large', loading.CircleLoading.large), ('Huge', loading.CircleLoading.huge)] for lbl, load_widget in size_list: size_lyt.addWidget(label.BaseLabel(lbl)) size_lyt.addWidget(load_widget(parent=self)) size_lyt.addSpacing(10) color_lyt = layouts.HorizontalLayout() color_list = [ ('cyan', '#13c2c2'), ('green', '#52c41a'), ('magenta', '#eb2f96'), ('red', '#f5222d'), ('yellow', '#fadb14'), ('volcano', '#fa541c'), ] for lbl, load_color in color_list: color_lyt.addWidget(label.BaseLabel(lbl)) color_lyt.addWidget( loading.CircleLoading(color=load_color, parent=self)) color_lyt.addSpacing(10) self.main_layout.addWidget(dividers.Divider('different size')) self.main_layout.addLayout(size_lyt) self.main_layout.addWidget(dividers.Divider('different color')) self.main_layout.addLayout(color_lyt)
def __init__(self, *args): super(StatusWidget, self).__init__(*args) self._status = None self._blocking = False self._timer = QTimer(self) self.setObjectName('StatusWidget') self.setFrameShape(QFrame.NoFrame) self.setFixedHeight(19) self.setMinimumWidth(5) self._label = label.BaseLabel('', parent=self) self._label.setStyleSheet('background-color: transparent;') self._label.setCursor(Qt.IBeamCursor) self._label.setTextInteractionFlags(Qt.TextSelectableByMouse) self._label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) self.label_image = label.BaseLabel(parent=self) self.label_image.setMaximumSize(QSize(17, 17)) self.label_image.hide() self.main_layout = QHBoxLayout(self) self.main_layout.setContentsMargins(1, 0, 0, 0) self.main_layout.addWidget(self.label_image) self.main_layout.addWidget(self._label) self.setLayout(self.main_layout) self._timer.timeout.connect(self._reset) # Force set to initialize default status Qt property self.status = ''
def ui(self): super(LineTabExample, self).ui() tab_center = tabs.MenuLineTabWidget() tab_center.add_tab(label.BaseLabel('test 1 ' * 10), {'text': u'Tab 1', 'image': 'user'}) tab_center.add_tab(label.BaseLabel('test 2 ' * 10), {'image': 'calendar'}) tab_center.add_tab(label.BaseLabel('test 3 ' * 10), u'Tab 3') tab_center.tool_button_group.theme_checked = False tab_left = tabs.MenuLineTabWidget(alignment=Qt.AlignLeft) tab_left.add_tab(label.BaseLabel('test 1 ' * 10), u'Tab 1') tab_left.add_tab(label.BaseLabel('test 2 ' * 10), u'Tab 2') tab_left.add_tab(label.BaseLabel('test 3 ' * 10), u'Tab 3') tab_left.tool_button_group.theme_checked = False tab_right = tabs.MenuLineTabWidget(alignment=Qt.AlignRight) tab_right.add_tab(label.BaseLabel('test 1 ' * 10), u'Tab 1') tab_right.add_tab(label.BaseLabel('test 2 ' * 10), u'Tab 2') tab_right.add_tab(label.BaseLabel('test 3 ' * 10), u'Tab 3') tab_right.tool_button_group.theme_checked = False self.main_layout.addWidget(dividers.Divider('Center')) self.main_layout.addWidget(tab_center) self.main_layout.addSpacing(20) self.main_layout.addWidget(dividers.Divider('Left')) self.main_layout.addWidget(tab_left) self.main_layout.addSpacing(20) self.main_layout.addWidget(dividers.Divider('Right')) self.main_layout.addWidget(tab_right) self.main_layout.addStretch()
def _on_open_button_2(self): custom_widget = base.BaseWidget() custom_widget.main_layout.addWidget( label.BaseLabel('Some contentes ...')) custom_widget.main_layout.addWidget( label.BaseLabel('Some contentes ...')) custom_widget.main_layout.addWidget( label.BaseLabel('Some contentes ...')) slider_panel = panel.SliderPanel('Basic Panel', parent=self) slider_panel.position = self._button_grp.get_button_group( ).checkedButton().text() slider_panel.setFixedWidth(200) slider_panel.set_widget(custom_widget) slider_panel.show()
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(DictItemWidget, self).ui() current_theme = self.theme() separator_color = current_theme.accent_color if current_theme else '#E2AC2C' separator = "<span style='color:{}'> ▸ </span>".format( separator_color) self._entry_str = text.TextWidget() self._entry_str.set_use_button(False) if self._name is not None: self._entry_str.set_text(self._name) self._entry_str.set_placeholder('Set a key name') self._value_str = text.TextWidget() self._value_str.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self._value_str.set_use_button(False) if self._value is not None: self._value_str.set_text(str(self._value)) self._value_str.set_placeholder('Set a value') self._remove_btn = buttons.BaseToolButton().image('delete').icon_only() self.main_layout.addWidget(self._entry_str) self.main_layout.addWidget(label.BaseLabel(separator).secondary()) self.main_layout.addWidget(self._value_str) self.main_layout.addSpacing(10) self.main_layout.addWidget(self._remove_btn)
def __init__(self, parent, factor, main_color=None, *args, **kwargs): super(HoudiniInputDragger, self).__init__(*args, **kwargs) self._parent = parent self._factor = factor self._main_color = main_color if main_color else QColor(215, 128, 26).getRgb() self._size = 35 self.setAttribute(Qt.WA_Hover) self.setStyleSheet(self._get_style_sheet()) self.setMinimumHeight(self._size) self.setMinimumWidth(self._size) self.setMaximumHeight(self._size) self.setMaximumWidth(self._size) main_layout = layouts.VerticalLayout(margins=(0, 0, 0, 0)) self.setLayout(main_layout) frame_layout = layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0)) self._frame = QGroupBox() self._frame.setLayout(frame_layout) main_layout.addWidget(self._frame) self._label = label.BaseLabel('+' + str(factor), parent=self) font = self._label.font() font.setPointSize(7) self._label.setFont(font) self._label.setAlignment(Qt.AlignCenter) frame_layout.addWidget(self._label) self.installEventFilter(self) self._label.installEventFilter(self)
def __init__(self, name='', parent=None): super(SeparatorAction, self).__init__(parent) self._widget = SeparatorWidgetAction(parent) self._label = label.BaseLabel(name, parent=self._widget) self._line = SeparatorLine(self._widget) self._line.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
def ui(self): super(GetVector3FloatWidget, self).ui() self._label = label.BaseLabel(self._name) self._label.setAlignment(Qt.AlignRight) self._label.setMinimumWidth(75) self._label.setAttribute(Qt.WA_TransparentForMouseEvents) self._x_spinbox = spinbox.DragDoubleSpinBoxLineAxis(axis='x', min=-9999, max=9999, parent=self) self._y_spinbox = spinbox.DragDoubleSpinBoxLineAxis(axis='y', min=-9999, max=9999, parent=self) self._z_spinbox = spinbox.DragDoubleSpinBoxLineAxis(axis='z', min=-9999, max=9999, parent=self) self.main_layout.addWidget(self._label) self.main_layout.addWidget(self._x_spinbox) self.main_layout.addWidget(self._y_spinbox) self.main_layout.addWidget(self._z_spinbox)
def createWidget(self, menu): """ Overrides base QWidgetAction createWidget function :param menu: QMenu :return: QWidget """ widget = QFrame(self.parent()) widget.setObjectName('filterByAction') facet = self._facet name = facet.get('name', '') count = str(facet.get('count', 0)) title = name.replace('.', '').title() cbx = checkbox.BaseCheckBox(parent=widget) cbx.setAttribute(Qt.WA_TransparentForMouseEvents) cbx.setText(title) cbx.installEventFilter(self) cbx.setChecked(self._checked) label2 = label.BaseLabel(parent=widget) label2.setObjectName('actionCounter') label2.setText(count) layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0)) layout.addWidget(cbx, stretch=1) layout.addWidget(label2) widget.setLayout(layout) cbx.toggled.connect(self._on_triggered) return widget
def add_item(self, data_dict, index=None): """ Adds a new item to the breadcrumb :param data_dict: dict :param index: int """ btn = buttons.BaseToolButton() btn.setText(data_dict.get('text')) if data_dict.get('image'): btn.image(data_dict.get('image')) if data_dict.get('tooltip'): btn.setProperty('toolTip', data_dict.get('tooltip')) if data_dict.get('clicked'): btn.clicked.connect(data_dict.get('clicked')) if data_dict.get('text'): if data_dict.get('svg') or data_dict.get('icon'): btn.text_beside_icon() else: btn.text_only() else: btn.icon_only() if self._button_group.buttons(): separator = label.BaseLabel(self._separator).secondary() self._separators.append(separator) self.main_layout.insertWidget(self.main_layout.count() - 1, separator) self.main_layout.insertWidget(self.main_layout.count() - 1, btn) if index is None: self._button_group.addButton(btn) else: self._button_group.addButton(btn, index)
def ui(self): super(GetDictWidget, self).ui() self._label = label.BaseLabel(self._name) self._dict_widget = DictWidget() self.main_layout.addWidget(self._label) self.main_layout.addWidget(self._dict_widget)
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(GetControlRigWidget, self).ui() self._label = label.BaseLabel(self._name) self._label.setAttribute(Qt.WA_TransparentForMouseEvents) self._control = ControlLineEdit(self._rig) self.main_layout.addWidget(self._label) self.main_layout.addWidget(self._control)
def ui(self): super(GetListWidget, self).ui() self._label = label.BaseLabel(self._name) self._label.setAttribute(Qt.WA_TransparentForMouseEvents) self._list_widget = self.get_list_widget() self.main_layout.addWidget(self._label) self.main_layout.addWidget(self._list_widget)
def __init__(self, text=None, shadow=True, orientation=Qt.Horizontal, alignment=Qt.AlignLeft, parent=None): """ Basic standard splitter with optional text :param str text: Optional text to include as title in the splitter :param bool shadow: True if you want a shadow above the splitter :param Qt.Orientation orientation: Orientation of the splitter :param Qt.Align alignment: Alignment of the splitter :param QWidget parent: Parent of the splitter """ super(Divider, self).__init__(parent=parent) self._orient = orientation self._text = None main_layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0)) self.setLayout(main_layout) self._label = label.BaseLabel().strong(True) first_line = QFrame() self._second_line = QFrame() main_layout.addWidget(first_line) main_layout.addWidget(self._label) main_layout.addWidget(self._second_line) if orientation == Qt.Horizontal: first_line.setFrameShape(QFrame.HLine) first_line.setFrameShadow(QFrame.Sunken) first_line.setFixedHeight( 2) if shadow else first_line.setFixedHeight(1) self._second_line.setFrameShape(QFrame.HLine) self._second_line.setFrameShadow(QFrame.Sunken) self._second_line.setFixedHeight( 2) if shadow else self._second_line.setFixedHeight(1) else: self._label.setVisible(False) self._second_line.setVisible(False) first_line.setFrameShape(QFrame.VLine) first_line.setFrameShadow(QFrame.Plain) self.setFixedWidth(2) first_line.setFixedWidth( 2) if shadow else first_line.setFixedWidth(1) main_layout.setStretchFactor(first_line, self._ALIGN_MAP.get(alignment, 50)) main_layout.setStretchFactor(self._second_line, 100 - self._ALIGN_MAP.get(alignment, 50)) self.set_text(text)
def _add_template_token(self, template_token_name, template_token_description=None): """ Adds template token to layout :param template_token_name: str :param template_token_data: dict """ row = 0 while self.template_tokens_layout.itemAtPosition(row, 0) is not None: row += 1 self.template_tokens_layout.addWidget( label.BaseLabel(template_token_name), row, 0) self.template_tokens_layout.addWidget( label.BaseLabel(template_token_description if template_token_description else '< NOT FOUND >', parent=self), row, 1)
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(DataRepositoryWidget, self).ui() version_control_layout = layouts.HorizontalLayout() version_control_label = label.BaseLabel('Version Control', parent=None) self._version_type_combo = combobox.BaseComboBox(parent=self) version_control_layout.addWidget(version_control_label) version_control_layout.addWidget(self._version_type_combo) self.main_layout.addLayout(version_control_layout) self.main_layout.addStretch()
def ui(self): super(BaseNumberWidget, self).ui() self._number_widget = self.get_number_widget() self._number_label = label.BaseLabel(self._name, parent=self) self._number_label.setAlignment(Qt.AlignRight) self._number_label.setMinimumWidth(75) self._number_label.setAttribute(Qt.WA_TransparentForMouseEvents) if not self._name: self._number_label.hide() self._value_label = label.BaseLabel('value', parent=self) self._value_label.setAlignment(Qt.AlignRight) self._value_label.setMinimumWidth(75) self._value_label.setAttribute(Qt.WA_TransparentForMouseEvents) self._value_label.hide() self.main_layout.addWidget(self._number_label) self.main_layout.addSpacing(5) self.main_layout.addWidget(self._value_label, alignment=Qt.AlignRight) self.main_layout.addWidget(self._number_widget)
def __init__(self, name="", parent=None): super(SliderAction, self).__init__(parent) self._widget = SliderWidgetAction(parent) self._label = label.BaseLabel(name, parent=self._widget) self._slider = sliders.BaseSlider(Qt.Horizontal, parent=self._widget) self._slider.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.valueChanged = self._slider.valueChanged
def ui(self): super(MenuTabWidgetExample, self).ui() item_list = [{ 'text': 'Overview', 'image': 'home', 'clicked': partial(message.PopupMessage.info, 'A', parent=self) }, { 'text': 'B', 'image': 'user', 'clicked': partial(message.PopupMessage.info, 'B', parent=self) }, { 'text': 'Notice', 'image': 'notification', 'clicked': partial(message.PopupMessage.info, 'C', parent=self) }] tool_bar = tabs.MenuTabWidget() tool_bar.insert_widget( label.BaseLabel('Hello World!').h4().secondary().strong()) tool_bar.append_widget( badge.Badge.create_dot(show=True, widget=buttons.BaseToolButton().image( 'user').icon_only().large(), parent=self)) self._content_widget = label.BaseLabel() for index, data_dict in enumerate(item_list): tool_bar.add_menu(data_dict, index) tool_bar.tool_btn_grp.checked = False self.main_layout.addWidget(tool_bar) self.main_layout.addWidget(self._content_widget)
def ui(self): super(BadgeExample, self).ui() avatar_pixmap = tpDcc.ResourcesMgr().pixmap('user') standalone_lyt = layouts.HorizontalLayout() standalone_lyt.addWidget(badge.Badge.create_count(0, parent=self)) standalone_lyt.addWidget(badge.Badge.create_count(20, parent=self)) standalone_lyt.addWidget(badge.Badge.create_count(100, parent=self)) standalone_lyt.addWidget(badge.Badge.create_dot(True, parent=self)) standalone_lyt.addWidget(badge.Badge.create_text('new', parent=self)) standalone_lyt.addStretch() btn = buttons.BaseToolButton().image('trash') new_avatar = avatar.Avatar.large(avatar_pixmap) btn_alert = buttons.BaseToolButton().image('notification').large() badge1 = badge.Badge.create_dot(True, widget=btn, parent=self) badge2 = badge.Badge.create_dot(True, widget=new_avatar, parent=self) self._badge3 = badge.Badge.create_dot(True, widget=btn_alert, parent=self) btn.clicked.connect(lambda: badge1._set_dot(False)) spin_box = spinbox.BaseSpinBox() spin_box.setRange(0, 9999) spin_box.valueChanged.connect(self._on_set_count) spin_box.setValue(1) self.register_field('button1_selected', 'A') menu1 = menu.BaseMenu() menu1.set_data(['A', 'B', 'C', 'D']) select1 = combobox.BaseComboBox() select1.set_menu(menu1) self.bind('button1_selected', select1, 'value', signal='valueChanged') badge_hot = badge.Badge.create_text('hot', widget=label.BaseLabel('Hello Badge '), parent=self) sub_lyt1 = layouts.HorizontalLayout() sub_lyt1.addWidget(badge1) sub_lyt1.addWidget(badge2) sub_lyt1.addWidget(self._badge3) sub_lyt1.addStretch() sub_lyt2 = layouts.HorizontalLayout() sub_lyt2.addWidget(badge_hot) sub_lyt2.addWidget(select1) sub_lyt2.addStretch() self.main_layout.addWidget(dividers.Divider('use standalone')) self.main_layout.addLayout(standalone_lyt) self.main_layout.addWidget(dividers.Divider('different type')) self.main_layout.addLayout(sub_lyt1) self.main_layout.addWidget(spin_box) self.main_layout.addWidget(dividers.Divider('different type')) self.main_layout.addLayout(sub_lyt2) self.main_layout.addStretch()
def _add_color_widget(self, color_name, color_value): color_label = label.BaseLabel('{}: '.format( color_name.replace('_', ' ').title()), parent=self) color_button = qt_color.ColorSelector(parent=self) color_button.setProperty('color_attribute', color_name) # color_button.setProperty('tooltip_help', {'title': 'Color', 'description': 'This is a color'}) color_button.set_color(QColor(color_value)) color_button.colorChanged.connect( partial(self._on_color_changed, color_name)) self._color_buttons.append(color_button) return color_label, color_button
def __init__(self, *args, **kwargs): super(ImageFieldWidget, self).__init__(*args, **kwargs) self._value = '' self._pixmap = None widget = label.BaseLabel(parent=self) widget.setObjectName('widget') self.setStyleSheet('min-height: 32px;') widget.setScaledContents(False) widget.setAlignment(Qt.AlignHCenter) self.set_widget(widget) self.layout().addStretch()
def ui(self): super(ComboWidget, self).ui() self._label = label.BaseLabel(self._name) self._label.setAlignment(Qt.AlignRight) self._label.setMinimumWidth(75) self._label.setAttribute(Qt.WA_TransparentForMouseEvents) self._combo_widget = combobox.BaseComboBox() self._combo_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.main_layout.addWidget(self._label) self.main_layout.addWidget(self._combo_widget)
def ui(self): super(ToolsetHelpWidget, self).ui() self.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) self._image_label = label.BaseLabel(parent=self) self._title_label = label.BaseLabel(parent=self).strong() self._description_text = QPlainTextEdit(parent=self) # self._description_text.setFrameShape(QFrame.NoFrame) self._description_text.setMinimumWidth(200) self._description_text.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self._gif_label = gif.GifLabel(parent=self) self._gif_label.set_size(256, 256) self.main_layout.addWidget(self._title_label) self.main_layout.addWidget(dividers.Divider()) body_layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0)) body_layout.addWidget(self._description_text) body_layout.addWidget(self._gif_label) body_layout.addWidget(self._image_label) body_layout.addStretch() self.main_layout.addLayout(body_layout)
def ui(self): super(MetaDataManager, self).ui() base_layout = layouts.HorizontalLayout(spacing=0, margins=( 0, 0, 0, )) reg_mclasses_layout = layouts.VerticalLayout(spacing=2, margins=(2, 2, 2, 2)) reg_mclasses_lbl = label.BaseLabel('Registered MetaNodes', parent=self) reg_mclasses_lbl.setAlignment(Qt.AlignCenter) reg_mclasses_list = views.ListView() self._reg_mclasses_model = models.ListModel() reg_mclasses_list.setModel(self._reg_mclasses_model) reg_mclasses_layout.addWidget(reg_mclasses_lbl) reg_mclasses_layout.addWidget(reg_mclasses_list) base_layout.addLayout(reg_mclasses_layout) curr_mnodes_layout = layouts.VerticalLayout(spacing=2, margins=(2, 2, 2, 2)) curr_mnodes_lbl = label.BaseLabel('Current MetaNodes', parent=self) curr_mnodes_lbl.setAlignment(Qt.AlignCenter) curr_mnodes_table = QTableView() curr_mnodes_table.verticalHeader().hide() nodes_headers = ['ID', 'MetaNode'] self._curr_mnodes_model = models.TableModel( horizontal_headers=nodes_headers) curr_mnodes_table.setModel(self._curr_mnodes_model) curr_mnodes_layout.addWidget(curr_mnodes_lbl) curr_mnodes_layout.addWidget(curr_mnodes_table) base_layout.addLayout(curr_mnodes_layout) self.main_layout.addLayout(base_layout) self._update_ui()