Beispiel #1
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)
Beispiel #3
0
    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)
Beispiel #4
0
    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()
Beispiel #5
0
    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)
Beispiel #6
0
    def ui(self):
        super(OpenProjectWidget, self).ui()

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

        self._projects_list = ProjectViewer(project_class=self._project_class)
        self._projects_list.setSizePolicy(QSizePolicy.Expanding,
                                          QSizePolicy.Expanding)

        buttons_layout = layouts.HorizontalLayout(spacing=0,
                                                  margins=(0, 0, 0, 0))
        buttons_layout.setAlignment(Qt.AlignCenter)

        buttons_layout1 = layouts.HorizontalLayout(spacing=0,
                                                   margins=(0, 0, 0, 0))
        buttons_layout1.setAlignment(Qt.AlignLeft)
        self._browse_widget = directory.SelectFolder(
            label_text='Projects Path', use_app_browser=True, use_icon=True)
        buttons_layout1.addWidget(self._browse_widget)

        buttons_layout.addLayout(buttons_layout1)

        self.main_layout.addWidget(self._search_widget)
        self.main_layout.addWidget(
            dividers.Divider('PROJECTS', alignment=Qt.AlignCenter))
        self.main_layout.addWidget(self._projects_list)
        self.main_layout.addLayout(buttons_layout)
Beispiel #7
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)
Beispiel #8
0
    def ui(self):

        self.color_buttons = list()

        super(BaseColorDialog, self).ui()

        grid_layout = layouts.GridLayout()
        grid_layout.setAlignment(Qt.AlignTop)
        self.main_layout.addLayout(grid_layout)
        color_index = 0
        for i in range(0, 4):
            for j in range(0, 8):
                color_btn = QPushButton()
                color_btn.setMinimumHeight(35)
                color_btn.setMinimumWidth(35)
                self.color_buttons.append(color_btn)
                color_btn.setStyleSheet(
                    'background-color:rgb(%s,%s,%s);' %
                    (self.maya_colors[color_index][0] * 255,
                     self.maya_colors[color_index][1] * 255,
                     self.maya_colors[color_index][2] * 255))
                grid_layout.addWidget(color_btn, i, j)
                color_index += 1
        selected_color_layout = layouts.HorizontalLayout()
        self.main_layout.addLayout(selected_color_layout)
        self.color_slider = QSlider(Qt.Horizontal)
        self.color_slider.setMinimum(0)
        self.color_slider.setMaximum(31)
        self.color_slider.setValue(2)
        self.color_slider.setStyleSheet(
            "QSlider::groove:horizontal {border: 1px solid #999999;height: 25px; /* the groove expands "
            "to the size of the slider by default. by giving it a height, it has a fixed size */background: "
            "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);margin: 2px 0;}"
            "QSlider::handle:horizontal {background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4,"
            " stop:1 #8f8f8f);border: 1px solid #5c5c5c;width: 10px;margin: -2px 0; /* handle is placed by "
            "default on the contents rect of the groove. Expand outside the groove */border-radius: 1px;}"
        )
        selected_color_layout.addWidget(self.color_slider)

        color_label_layout = layouts.HorizontalLayout(margins=(10, 10, 10, 10))
        self.main_layout.addLayout(color_label_layout)

        self.color_lbl = QLabel()
        self.color_lbl.setStyleSheet(
            "border: 1px solid black; background-color:rgb(0, 0, 0);")
        self.color_lbl.setMinimumWidth(45)
        self.color_lbl.setMaximumWidth(80)
        self.color_lbl.setMinimumHeight(80)
        self.color_lbl.setAlignment(Qt.AlignCenter)
        color_label_layout.addWidget(self.color_lbl)

        bottom_layout = layouts.HorizontalLayout()
        bottom_layout.setAlignment(Qt.AlignRight)
        self.main_layout.addLayout(bottom_layout)

        self.ok_btn = QPushButton('Ok')
        self.cancel_btn = QPushButton('Cancel')
        bottom_layout.addLayout(dividers.DividerLayout())
        bottom_layout.addWidget(self.ok_btn)
        bottom_layout.addWidget(self.cancel_btn)
