def createVersionWidget(self): """ Create a widget for selecting the version number for export. """ widget = QtGui.QWidget() layout = QtGui.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) widget.setLayout(layout) # Version custom versionSpinBox widget - allows user to specify padding versionToolTip = "Set the version number for files/scripts which include the {version} token in the path.\nThis box sets the version number string (#) in the form: v#, e.g. 01 > v01.\nUse the +/- to control padding e.g. v01 / v0001." versionLayout = QtGui.QHBoxLayout() versionLabel = QtGui.QLabel("Version token number:") layout.addWidget(versionLabel) versionSpinBox = hiero.ui.VersionWidget() versionSpinBox.setToolTip(versionToolTip) versionSpinBox.setValue(self._preset.properties()["versionIndex"]) versionSpinBox.setPadding(self._preset.properties()["versionPadding"]) versionSpinBox.setReadOnly( self.app.get_setting('disable_version_spinner')) versionSpinBox.valueChanged.connect(self.onVersionIndexChanged) versionSpinBox.paddingChanged.connect(self.onVersionPaddingChanged) layout.addWidget(versionSpinBox) layout.addStretch() return widget
def setupUi(self, AboutScreen): AboutScreen.setObjectName("AboutScreen") AboutScreen.resize(325, 385) AboutScreen.setMinimumSize(QtCore.QSize(320, 327)) self.verticalLayout = QtGui.QVBoxLayout(AboutScreen) self.verticalLayout.setSpacing(15) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.icon = QtGui.QLabel(AboutScreen) self.icon.setMinimumSize(QtCore.QSize(100, 100)) self.icon.setMaximumSize(QtCore.QSize(100, 100)) self.icon.setText("") self.icon.setPixmap(QtGui.QPixmap(":/tk-desktop/shotgun_logo.png")) self.icon.setScaledContents(True) self.icon.setObjectName("icon") self.horizontalLayout.addWidget(self.icon) self.verticalLayout.addLayout(self.horizontalLayout) self.header = QtGui.QLabel(AboutScreen) self.header.setStyleSheet("font-size: 16px;") self.header.setAlignment(QtCore.Qt.AlignCenter) self.header.setWordWrap(True) self.header.setObjectName("header") self.verticalLayout.addWidget(self.header) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.body = QtGui.QLabel(AboutScreen) self.body.setAlignment(QtCore.Qt.AlignCenter) self.body.setWordWrap(True) self.body.setObjectName("body") self.verticalLayout.addWidget(self.body) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem1) self.copyright = QtGui.QLabel(AboutScreen) self.copyright.setStyleSheet("font-size: 10px;") self.copyright.setAlignment(QtCore.Qt.AlignCenter) self.copyright.setWordWrap(True) self.copyright.setObjectName("copyright") self.verticalLayout.addWidget(self.copyright) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem2) self.buttonBox = QtGui.QDialogButtonBox(AboutScreen) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(False) self.buttonBox.setObjectName("buttonBox") self.horizontalLayout_2.addWidget(self.buttonBox) self.licensesButton = QtGui.QPushButton(AboutScreen) self.licensesButton.setObjectName("licensesButton") self.horizontalLayout_2.addWidget(self.licensesButton) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem3) self.verticalLayout.addLayout(self.horizontalLayout_2) self.retranslateUi(AboutScreen) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), AboutScreen.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), AboutScreen.reject) QtCore.QMetaObject.connectSlotsByName(AboutScreen)
def __init__(self, editor_widget, parent=None): """ Initialize the wrapper widget. :param editor_widget: The ``EDITOR`` widget instance :type editor_widget: :class:`~PySide.QtGui.QWidget` :param parent: The parent widget instance or None :type parent: :class:`~PySide.QtGui.QWidget` :return: """ super(_EditorWidget, self).__init__(parent) self._editor_widget = editor_widget self._editor_widget.setFocusPolicy(QtCore.Qt.StrongFocus) self._done_btn = QtGui.QPushButton() self._done_btn.setIcon(QtGui.QIcon(":/qtwidgets-shotgun-fields/edit_close.png")) self._done_btn.setFixedSize(QtCore.QSize(16, 16)) self._done_btn.setFocusPolicy(QtCore.Qt.NoFocus) self._apply_btn = QtGui.QPushButton() self._apply_btn.setIcon( QtGui.QIcon(":/qtwidgets-shotgun-fields/apply_value.png") ) self._apply_btn.setFixedSize(QtCore.QSize(16, 16)) self._apply_btn.setFocusPolicy(QtCore.Qt.NoFocus) # make sure there's never a bg color or border self._done_btn.setStyleSheet(BUTTON_STYLE) self._apply_btn.setStyleSheet(BUTTON_STYLE) if self._editor_widget.sizeHint().height() >= 32: btn_layout = QtGui.QVBoxLayout() btn_layout.addWidget(self._done_btn) btn_layout.addStretch() btn_layout.addWidget(self._apply_btn) else: btn_layout = QtGui.QHBoxLayout() btn_layout.addWidget(self._apply_btn) btn_layout.addWidget(self._done_btn) btn_layout.addStretch() if getattr(editor_widget, "_IMMEDIATE_APPLY", None): # widget is set to immediately apply value. no need to display the btn self._apply_btn.hide() layout = QtGui.QHBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(4) layout.addWidget(editor_widget) layout.addLayout(btn_layout) layout.addStretch() layout.setAlignment(self._done_btn, QtCore.Qt.AlignBottom) self.installEventFilter(self) # ---- connect singals self._done_btn.clicked.connect(lambda: self.done_editing.emit()) self._apply_btn.clicked.connect(self._apply_value)
def create_layout(self): # Create a main layout self.layout = QtGui.QVBoxLayout() # Create the widgets self.enable_notifications_checkbox = QtGui.QCheckBox( 'Enable Notifications') self.start_button = QtGui.QPushButton(self.START_TEXT) self.status_label = QtGui.QLabel('Status') self.status = QtGui.QLabel(self.STATUS_STOPPED) self.close_button = QtGui.QPushButton('Close') # Layout the status label and text self.status_layout = QtGui.QHBoxLayout() self.status_layout.addStretch(1) self.status_layout.addWidget(self.status_label, 0) self.status_layout.addWidget(self.status, 0) # Layout the close button self.footer_layout = QtGui.QHBoxLayout() self.footer_layout.addStretch(2) self.footer_layout.addWidget(self.close_button, 1) # Layout all the layout and widgets self.layout.addWidget(self.enable_notifications_checkbox, 0) self.layout.addWidget(self.start_button, 0) self.layout.addStretch(1) self.layout.addLayout(self.status_layout, 0) self.layout.addLayout(self.footer_layout, 0) # Set the main layout in the widget self.setLayout(self.layout)
def setupUi(self, EntityTreeForm): EntityTreeForm.setObjectName("EntityTreeForm") EntityTreeForm.resize(349, 367) self.verticalLayout = QtGui.QVBoxLayout(EntityTreeForm) self.verticalLayout.setSpacing(4) self.verticalLayout.setContentsMargins(2, 6, 2, 2) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setContentsMargins(2, -1, 2, 1) self.horizontalLayout.setObjectName("horizontalLayout") self.my_tasks_cb = QtGui.QCheckBox(EntityTreeForm) self.my_tasks_cb.setObjectName("my_tasks_cb") self.horizontalLayout.addWidget(self.my_tasks_cb) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.new_task_btn = QtGui.QPushButton(EntityTreeForm) self.new_task_btn.setObjectName("new_task_btn") self.horizontalLayout.addWidget(self.new_task_btn) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setContentsMargins(1, -1, 1, -1) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.search_ctrl = SearchWidget(EntityTreeForm) self.search_ctrl.setMinimumSize(QtCore.QSize(0, 20)) self.search_ctrl.setStyleSheet("#search_ctrl {\n" "background-color: rgb(255, 128, 0);\n" "}") self.search_ctrl.setObjectName("search_ctrl") self.horizontalLayout_2.addWidget(self.search_ctrl) self.verticalLayout.addLayout(self.horizontalLayout_2) self.entity_tree = QtGui.QTreeView(EntityTreeForm) self.entity_tree.setStyleSheet( "QTreeView::item {\n" "padding: 2px;\n" "}\n" "\n" "QTreeView::branch:has-children:!has-siblings:closed,\n" "QTreeView::branch:closed:has-children:has-siblings {\n" " border-image: none;\n" " image: url(:/ts_multi_workfiles2/tree_arrow_collapsed.png);\n" "}\n" " \n" "QTreeView::branch:open:has-children:!has-siblings,\n" "QTreeView::branch:open:has-children:has-siblings {\n" " border-image: none;\n" " image: url(:/ts_multi_workfiles2/tree_arrow_expanded.png);\n" "}") self.entity_tree.setEditTriggers( QtGui.QAbstractItemView.NoEditTriggers) self.entity_tree.setProperty("showDropIndicator", False) self.entity_tree.setIconSize(QtCore.QSize(20, 20)) self.entity_tree.setObjectName("entity_tree") self.entity_tree.header().setVisible(False) self.verticalLayout.addWidget(self.entity_tree) self.verticalLayout.setStretch(2, 1) self.retranslateUi(EntityTreeForm) QtCore.QMetaObject.connectSlotsByName(EntityTreeForm)
def __init__(self, parent=None): super(versionWidgetCombo, self).__init__(parent) self.versionDatas = [] self.pathToMovie = None self.masterLayout = QtGui.QVBoxLayout() self.masterLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.masterLayout) self.layout = QtGui.QHBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) titleLabel = QtGui.QLabel("Create Note", parent=self) #titleLabel.setStyleSheet("QLabel { background-color : red; color : blue; }"); font = QtGui.QFont("", 10, QtGui.QFont.Bold) titleLabel.setFont(font) titleLabel.setAlignment(QtCore.Qt.AlignCenter) self.masterLayout.addWidget(titleLabel) self.masterLayout.addLayout(self.layout) self.pic = loadingWidget(parent=self) # ####self.pic.setMaximumWidth(50) infoLayout = QtGui.QVBoxLayout() infoLayout.setAlignment(QtCore.Qt.AlignTop) self.layout.addLayout(infoLayout) self.layout.addStretch() self.layout.addWidget(self.pic, QtCore.Qt.AlignLeft) self.versionQtCombo = QtGui.QComboBox(parent=self) self.nameQt = QtGui.QLabel("", parent=self) self.userQt = QtGui.QLabel("", parent=self) self.dateQt = QtGui.QLabel("", parent=self) self.taskQt = QtGui.QLabel("", parent=self) comboLayout = QtGui.QHBoxLayout() comboLayout.setContentsMargins(0, 0, 0, 0) comboLayout.addWidget(QtGui.QLabel("Link to version : ", parent=self)) comboLayout.addWidget(self.versionQtCombo, QtCore.Qt.AlignLeft) infoLayout.addLayout(comboLayout) infoLayout.addWidget(self.nameQt) infoLayout.addWidget(self.userQt) infoLayout.addWidget(self.dateQt) infoLayout.addWidget(self.taskQt) infoLayout.addSpacing(100) #infoLayout.addStretch() infoLayout.setContentsMargins(0, 0, 0, 0) infoLayout.setSpacing(0) self.layout.addSpacing(5) self.versionQtCombo.currentIndexChanged.connect(self.setVersionValue)
def setupUi(self, PublishHistoryWidget): PublishHistoryWidget.setObjectName("PublishHistoryWidget") PublishHistoryWidget.resize(394, 93) self.horizontalLayout_3 = QtGui.QHBoxLayout(PublishHistoryWidget) self.horizontalLayout_3.setSpacing(1) self.horizontalLayout_3.setContentsMargins(1, 1, 1, 1) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.box = QtGui.QFrame(PublishHistoryWidget) self.box.setFrameShape(QtGui.QFrame.StyledPanel) self.box.setFrameShadow(QtGui.QFrame.Raised) self.box.setObjectName("box") self.horizontalLayout_2 = QtGui.QHBoxLayout(self.box) self.horizontalLayout_2.setSpacing(4) self.horizontalLayout_2.setContentsMargins(1, 2, 1, 2) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.thumbnail = QtGui.QLabel(self.box) self.thumbnail.setMinimumSize(QtCore.QSize(75, 75)) self.thumbnail.setMaximumSize(QtCore.QSize(75, 75)) self.thumbnail.setText("") self.thumbnail.setScaledContents(True) self.thumbnail.setAlignment(QtCore.Qt.AlignCenter) self.thumbnail.setObjectName("thumbnail") self.horizontalLayout_2.addWidget(self.thumbnail) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.header_label = QtGui.QLabel(self.box) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.header_label.sizePolicy().hasHeightForWidth()) self.header_label.setSizePolicy(sizePolicy) self.header_label.setObjectName("header_label") self.horizontalLayout.addWidget(self.header_label) self.button = QtGui.QToolButton(self.box) self.button.setPopupMode(QtGui.QToolButton.InstantPopup) self.button.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly) self.button.setObjectName("button") self.horizontalLayout.addWidget(self.button) self.verticalLayout.addLayout(self.horizontalLayout) self.body_label = QtGui.QLabel(self.box) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.body_label.sizePolicy().hasHeightForWidth()) self.body_label.setSizePolicy(sizePolicy) self.body_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.body_label.setWordWrap(True) self.body_label.setObjectName("body_label") self.verticalLayout.addWidget(self.body_label) self.horizontalLayout_2.addLayout(self.verticalLayout) self.horizontalLayout_3.addWidget(self.box) self.retranslateUi(PublishHistoryWidget) QtCore.QMetaObject.connectSlotsByName(PublishHistoryWidget)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(490, 618) self.verticalLayout = QtGui.QVBoxLayout(Dialog) self.verticalLayout.setObjectName("verticalLayout") self.browser = SceneBrowserWidget(Dialog) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.browser.sizePolicy().hasHeightForWidth()) self.browser.setSizePolicy(sizePolicy) self.browser.setObjectName("browser") self.verticalLayout.addWidget(self.browser) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setSpacing(3) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.groupBox = QtGui.QGroupBox(Dialog) self.groupBox.setTitle("") self.groupBox.setObjectName("groupBox") self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBox) self.horizontalLayout_2.setSpacing(10) self.horizontalLayout_2.setContentsMargins(2, 2, 2, 2) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label = QtGui.QLabel(self.groupBox) self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) self.chk_green = QtGui.QCheckBox(self.groupBox) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/res/green_bullet.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.chk_green.setIcon(icon) self.chk_green.setObjectName("chk_green") self.horizontalLayout_2.addWidget(self.chk_green) self.chk_red = QtGui.QCheckBox(self.groupBox) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/res/red_bullet.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.chk_red.setIcon(icon1) self.chk_red.setObjectName("chk_red") self.horizontalLayout_2.addWidget(self.chk_red) self.horizontalLayout_3.addWidget(self.groupBox) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.select_all = QtGui.QPushButton(Dialog) self.select_all.setObjectName("select_all") self.horizontalLayout_3.addWidget(self.select_all) self.update = QtGui.QPushButton(Dialog) self.update.setObjectName("update") self.horizontalLayout_3.addWidget(self.update) self.verticalLayout.addLayout(self.horizontalLayout_3) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, FileOpenForm): FileOpenForm.setObjectName("FileOpenForm") FileOpenForm.resize(956, 718) self.verticalLayout = QtGui.QVBoxLayout(FileOpenForm) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setSpacing(12) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.nav = NavigationWidget(FileOpenForm) self.nav.setMinimumSize(QtCore.QSize(80, 30)) self.nav.setStyleSheet("#history_btns {\n" "background-color: rgb(255, 128, 0);\n" "}") self.nav.setObjectName("nav") self.horizontalLayout_3.addWidget(self.nav) self.breadcrumbs = BreadcrumbWidget(FileOpenForm) self.breadcrumbs.setStyleSheet("#breadcrumbs {\n" "background-color: rgb(255, 128, 0);\n" "}") self.breadcrumbs.setObjectName("breadcrumbs") self.horizontalLayout_3.addWidget(self.breadcrumbs) self.horizontalLayout_3.setStretch(1, 1) self.verticalLayout.addLayout(self.horizontalLayout_3) self.browser = BrowserForm(FileOpenForm) self.browser.setStyleSheet("#browser {\n" "background-color: rgb(255, 128, 0);\n" "}") self.browser.setObjectName("browser") self.verticalLayout.addWidget(self.browser) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.new_file_btn = QtGui.QPushButton(FileOpenForm) self.new_file_btn.setObjectName("new_file_btn") # self.new_file_btn.setVisible(False) # <<<< self.horizontalLayout.addWidget(self.new_file_btn) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.cancel_btn = QtGui.QPushButton(FileOpenForm) self.cancel_btn.setObjectName("cancel_btn") self.horizontalLayout.addWidget(self.cancel_btn) self.open_btn = QtGui.QPushButton(FileOpenForm) self.open_btn.setStyleSheet("#open_btn {\n" "}") self.open_btn.setObjectName("open_btn") self.horizontalLayout.addWidget(self.open_btn) self.open_options_btn = QtGui.QPushButton(FileOpenForm) self.open_options_btn.setFlat(False) self.open_options_btn.setObjectName("open_options_btn") self.horizontalLayout.addWidget(self.open_options_btn) self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.setStretch(1, 1) self.retranslateUi(FileOpenForm) QtCore.QMetaObject.connectSlotsByName(FileOpenForm)
def setupUi(self, FileWidget): FileWidget.setObjectName("FileWidget") FileWidget.resize(291, 76) FileWidget.setStyleSheet("") self.horizontalLayout = QtGui.QHBoxLayout(FileWidget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.background = QtGui.QFrame(FileWidget) self.background.setFrameShape(QtGui.QFrame.StyledPanel) self.background.setFrameShadow(QtGui.QFrame.Plain) self.background.setLineWidth(2) self.background.setProperty("selected", True) self.background.setObjectName("background") self.horizontalLayout_2 = QtGui.QHBoxLayout(self.background) self.horizontalLayout_2.setContentsMargins(4, 4, 4, 4) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.thumbnail = QtGui.QLabel(self.background) self.thumbnail.setMinimumSize(QtCore.QSize(96, 64)) self.thumbnail.setMaximumSize(QtCore.QSize(96, 64)) self.thumbnail.setStyleSheet("") self.thumbnail.setText("") self.thumbnail.setTextFormat(QtCore.Qt.AutoText) self.thumbnail.setPixmap( QtGui.QPixmap(":/tk-multi-workfiles2/thumb_empty.png")) self.thumbnail.setScaledContents(True) self.thumbnail.setAlignment(QtCore.Qt.AlignCenter) self.thumbnail.setObjectName("thumbnail") self.horizontalLayout_2.addWidget(self.thumbnail) self.details_frame = QtGui.QFrame(self.background) self.details_frame.setObjectName("details_frame") self.verticalLayout = QtGui.QVBoxLayout(self.details_frame) self.verticalLayout.setSpacing(2) self.verticalLayout.setObjectName("verticalLayout") spacerItem = QtGui.QSpacerItem(20, 0, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.label = ElidedLabel(self.details_frame) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.subtitle = QtGui.QLabel(self.details_frame) self.subtitle.setObjectName("subtitle") self.verticalLayout.addWidget(self.subtitle) spacerItem1 = QtGui.QSpacerItem(20, 0, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem1) self.verticalLayout.setStretch(0, 1) self.verticalLayout.setStretch(3, 1) self.horizontalLayout_2.addWidget(self.details_frame) self.horizontalLayout_2.setStretch(1, 1) self.horizontalLayout.addWidget(self.background) self.retranslateUi(FileWidget) QtCore.QMetaObject.connectSlotsByName(FileWidget)
def __init__(self, parent=None): """ Initialize the demo widget. """ # call the base class init super(HelpScreenPopupDemo, self).__init__(parent) # get a handle on the current toolkit bundle (the demo app). the help # screen popup dialog uses this to link back to documentation as well as # logging. self._app = sgtk.platform.current_bundle() # a label with info about how the show method works show_lbl = QtGui.QLabel( "Click the button below to call the <tt>show_help_screen()</tt> " "method. This method accepts a list of <tt>650x400</tt> " "<tt>QPixmap</tt>s to display in a series of slides.") show_lbl.setWordWrap(True) # a button to trigger the help screen popup show_btn = QtGui.QPushButton("show_help_screen()") show_btn.clicked.connect(self._on_show_btn_clicked) btn_layout = QtGui.QHBoxLayout() btn_layout.addStretch() btn_layout.addWidget(show_btn) btn_layout.addStretch() # lay out the widgets layout = QtGui.QVBoxLayout(self) layout.addStretch() layout.addWidget(show_lbl) layout.addLayout(btn_layout) layout.addStretch()
def __init__(self, filter_id, group_id, filter_data, parent=None): """ Constructor. Initialize the widget UI: - Add a SearchWidget :param filter_id: The unique identifier for this widget. :type filter_id: str :param group_id: The unique identifier for the group this widget belongs to. :type group_id: str :param filter_data: Additional data to initialize the widget. :type filter_data: dict :param parent: The widget's parent :type parent: :class:`sgtk.platform.qt.QWidget` """ super(TextFilterItemWidget, self).__init__(filter_id, group_id, parent=parent) self._name = filter_data.get("display_name", "") self.line_edit = search_widget.SearchWidget(self) self.line_edit.search_edited.connect(self.value_changed.emit) layout = QtGui.QHBoxLayout() layout.setAlignment(QtCore.Qt.AlignLeft) layout.addWidget(self.line_edit) self.setLayout(layout)
def __setup_ui(self): """ Creates and lays out all the Qt widgets :return: """ layout = QtGui.QVBoxLayout() layout.setAlignment(QtCore.Qt.AlignLeft) self.setLayout(layout) # Create a check box to hold the state of whether we should set the task in review. self.review_cbx = QtGui.QCheckBox("Set task to in review") # Create a Combobox to list and chose the reviewers. self.reviewer_cmbx = QtGui.QComboBox() self.reviewer_cmbx.setAccessibleName("Reviewer selection dropdown") self.reviewer_lbl = QtGui.QLabel("Select reviewer") self.reviewer_layout = QtGui.QHBoxLayout() self.reviewer_layout.addWidget(self.reviewer_cmbx) self.reviewer_layout.addWidget(self.reviewer_lbl) sp = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Maximum) self.review_cbx.setSizePolicy(sp) self.reviewer_cmbx.setSizePolicy(sp) layout.addWidget(self.review_cbx) layout.setAlignment(self.review_cbx, QtCore.Qt.AlignLeft) layout.addLayout(self.reviewer_layout)
def __init__(self, parent=None): """ Initialize the demo widget. """ # call the base class init super(OverlayDemo, self).__init__(parent) parent_widget = self._create_overlay_parent_widget() # create the overlay and parent it to the widget it should sit on top of overlay_widget = overlay.ShotgunOverlayWidget(parent_widget) # ---- create some buttons to demo the methods # shows the overlay widget and starts the spinner. typically this would # be called just before starting a long/blocking process start_spin = OverlayButton("start_spin()") start_spin.clicked.connect(overlay_widget.start_spin) # shows a given message in the overlay show_message = OverlayButton("show_message()") show_message.clicked.connect(lambda: overlay_widget.show_message( "Showing this message in the overlay widget.\n" "The underlying label is now covered by the overlay.\n\n" "You can even use <a href='https://www.shotgridsoftware.com'>hyperlinks</a>!" )) # shows a pixmap in the overlay show_message_pixmap = OverlayButton("show_message_pixmap()") show_message_pixmap.clicked.connect( lambda: overlay_widget.show_message_pixmap( QtGui.QPixmap(":/tk_multi_demo_overlay/toolkit_icon.png"))) # shows a given error message in the overlay show_error_message = OverlayButton("show_error_message()") show_error_message.clicked.connect( lambda: overlay_widget.show_error_message( "Showing this error message in the overlay widget.\nNote the " "show_message() and show_message_pixmap() calls won't work " "when this is displayed.\n\n" "You can even use <a href='https://www.shotgridsoftware.com'>hyperlinks</a>!" )) # hides the overlay hide = OverlayButton("hide()") # Wrap inside a lambda or PySide2 will pass False to the hide method in Python 3. hide.clicked.connect(lambda: overlay_widget.hide()) # lay out and align the widgets button_layout = QtGui.QHBoxLayout() button_layout.addWidget(start_spin) button_layout.addWidget(show_message) button_layout.addWidget(show_message_pixmap) button_layout.addWidget(show_error_message) button_layout.addWidget(hide) layout = QtGui.QVBoxLayout(self) layout.addWidget(parent_widget) layout.addLayout(button_layout)
def __init__(self, environment, parent): super(EnvPermissions, self).__init__(parent) self.state = { 'environment': environment, } self.save_button = QtGui.QPushButton('Save') self.cancel_button = QtGui.QPushButton('Cancel') # Layout widgets button_layout = QtGui.QHBoxLayout() button_layout.addWidget(self.save_button) button_layout.addWidget(self.cancel_button) self.layout = QtGui.QVBoxLayout() self.layout.addWidget(QtGui.QLabel('Restrict to Users')) self.layout.addLayout(button_layout) self.setLayout(self.layout) # Connect widgets self.save_button.clicked.connect(self.on_save_clicked) self.cancel_button.clicked.connect(self.on_cancel_clicked) self.setWindowTitle('Environment Permissions') self.setWindowIcon(QtGui.QIcon(res.get_path('icon_dark_256.png'))) shotgun_fields = sgtk.platform.import_framework( "tk-framework-qtwidgets", "shotgun_fields", ) self._fields_manager = shotgun_fields.ShotgunFieldManager(self) self._fields_manager.initialized.connect(self.on_initialized) self._fields_manager.initialize()
def setupUi(self, BannerWidget): BannerWidget.setObjectName("BannerWidget") BannerWidget.resize(618, 71) self.horizontalLayout = QtGui.QHBoxLayout(BannerWidget) self.horizontalLayout.setContentsMargins(6, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.message = QtGui.QLabel(BannerWidget) self.message.setStyleSheet("border-style: outset;\n" "border-color: rgb(0, 0, 0);") self.message.setWordWrap(True) self.message.setOpenExternalLinks(False) self.message.setObjectName("message") self.horizontalLayout.addWidget(self.message) self.close_button = QtGui.QToolButton(BannerWidget) self.close_button.setStyleSheet("border: none;") self.close_button.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/tk-desktop/cross.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.close_button.setIcon(icon) self.close_button.setIconSize(QtCore.QSize(30, 30)) self.close_button.setObjectName("close_button") self.horizontalLayout.addWidget(self.close_button) self.retranslateUi(BannerWidget) QtCore.QMetaObject.connectSlotsByName(BannerWidget)
def __init__(self, display_widget, parent=None): """ Initialize the widget. :param display_widget: The ``DISPLAY`` widget instance :type display_widget: :class:`~PySide.QtGui.QWidget` :param parent: The parent widget or ``None`` :type parent: :class:`~PySide.QtGui.QWidget` """ super(ShotgunFieldNotEditable, self).__init__(parent) self._display_widget = display_widget # this is the "no edit" label that will show on hover self._no_edit_lbl = QtGui.QLabel(self) self._no_edit_lbl.setPixmap( QtGui.QPixmap(":/qtwidgets-shotgun-fields/not_editable.png")) self._no_edit_lbl.setFixedSize(QtCore.QSize(16, 16)) self._no_edit_lbl.hide() spacer = QtGui.QWidget() spacer.setFixedHeight(self._no_edit_lbl.height()) spacer.setFixedWidth(4) layout = QtGui.QHBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) layout.addWidget(display_widget) layout.addWidget(spacer) layout.addWidget(self._no_edit_lbl) layout.addStretch(10) self.installEventFilter(self)
def _populate_ui(self): """ Build the UI. """ vlayout = QtGui.QVBoxLayout() info = QtGui.QLabel( "Click the icons to toggle between inactive and active states (if available). Hover to see more information about each icon." ) vlayout.addWidget(info) hlayout = QtGui.QHBoxLayout(self) for icon_data in self._icons: # Create a QToolButton to show the icon tb = QtGui.QToolButton(self) tb.setIcon(icon_data["icon"]()) tb.setCheckable(True) tooltip = "Create using: SGQIcon.{name}())".format( name=icon_data["icon"].__name__, ) tb.setToolTip(tooltip) hlayout.addWidget(tb) hlayout.addStretch() icons_widget = QtGui.QWidget(self) icons_widget.setLayout(hlayout) vlayout.addWidget(icons_widget) vlayout.addStretch() self.setLayout(vlayout)
def add_checkable(self, item): """ Add a checkable UI element to the main layout and add Copy or Export radiobutton options. Save the radiobutton group in row_button_grp_dict for later access. :param item: item for the checkable elements """ row_idx = self.channel_layout.count() reuse_rb = QtGui.QRadioButton(self.reuse_text) export_rb = QtGui.QRadioButton(self.export_text) export_rb.setChecked(True) radio_button_layout = QtGui.QHBoxLayout() radio_button_layout.addWidget(reuse_rb) radio_button_layout.addWidget(export_rb) group_box = QtGui.QGroupBox(item.name) group_box.setMaximumHeight(55) group_box.setLayout(radio_button_layout) group_box.setCheckable(True) button_group = QtGui.QButtonGroup(radio_button_layout) button_group.addButton(reuse_rb) button_group.addButton(export_rb) # save the button group for later access self.row_button_grp_dict[row_idx] = button_group self.channel_layout.addWidget(group_box)
def setupUi(self, BrowserForm): BrowserForm.setObjectName("BrowserForm") BrowserForm.resize(982, 616) self.horizontalLayout = QtGui.QHBoxLayout(BrowserForm) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.splitter = QtGui.QSplitter(BrowserForm) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.task_browser_tabs = QtGui.QTabWidget(self.splitter) self.task_browser_tabs.setMinimumSize(QtCore.QSize(200, 0)) self.task_browser_tabs.setObjectName("task_browser_tabs") self.file_browser_tabs = QtGui.QTabWidget(self.splitter) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.file_browser_tabs.sizePolicy().hasHeightForWidth()) self.file_browser_tabs.setSizePolicy(sizePolicy) self.file_browser_tabs.setObjectName("file_browser_tabs") self.horizontalLayout.addWidget(self.splitter) self.retranslateUi(BrowserForm) self.file_browser_tabs.setCurrentIndex(-1) QtCore.QMetaObject.connectSlotsByName(BrowserForm)
def __init__(self, parent = None ) : QtGui.QWidget.__init__(self, parent) lay = QtGui.QHBoxLayout() lay.setContentsMargins(0,0,0,0) lay.setSpacing(0) self.writeTo = ToDoLineEdit("who ?") self.writeWhat = ToDoLineEdit("what ?") self.sendButton = QtGui.QPushButton() self.sendButton.setIcon(QtGui.QIcon(getRessources("sendNotification") )) self.sendButton.setFlat(True); self.sendButton.setIconSize(QtCore.QSize(20,20)); style = 'QPushButton:hover{border: 1px solid rgb(48,226,227)}' self.sendButton.setStyleSheet("QPushButton{outline: none;}"+style); self.sendButton.notificationAttr = True lay.addWidget(self.writeTo) lay.addSpacing(5) lay.addWidget(self.writeWhat) lay.addSpacing(5) lay.addWidget(self.sendButton) self.setLayout(lay) self.writeTo.setMaximumWidth(150)
def __init__(self, parent=None): super(Console, self).__init__(parent) self.setWindowTitle('Shotgun Desktop Console') self.setWindowIcon(QtGui.QIcon(":/tk-desktop/default_systray_icon.png")) self.__logs = QtGui.QPlainTextEdit() layout = QtGui.QHBoxLayout() layout.addWidget(self.__logs) self.setLayout(layout) # configure the text widget self.__logs.setReadOnly(True) self.__logs.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.__logs.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) self.__logs.customContextMenuRequested.connect(self.on_logs_context_menu_request) self.__logs.setStyleSheet("QPlainTextEdit:focus { border: none; }") # load up previous size self._settings_manager = settings.UserSettings(sgtk.platform.current_bundle()) pos = self._settings_manager.retrieve("console.pos", self.pos(), self._settings_manager.SCOPE_GLOBAL) size = self._settings_manager.retrieve( "console.size", QtCore.QSize(800, 400), self._settings_manager.SCOPE_GLOBAL) self.move(pos) self.resize(size)
def __init__(self, title, data, parent=None): super(EnvDisplay, self).__init__(parent=parent) self.data = data self.tree = EnvTree('environ', self.data) self.ok_button = QtGui.QPushButton('Ok') self.ok_button.setSizePolicy( QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum, ) self.ok_button.clicked.connect(self.accept) self.copy_button = QtGui.QPushButton( icon=QtGui.QIcon(res.get_path('copy.png')), text='Copy to Clipboard', ) self.copy_button.clicked.connect(self.copy_to_clipboard) self.button_layout = QtGui.QHBoxLayout() self.button_layout.setDirection(self.button_layout.RightToLeft) self.button_layout.addWidget(self.ok_button) self.button_layout.addWidget(self.copy_button) self.button_layout.addStretch() self.layout = QtGui.QVBoxLayout() self.layout.addWidget(self.tree) self.layout.addLayout(self.button_layout) self.setLayout(self.layout) self.setWindowTitle(title) self.setWindowIcon(QtGui.QIcon(res.get_path('icon_dark_256.png')))
def createItem(self, asset_name, path, current_name): listWidgetItem = QtGui.QListWidgetItem() listWidgetItem.setSizeHint(QtCore.QSize(200, 80)) itemWidget = QtGui.QWidget() vLayout = QtGui.QVBoxLayout(itemWidget) vLayout.setSpacing(3) hLayout = QtGui.QHBoxLayout() hLayout.setSpacing(25) asset_name_label = QtGui.QLabel() asset_name_label.setText(asset_name) asset_name_label.setObjectName('asset_name') asset_name_label.setTextInteractionFlags( QtCore.Qt.TextSelectableByMouse) asset_name_label.setMinimumWidth(260) current_name_le = QtGui.QLineEdit() current_name_le.setFixedHeight(23) current_name_le.setText(current_name) path_label = QtGui.QLabel() path_label.setText(path) path_label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) hLayout.addWidget(asset_name_label) hLayout.addWidget(current_name_le) vLayout.addLayout(hLayout) vLayout.addWidget(path_label) self.listwidget.addItem(listWidgetItem) self.listwidget.setItemWidget(listWidgetItem, itemWidget) widgets = { 'asset_name': asset_name_label, 'current_name': current_name_le, 'path': path_label } listWidgetItem.setData(QtCore.Qt.UserRole, widgets) current_name_le.textChanged.connect( lambda *args: self._update_path(listWidgetItem))
def __init__(self, parent): """ Construction """ QtGui.QWidget.__init__(self, parent) # set up the UI self._ui = Ui_FileWidget() self._ui.setupUi(self) # store the app to use when calling hooks self._app = sgtk.platform.current_bundle() # create the status icons and add them to a layout over the main thumbnail: self._publish_icon = QtGui.QLabel(self) self._publish_icon.setMinimumSize(16, 16) self._publish_icon.setAlignment(QtCore.Qt.AlignCenter) self._publish_icon.setPixmap( QtGui.QPixmap(":/tk-multi-workfiles2/publish_icon.png")) self._publish_icon.hide() # not sure I like this - think I preferred it when it was over on the right of the tile! self._lock_icon = QtGui.QLabel(self) self._lock_icon.setMinimumSize(16, 16) self._lock_icon.setAlignment(QtCore.Qt.AlignCenter) self._lock_icon.setPixmap( QtGui.QPixmap(":/tk-multi-workfiles2/padlock.png")) self._lock_icon.hide() rhs_layout = QtGui.QVBoxLayout() rhs_layout.setContentsMargins(0, 0, 0, 0) rhs_layout.setSpacing(0) rhs_layout.addWidget(self._lock_icon) rhs_layout.addStretch(1) rhs_layout.addWidget(self._publish_icon) # A hook-defined badge (upper left) self._badge_icon = QtGui.QLabel(self) self._badge_icon.setMinimumSize(16, 16) self._badge_icon.setAlignment(QtCore.Qt.AlignCenter) self._badge_icon.hide() lhs_layout = QtGui.QVBoxLayout() lhs_layout.setContentsMargins(0, 0, 0, 0) lhs_layout.setSpacing(0) lhs_layout.addStretch(1) lhs_layout.addWidget(self._badge_icon) thumb_layout = QtGui.QHBoxLayout(self._ui.thumbnail) thumb_layout.setContentsMargins(4, 4, 4, 4) thumb_layout.setSpacing(0) thumb_layout.addLayout(lhs_layout) thumb_layout.addStretch() thumb_layout.addLayout(rhs_layout) self._ui.thumbnail.setLayout(thumb_layout) self._is_selected = False self._update_ui()
def setupUi(self, MyTasksForm): MyTasksForm.setObjectName("MyTasksForm") MyTasksForm.resize(359, 541) self.verticalLayout = QtGui.QVBoxLayout(MyTasksForm) self.verticalLayout.setSpacing(4) self.verticalLayout.setContentsMargins(2, 6, 2, 2) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setContentsMargins(2, -1, 2, 1) self.horizontalLayout.setObjectName("horizontalLayout") self.filter_btn = QtGui.QToolButton(MyTasksForm) self.filter_btn.setStyleSheet("") self.filter_btn.setPopupMode(QtGui.QToolButton.MenuButtonPopup) self.filter_btn.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.filter_btn.setAutoRaise(False) self.filter_btn.setObjectName("filter_btn") self.horizontalLayout.addWidget(self.filter_btn) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.new_task_btn = QtGui.QPushButton(MyTasksForm) self.new_task_btn.setObjectName("new_task_btn") self.horizontalLayout.addWidget(self.new_task_btn) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setContentsMargins(1, -1, 1, -1) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.search_ctrl = SearchWidget(MyTasksForm) self.search_ctrl.setMinimumSize(QtCore.QSize(0, 20)) self.search_ctrl.setStyleSheet("#search_ctrl {\n" "background-color: rgb(255, 128, 0);\n" "}") self.search_ctrl.setObjectName("search_ctrl") self.horizontalLayout_2.addWidget(self.search_ctrl) self.verticalLayout.addLayout(self.horizontalLayout_2) self.task_tree = QtGui.QTreeView(MyTasksForm) self.task_tree.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.task_tree.setProperty("showDropIndicator", False) self.task_tree.setRootIsDecorated(False) self.task_tree.setObjectName("task_tree") self.task_tree.header().setVisible(False) self.verticalLayout.addWidget(self.task_tree) self.verticalLayout.setStretch(2, 1) self.retranslateUi(MyTasksForm) QtCore.QMetaObject.connectSlotsByName(MyTasksForm)
def __init__(self, parent=None): """Initialize the widget. :param parent: This widget's parent widget :type parent: :class:`~PySide.QtGui.QWidget` """ super(BubbleWidget, self).__init__(parent) # placeholder for the underlying data this widget represents in the editor self._data = None # should not grow or shrink self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) # style the look of the bubble self.setObjectName("bubble") self.setStyleSheet(""" #bubble { border: 1px solid black; border-radius: 5px; background-color: %s; } """ % self.palette().color(QtGui.QPalette.Button).name()) # create a remove button for the widget. # extract a close button icon from the style and use it self.remove_button = QtGui.QPushButton(self) style = self.remove_button.style() icon = style.standardIcon(style.SP_TitleBarCloseButton) self.remove_button.setIcon(icon) self.remove_button.setFlat(True) self.remove_button.setStyleSheet("border: none") # placeholder for the bubble's image self.image_label = QtGui.QLabel(self) # color the text to use the SG highlight color text_color = QtGui.QColor(sgtk.platform.current_bundle(). style_constants["SG_HIGHLIGHT_COLOR"]) self.text_label = QtGui.QLabel(self) palette = self.text_label.palette() palette.setColor(QtGui.QPalette.WindowText, text_color) self.text_label.setPalette(palette) # layout the widgets self.layout = QtGui.QHBoxLayout() self.layout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) self.layout.setContentsMargins(3, 1, 3, 1) self.layout.setSpacing(2) self.layout.addWidget(self.image_label, QtCore.Qt.AlignVCenter) self.layout.addWidget(self.text_label, QtCore.Qt.AlignVCenter) self.layout.addWidget(self.remove_button, QtCore.Qt.AlignVCenter) self.setLayout(self.layout) # emit the "remove_clicked" signal when the button is clicked. self.remove_button.clicked.connect(lambda: self.remove_clicked.emit())
def _load_software_icons(self, engine, project=None): """ Displays thumbnails downloaded from Software entities for a specified Project in the ui.icon_rows layout. :param engine: Toolkit engine instance. :param project: Shotgun Project instance or None """ # Get the list of Software entities for this Project from Shotgun sg_softwares = self._get_sg_software_entities(engine, project) if not sg_softwares: return # Clear out any existing icons self._clear_icons() # Arrange the icons in a grid with self._icon_column_count # columns and N rows based on the total number of icons col_num = 0 icon_row_layout = None last_software = len(sg_softwares) - 1 for i in range(len(sg_softwares)): # Download the thumbnail source file from Shotgun, which preserves # transparency and alpha values. sg_icon = shotgun_data.ShotgunDataRetriever.download_thumbnail_source( sg_softwares[i]["type"], sg_softwares[i]["id"], engine) if not sg_icon: engine.logger.warning( "Could not download thumbnail for %s entity [%s]" % (sg_softwares[i]["type"], sg_softwares[i]["id"])) continue # Create a label and set its pixmap to the downloaded # thumbnail scaled to self._icon_size. qt_label = QtGui.QLabel(self) qt_label.setPixmap( QtGui.QPixmap(sg_icon).scaled( self._icon_size, mode=QtCore.Qt.SmoothTransformation)) # Add the label to this widget, constructing necessary # layouts as needed. if col_num == 0: icon_row_layout = QtGui.QHBoxLayout() icon_row_layout.setSpacing(self._icon_layout_spacing) icon_row_layout.addStretch(self._icon_layout_stretch) icon_row_layout.addWidget(qt_label) col_num += 1 if col_num == self._icon_column_count or i == last_software: icon_row_layout.addStretch(self._icon_layout_stretch) self.ui.icon_rows.addLayout(icon_row_layout) col_num = 0 # Set the spacing on the parent layout so the icons appear # evenly spaced out. self.ui.icon_rows.setSpacing(self._icon_layout_spacing)
def __init__(self, parent): super(EnvImporter, self).__init__(parent) self.state = { 'projects': None, 'project': None, 'environments': None, 'environment': None, } # Can't get this search widget to work right... # search = sgtk.platform.import_framework( # "tk-framework-qtwidgets", # "shotgun_search_widget", # ) # self.project_search = search.GlobalSearchWidget(self) # self.project_search.set_searchable_entity_types({'Project': []}) # self.project_search.set_placeholder_text('Search for Project') # self.project_search.entity_activated.connect(self.on_entity_activated) # Create widgets self.project_search = QtGui.QComboBox() self.env_list = QtGui.QComboBox() self.engine = QtGui.QLineEdit() self.engine.setReadOnly(True) self.engine.setFocusPolicy(QtCore.Qt.NoFocus) self.req_list = QtGui.QListWidget() self.import_button = QtGui.QPushButton('Import') self.cancel_button = QtGui.QPushButton('Cancel') # Layout widgets button_layout = QtGui.QHBoxLayout() button_layout.addWidget(self.import_button) button_layout.addWidget(self.cancel_button) layout = QtGui.QVBoxLayout() layout.addWidget(QtGui.QLabel('Project')) layout.addWidget(self.project_search) layout.addWidget(QtGui.QLabel('Environment')) layout.addWidget(self.env_list) layout.addWidget(QtGui.QLabel('Engine')) layout.addWidget(self.engine) layout.addWidget(QtGui.QLabel('Requires')) layout.addWidget(self.req_list) layout.addLayout(button_layout) self.setLayout(layout) # Connect widgets self.project_search.activated.connect(self.on_project_changed) self.env_list.activated.connect(self.on_env_changed) self.import_button.clicked.connect(self.on_import_clicked) self.cancel_button.clicked.connect(self.on_cancel_clicked) self.setWindowTitle('Import Environments') self.setWindowIcon(QtGui.QIcon(res.get_path('icon_dark_256.png'))) self.update_projects()
def __init__(self, parent): super(RecentList, self).__init__(parent, QtGui.QHBoxLayout()) self._layout.setSpacing(3) # Fill the recents list with invisible stretchers to start with. # Then as the actual recent items start to get populated the # stretchers will be replaced. for _ in range(MAX_RECENTS): self._layout.addStretch()