Beispiel #9
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)))
Beispiel #10
0
    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()
Beispiel #11
0
    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)
Beispiel #12
0
    def ui(self):
        super(SpinBoxExample, self).ui()

        class_list = [
            spinbox.BaseSpinBox, spinbox.BaseDoubleSpinBox,
            datetime.BaseDateTimeEdit, datetime.BaseDateEdit,
            datetime.BaseTimeEdit
        ]

        for cls in class_list:
            self.main_layout.addWidget(dividers.Divider(cls.__name__))
            lyt = layouts.HorizontalLayout()
            lyt.addWidget(cls().small())
            lyt.addWidget(cls().medium())
            lyt.addWidget(cls().large())
            self.main_layout.addLayout(lyt)

        extra_spinners_lyt1 = layouts.HorizontalLayout()
        spn1 = spinbox.BaseSpinBoxNumber(parent=self)
        spn2 = spinbox.BaseDoubleNumberSpinBox(parent=self)

        extra_spinners_lyt2 = layouts.HorizontalLayout()
        spn3 = spinbox.DragDoubleSpinBox(parent=self)
        spn4 = spinbox.DragDoubleSpinBoxLine(parent=self)

        extra_spinners_lyt1.addWidget(spn1)
        extra_spinners_lyt1.addWidget(spn2)
        extra_spinners_lyt2.addWidget(spn3)
        extra_spinners_lyt2.addWidget(spn4)

        self.main_layout.addWidget(dividers.Divider('Extra Base'))
        self.main_layout.addLayout(extra_spinners_lyt1)

        self.main_layout.addWidget(dividers.Divider('Draggable'))
        self.main_layout.addLayout(extra_spinners_lyt2)

        self.main_layout.addWidget(dividers.Divider('Pop calendar widget'))
        date_time_edit = datetime.BaseDateTimeEdit()
        date_time_edit.setCalendarPopup(True)
        date_edit = datetime.BaseDateEdit()
        date_edit.setCalendarPopup(True)
        time_edit = datetime.BaseTimeEdit()
        time_edit.setCalendarPopup(True)
        date_lyt = layouts.HorizontalLayout()
        date_lyt.addWidget(date_time_edit)
        date_lyt.addWidget(time_edit)
        date_lyt.addWidget(date_edit)
        self.main_layout.addLayout(date_lyt)
        self.main_layout.addStretch()
Beispiel #13
0
    def ui(self):
        super(RadioButtonExample, self).ui()

        folder_icon = tpDcc.ResourcesMgr().icon('folder')
        play_icon = tpDcc.ResourcesMgr().icon('play')
        user_icon = tpDcc.ResourcesMgr().icon('user')

        lyt1 = layouts.HorizontalLayout()
        lyt1.addWidget(buttons.BaseRadioButton('Maya'))
        lyt1.addWidget(buttons.BaseRadioButton('Nuke'))
        lyt1.addWidget(buttons.BaseRadioButton('Houdini'))

        cbx_single = buttons.BaseRadioButton('Single')
        cbx_single.setChecked(True)
        cbx_single.setEnabled(False)

        lyt2 = layouts.HorizontalLayout()
        cbx_icon1 = buttons.BaseRadioButton('Folder')
        cbx_icon1.setIcon(folder_icon)
        cbx_icon2 = buttons.BaseRadioButton('Play')
        cbx_icon2.setIcon(play_icon)
        cbx_icon3 = buttons.BaseRadioButton('User')
        cbx_icon3.setIcon(user_icon)
        lyt2.addWidget(cbx_icon1)
        lyt2.addWidget(cbx_icon2)
        lyt2.addWidget(cbx_icon3)

        cbx_bind = buttons.BaseRadioButton('Data Bind')
        lbl = label.BaseLabel()
        btn = buttons.BaseButton(text='Change State')
        btn.clicked.connect(
            lambda: self.set_field('checked', not self.field('checked')))
        self.register_field('checked', True)
        self.register_field('checked_text', lambda: 'Yes!'
                            if self.field('checked') else 'No!')
        self.bind('checked', cbx_bind, 'checked', signal='toggled')
        self.bind('checked_text', lbl, 'text')

        self.main_layout.addWidget(dividers.Divider('Basic'))
        self.main_layout.addLayout(lyt1)
        self.main_layout.addWidget(cbx_single)
        self.main_layout.addWidget(dividers.Divider('Icon'))
        self.main_layout.addLayout(lyt2)
        self.main_layout.addWidget(dividers.Divider('Data Bind'))
        self.main_layout.addWidget(cbx_bind)
        self.main_layout.addWidget(lbl)
        self.main_layout.addWidget(btn)
        self.main_layout.addStretch()
Beispiel #14
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)
Beispiel #15
0
    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(FallofCurveWidget, self).ui()

        base_rect = QRect(0, 0, self._base_size, self._base_size)

        self._scene = CurveNodeScene(base_rect)
        self._scene.base_size = self._base_size
        self._view = CurveNodeView(parent=self)
        self._view.setScene(self._scene)
        self._view.setGeometry(base_rect)

        self._menu_bar = QMenuBar(self)
        self._menu_bar.addAction(self._scene.undo_action)
        self._menu_bar.addAction(self._scene.redo_action)

        bottom_layout = layouts.HorizontalLayout(spacing=2, margins=(2, 2, 2, 2))
        self._bezier_type_combo = combobox.BaseComboBox(parent=self)
        self._snap_cbx = checkbox.BaseCheckBox('Snap', parent=self)
        bottom_layout.addWidget(self._bezier_type_combo)
        bottom_layout.addWidget(self._snap_cbx)

        self.main_layout.addWidget(self._menu_bar)
        self.main_layout.addWidget(dividers.Divider(parent=self))
        self.main_layout.addWidget(self._view)
        self.main_layout.addWidget(dividers.Divider(parent=self))
        self.main_layout.addLayout(bottom_layout)
Beispiel #17
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)
Beispiel #18
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)
Beispiel #19
0
    def get_main_layout(self):
        main_layout = layouts.HorizontalLayout()
        main_layout.setAlignment(Qt.AlignRight)
        main_layout.setSpacing(0)
        main_layout.setContentsMargins(0, 0, 0, 0)

        return main_layout
    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)
Beispiel #21
0
    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)
Beispiel #22
0
    def createWidget(self, menu):
        """
        Overrides base QWidgetAction createWidget function
        :param menu: QMenu
        """

        widget = QFrame(self.parent())
        widget.setObjectName('filterByAction')
        title = self._name
        label = checkbox.BaseCheckBox(parent=widget)
        label.setText(title)
        label.setAttribute(Qt.WA_TransparentForMouseEvents)
        label.toggled.connect(self._on_triggered)
        label.setStyleSheet("""
        #QCheckBox::indicator:checked {
            image: url(none.png)
        }
        QCheckBox::indicator:unchecked {
            image: url(none.png)
        }
        """)
        action_layout = layouts.HorizontalLayout(margins=(0, 0, 0, 0))
        action_layout.addWidget(label, stretch=1)
        widget.setLayout(action_layout)

        return widget
Beispiel #23
0
    def __init__(self, parent=None):
        super(ContainerWidget, self).__init__(parent)

        layout = layouts.HorizontalLayout(spacing=0, margins=(0, 0, 0, 0))
        self.setLayout(layout)

        self.containedWidget = None
Beispiel #24
0
    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
Beispiel #25
0
    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(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)
Beispiel #27
0
    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()
Beispiel #28
0
    def ui(self):
        super(SlidersExample, self).ui()

        slider1 = sliders.BaseSlider(orientation=Qt.Horizontal)
        slider1.setRange(1, 100)
        slider2 = sliders.BaseSlider(orientation=Qt.Vertical)
        slider2.setRange(1, 100)

        lyt3 = layouts.HorizontalLayout()
        spin_box = spinbox.BaseSpinBox()
        spin_box.setRange(1, 100)
        btn_grp = group.PushButtonGroup()
        btn_grp.set_button_list([{
            'text': '+',
            'clicked': partial(self._on_change_value, 10)
        }, {
            'text': '-',
            'clicked': partial(self._on_change_value, -10)
        }])
        lyt3.addWidget(spin_box)
        lyt3.addWidget(btn_grp)
        lyt3.addStretch()

        self.register_field('percent', 20)
        self.bind('percent', spin_box, 'value', signal='valueChanged')
        self.bind('percent', slider1, 'value')
        self.bind('percent', slider2, 'value')

        self.main_layout.addWidget(dividers.Divider('different orientation'))
        self.main_layout.addWidget(slider1)
        self.main_layout.addWidget(slider2)
        self.main_layout.addWidget(dividers.Divider('data bind'))
        self.main_layout.addLayout(lyt3)
    def ui(self):
        super(ProjectSettingsWidget, self).ui()

        image_layout = layouts.HorizontalLayout(spacing=2,
                                                margins=(2, 2, 2, 2))
        image_layout.setContentsMargins(2, 2, 2, 2)
        image_layout.setSpacing(2)
        self.main_layout.addLayout(image_layout)
        self._project_image = QLabel()
        self._project_image.setAlignment(Qt.AlignCenter)
        image_layout.addStretch()
        image_layout.addWidget(self._project_image)
        image_layout.addStretch()

        self._settings_tab = tabs.BaseTabWidget(parent=self)
        self.main_layout.addWidget(self._settings_tab)

        self._naming_widget = NamingWidget(project=self._project)
        self._project_options_widget = rigoptionsviewer.RigOptionsViewer(
            option_object=self._project, parent=self)
        self._external_code_widget = ExternalCodeDirectoryWidget(parent=self)
        version_control_widget = QWidget(parent=self)
        version_control_layout = layouts.VerticalLayout(spacing=0,
                                                        margins=(2, 2, 2, 2))
        version_control_widget.setLayout(version_control_layout)
        self._version_type_combo = combobox.BaseComboBox(parent=self)
        version_control_layout.addWidget(self._version_type_combo)
        version_control_layout.addStretch()

        self._settings_tab.addTab(self._project_options_widget, 'Settings')
        self._settings_tab.addTab(self._naming_widget, 'Nomenclature')
        self._settings_tab.addTab(version_control_widget, 'Version Control')
        self._settings_tab.addTab(self._external_code_widget, 'External Code')

        bottom_layout = layouts.VerticalLayout(spacing=2, margins=(2, 2, 2, 2))
        bottom_layout.setAlignment(Qt.AlignBottom)
        self.main_layout.addLayout(bottom_layout)
        bottom_layout.addLayout(dividers.DividerLayout())

        buttons_layout = layouts.HorizontalLayout(spacing=2,
                                                  margins=(2, 2, 2, 2))
        bottom_layout.addLayout(buttons_layout)

        ok_icon = resources.icon('ok')
        self._ok_btn = buttons.BaseButton(parent=self)
        self._ok_btn.setIcon(ok_icon)
        buttons_layout.addWidget(self._ok_btn)
Beispiel #30
0
    def __init__(self, separator=None, parent=None):
        super(BreadcrumbFrame, self).__init__(parent)

        self.setObjectName('TaskFrame')
        self.setFrameStyle(QFrame.StyledPanel)

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

        self._breadcrumb = BreadcrumbWidget(separator=separator, parent=self)

        title_layout = layouts.HorizontalLayout()
        title_layout.addStretch()
        title_layout.addWidget(self._breadcrumb)
        title_layout.addStretch()

        main_layout.addLayout(title_layout)