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, parent=None): super(GraphTypeDialog, self).__init__(parent) layout = QtGui.QVBoxLayout(self) self.graph_lbl = QtGui.QLabel("Graph Type:") self.graph_type_cmb = QtGui.QComboBox() self.graph_type_cmb.addItems(["Substance", "MDL Material"]) self.vspc1 = QtGui.QSpacerItem(20, 5, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.graph_name = QtGui.QLabel("Graph Name:") self.graph_name_edt = QtGui.QLineEdit("New Graph") self.vspc2 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) layout.addWidget(self.graph_lbl) layout.addWidget(self.graph_type_cmb) layout.addItem(self.vspc1) layout.addWidget(self.graph_name) layout.addWidget(self.graph_name_edt) layout.addItem(self.vspc2) # OK and Cancel buttons buttons = QtGui.QDialogButtonBox( QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self, ) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons)
def __init__(self, parent=None): super(ProgressDialog, self).__init__(parent) # Window options self.setWindowTitle('tk-cpenv') self.setWindowIcon(QtGui.QIcon(res.get_path('module_dark_256.png'))) self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) self.hide_timer = None # Layout widgets self.label = QtGui.QLabel('Starting...') self.progress = QtGui.QProgressBar() self.progress.setRange(0, 100) self.progress.setTextVisible(True) self.progress.setAlignment(QtCore.Qt.AlignCenter) self.progress.setFormat('starting') self.frame = QtGui.QLabel() self.button = QtGui.QPushButton('Cancel') self.button.setSizePolicy( QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum, ) self.button.clicked.connect(self.cancel) self.layout = QtGui.QVBoxLayout() self.layout.addWidget(self.label) self.layout.addWidget(self.progress) self.layout.addWidget(self.frame) self.layout.addWidget(self.button) self.layout.setAlignment(self.button, QtCore.Qt.AlignRight) self.setLayout(self.layout)
def update_extra_tokens_widgets(self, template, missing_keys): missing_keys_dict = {} for key in missing_keys: if key in template.keys: keyObj = template.keys[key] missing_keys_dict[key] = keyObj parent = self.ui.extraTokensWidget parent_lay = self.ui.extraTokensWidgetLayout self.clear_extra_token_widgets() keys = missing_keys_dict.keys() keys.sort() row_cnt = 0 if not keys: label = QtGui.QLabel('No Extra Keys found...', parent=parent) parent_lay.addWidget(label, row_cnt, 0) else: for key in keys: label = QtGui.QLabel(str(key), parent=parent) lineedit = QtGui.QLineEdit(str(missing_keys_dict[key].default), parent=parent) lineedit.data = missing_keys_dict[key] # Not ideal to store to object, but QLabel has no data storage method lineedit.editingFinished.connect(self.update_template_file_path) parent_lay.addWidget(label, row_cnt, 0) parent_lay.addWidget(lineedit, row_cnt, 1) row_cnt += 1
def setupUi(self, ThumbWidget): ThumbWidget.setObjectName("ThumbWidget") ThumbWidget.resize(542, 453) self.verticalLayout_2 = QtGui.QVBoxLayout(ThumbWidget) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.widget_frame = QtGui.QFrame(ThumbWidget) self.widget_frame.setMouseTracking(True) self.widget_frame.setFrameShape(QtGui.QFrame.NoFrame) self.widget_frame.setFrameShadow(QtGui.QFrame.Plain) self.widget_frame.setLineWidth(0) self.widget_frame.setObjectName("widget_frame") self.widget_frame_layout = QtGui.QVBoxLayout(self.widget_frame) self.widget_frame_layout.setSpacing(10) self.widget_frame_layout.setContentsMargins(15, 15, 15, 15) self.widget_frame_layout.setObjectName("widget_frame_layout") self.thumbnail = QtGui.QLabel(self.widget_frame) self.thumbnail.setMouseTracking(True) self.thumbnail.setPixmap(QtGui.QPixmap(":/tk-desktop/loading_512x400.png")) self.thumbnail.setScaledContents(False) self.thumbnail.setAlignment(QtCore.Qt.AlignCenter) self.thumbnail.setObjectName("thumbnail") self.widget_frame_layout.addWidget(self.thumbnail) self.label = QtGui.QLabel(self.widget_frame) self.label.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop) self.label.setWordWrap(True) self.label.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.label.setObjectName("label") self.widget_frame_layout.addWidget(self.label) self.verticalLayout_2.addWidget(self.widget_frame) self.retranslateUi(ThumbWidget) QtCore.QMetaObject.connectSlotsByName(ThumbWidget)
def __init__(self, parent, description_widget=None): QtGui.QWidget.__init__(self, parent) layout = QtGui.QVBoxLayout(self) ## Export Name Label self.export_label = QtGui.QLabel(self) self.export_label.setText("Export Name") layout.addWidget(self.export_label) ## Line edit self.editLine = QtGui.QLineEdit(self) layout.addWidget(self.editLine) ## Version Label self.version_label = QtGui.QLabel(self) self.version_label.setText("Publish Version") layout.addWidget(self.version_label) self.version_number = QtGui.QSpinBox(self) self.version_number.setMinimum(0) self.version_number.setMaximum(100) layout.addWidget(self.version_number) self.setLayout(layout)
def __init__(self, parent=None): """ Initialize the widget. """ # call the base class init super(HelpDemo, self).__init__(parent) # --- add some helper labels with arrows and text... summary_lbl = QtGui.QLabel() summary_lbl.setPixmap(QtGui.QPixmap(":/tk_multi_demo_help/summary_help.png")) select_lbl = QtGui.QLabel() select_lbl.setPixmap(QtGui.QPixmap(":/tk_multi_demo_help/select_help.png")) tabs_lbl = QtGui.QLabel() tabs_lbl.setPixmap(QtGui.QPixmap(":/tk_multi_demo_help/tabs_help.png")) # lay out the widgets in the UI layout = QtGui.QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(summary_lbl) layout.addStretch() layout.addWidget(select_lbl) layout.addStretch() layout.addWidget(tabs_lbl) # align the appropriately layout.setAlignment(summary_lbl, QtCore.Qt.AlignCenter | QtCore.Qt.AlignTop) layout.setAlignment(select_lbl, QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) layout.setAlignment(tabs_lbl, QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom)
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 create_settings_widget(self, parent): """ Creates a Qt widget, for the supplied parent widget (a container widget on the right side of the publish UI). :param parent: The parent to use for the widget being created :return: A :class:`QtGui.QFrame` that displays editable widgets for modifying the plugin's settings. """ # defer Qt-related imports from sgtk.platform.qt import QtGui, QtCore # Create a QFrame with all our widgets settings_frame = QtGui.QFrame(parent) # Create our widgets, we add them as properties on the QFrame so we can # retrieve them easily. Qt uses camelCase so our xxxx_xxxx names can't # clash with existing Qt properties. # Show this plugin description settings_frame.description_label = QtGui.QLabel(self.description) settings_frame.description_label.setWordWrap(True) settings_frame.description_label.setOpenExternalLinks(True) settings_frame.description_label.setTextFormat(QtCore.Qt.RichText) # Unreal setttings settings_frame.unreal_render_presets_label = QtGui.QLabel( "Render with Movie Pipeline Presets:") settings_frame.unreal_render_presets_widget = QtGui.QComboBox() settings_frame.unreal_render_presets_widget.addItem("No presets") presets_folder = unreal.MovieRenderPipelineProjectSettings( ).preset_save_dir for preset in unreal.EditorAssetLibrary.list_assets( presets_folder.path): settings_frame.unreal_render_presets_widget.addItem( preset.split(".")[0]) settings_frame.unreal_publish_folder_label = QtGui.QLabel( "Publish folder:") storage_roots = self.parent.shotgun.find( "LocalStorage", [], ["code", _OS_LOCAL_STORAGE_PATH_FIELD]) settings_frame.storage_roots_widget = QtGui.QComboBox() settings_frame.storage_roots_widget.addItem("Current Unreal Project") for storage_root in storage_roots: if storage_root[_OS_LOCAL_STORAGE_PATH_FIELD]: settings_frame.storage_roots_widget.addItem( "%s (%s)" % (storage_root["code"], storage_root[_OS_LOCAL_STORAGE_PATH_FIELD]), userData=storage_root, ) # Create the layout to use within the QFrame settings_layout = QtGui.QVBoxLayout() settings_layout.addWidget(settings_frame.description_label) settings_layout.addWidget(settings_frame.unreal_render_presets_label) settings_layout.addWidget(settings_frame.unreal_render_presets_widget) settings_layout.addWidget(settings_frame.unreal_publish_folder_label) settings_layout.addWidget(settings_frame.storage_roots_widget) settings_layout.addStretch() settings_frame.setLayout(settings_layout) return settings_frame
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 __init__(self, parent=None): """ Initialize the demo widget. """ # call the base class init super(GlobalSearchWidgetDemo, self).__init__(parent) # create a bg task manager for pulling data from SG self._bg_task_manager = task_manager.BackgroundTaskManager(self) # create the widget search_widget = global_search_widget.GlobalSearchWidget(self) # give the search widget a handle on the task manager search_widget.set_bg_task_manager(self._bg_task_manager) # set the entity types to search through (this is also the default dict) search_widget.set_searchable_entity_types({ "Asset": [], "Shot": [], "Task": [], # only active users "HumanUser": [["sg_status_list", "is", "act"]], "Group": [], # only active users "ClientUser": [["sg_status_list", "is", "act"]], "ApiUser": [], "Version": [], "PublishedFile": [], }) # display some instructions info_lbl = QtGui.QLabel( "Click in the widget and type to search for Shotgun entities. You " "will need to type at least 3 characters before the search begins." ) # create a label to show when an entity is activated self._activated_label = QtGui.QLabel() self._activated_label.setWordWrap(True) self._activated_label.setStyleSheet(""" QLabel { color: #18A7E3; } """) # lay out the UI layout = QtGui.QVBoxLayout(self) layout.setSpacing(16) layout.addStretch() layout.addWidget(info_lbl) layout.addWidget(search_widget) layout.addWidget(self._activated_label) layout.addStretch() # connect the entity activated singal search_widget.entity_activated.connect(self._on_entity_activated)
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=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 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, CreateStorageDialog): CreateStorageDialog.setObjectName("CreateStorageDialog") CreateStorageDialog.resize(285, 94) CreateStorageDialog.setAutoFillBackground(True) self.verticalLayout_2 = QtGui.QVBoxLayout(CreateStorageDialog) self.verticalLayout_2.setSpacing(4) self.verticalLayout_2.setContentsMargins(12, 12, 12, 12) self.verticalLayout_2.setObjectName("verticalLayout_2") self.main_widget = QtGui.QWidget(CreateStorageDialog) self.main_widget.setObjectName("main_widget") self.verticalLayout = QtGui.QVBoxLayout(self.main_widget) self.verticalLayout.setSpacing(0) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.storage_name_layout = QtGui.QHBoxLayout() self.storage_name_layout.setSpacing(4) self.storage_name_layout.setObjectName("storage_name_layout") spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.storage_name_layout.addItem(spacerItem) self.storage_name_lbl = QtGui.QLabel(self.main_widget) self.storage_name_lbl.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.storage_name_lbl.setObjectName("storage_name_lbl") self.storage_name_layout.addWidget(self.storage_name_lbl) self.storage_name = QtGui.QLineEdit(self.main_widget) self.storage_name.setObjectName("storage_name") self.storage_name_layout.addWidget(self.storage_name) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.storage_name_layout.addItem(spacerItem1) self.storage_name_layout.setStretch(0, 5) self.storage_name_layout.setStretch(2, 15) self.verticalLayout.addLayout(self.storage_name_layout) self.info = QtGui.QLabel(self.main_widget) font = QtGui.QFont() font.setPointSize(10) self.info.setFont(font) self.info.setText("") self.info.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.info.setWordWrap(True) self.info.setObjectName("info") self.verticalLayout.addWidget(self.info) self.verticalLayout.setStretch(0, 1) self.verticalLayout.setStretch(1, 10) self.verticalLayout_2.addWidget(self.main_widget) self.button_box = QtGui.QDialogButtonBox(CreateStorageDialog) self.button_box.setLayoutDirection(QtCore.Qt.LeftToRight) self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.button_box.setObjectName("button_box") self.verticalLayout_2.addWidget(self.button_box) self.retranslateUi(CreateStorageDialog) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL("accepted()"), CreateStorageDialog.accept) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL("rejected()"), CreateStorageDialog.reject) QtCore.QMetaObject.connectSlotsByName(CreateStorageDialog) CreateStorageDialog.setTabOrder(self.storage_name, self.button_box)
def __init__(self, parent, command_name, button_name, icon, tooltip, timestamp): """ :param str command_name: Name of the command. :param str button_name: Name of the button. :param str icon: Path to the icon for this command. :param str tooltip: Toolkit for this command. :param datetime.datetime timestamp: When the command was last launched. """ super(RecentButton, self).__init__(parent) # No borders self.setFlat(True) self.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) self.setFocusPolicy(QtCore.Qt.NoFocus) layout = QtGui.QVBoxLayout(self) layout.setAlignment(QtCore.Qt.AlignHCenter) layout.setSpacing(self.SPACING) layout.setContentsMargins(self.MARGIN, self.MARGIN, self.MARGIN, self.MARGIN) self._timestamp = timestamp self.icon_label = QtGui.QLabel(self) self.icon_label.setAlignment(QtCore.Qt.AlignHCenter) self.layout().addWidget(self.icon_label, QtCore.Qt.AlignHCenter) # setting the stretch to 0 on the icon means the the text label will # stretch and the icon won't creating a more stable looking effect. layout.setStretch(0, 0) self.text_label = QtGui.QLabel(parent) self.text_label.setWordWrap(True) self.text_label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop) self.layout().addWidget(self.text_label, QtCore.Qt.AlignHCenter) self.setFocusPolicy(QtCore.Qt.NoFocus) self.setStyleSheet(BUTTON_STYLE) self.text_label.setText(button_name) if icon is None: self.icon_label.setPixmap(QtGui.QIcon().pixmap(ICON_SIZE)) else: self.icon_label.setPixmap(QtGui.QIcon(icon).pixmap(ICON_SIZE)) self.setToolTip(tooltip) self._command_name = command_name self.clicked.connect(lambda: self.command_triggered.emit( six.ensure_str(self._command_name)))
def _setup_storage_widgets(self, project_paths_dict): # setup os info and ordering os_info = [ # (dict key, label, current os) ("darwin", "Mac", sys.platform == "darwin"), ("linux2", "Linux", sys.platform.startswith("linux")), ("win32", "Windows", sys.platform == "win32"), ] # current os first, then alphabetically def os_key(element): # return a key that sorts the os'es properly (_, label, os_current) = element return (not os_current, label) os_info.sort(key=os_key) wiz = self.wizard() for storage in project_paths_dict: # each storage gets a group showing what paths will be created for that storage group = QtGui.QGroupBox(" %s " % storage.title()) group.setStyleSheet(""" QGroupBox { border: 1px solid rgb(217, 217, 217); border-radius: 3px; margin-top: 0.5em; } QGroupBox::title { font-size: 14px; subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; color: rgb(55, 168, 225); } """) group_layout = QtGui.QGridLayout(group) row = 0 for (key, label, _) in os_info: path = project_paths_dict[storage].get(key) if path: group_layout.addWidget( QtGui.QLabel("<big>%s</big>" % label), row, 0, 1, 1) path_widget = QtGui.QLabel() self._storage_path_widgets.setdefault( storage, {})[key] = path_widget group_layout.addWidget(path_widget, row, 1, 1, 1) row += 1 group_layout.setColumnStretch(1, 1) group_layout.setHorizontalSpacing(15) wiz.ui.project_contents_layout.addWidget(group) # Keep added widgets in order to remove them in case back button is used. self._widget_groups.append(group)
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, filter_id, group_id, filter_data, parent=None): """ Constructor. Initialize the widget UI: - Left aligned checkbox - Left aligned icon (optional) - Left aligned filter value display text - Right aligned filter value count :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(ChoicesFilterItemWidget, self).__init__(filter_id, group_id, parent) layout = QtGui.QHBoxLayout() layout.setAlignment(QtCore.Qt.AlignLeft) # Left-aligned checkbox self.checkbox = QtGui.QCheckBox() self.checkbox.stateChanged.connect(self.state_changed) layout.addWidget(self.checkbox) # Left-aligned (optional) icon icon = filter_data.get("icon") if icon: icon_label = QtGui.QLabel() icon_label.setPixmap(icon.pixmap(14)) layout.addWidget(icon_label) # Left-aligned filter value display text name = six.ensure_str( filter_data.get("display_name", filter_data.get("filter_value")) ) self.label = QtGui.QLabel(name) layout.addWidget(self.label) # Right-aligned count label count = filter_data.get("count") if count: self.count_label = QtGui.QLabel(str(count)) layout.addStretch() layout.addWidget(self.count_label) self.setLayout(layout)
def setupUi(self, Item): Item.setObjectName("Item") Item.resize(329, 65) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Item.sizePolicy().hasHeightForWidth()) Item.setSizePolicy(sizePolicy) Item.setMinimumSize(QtCore.QSize(0, 65)) self.verticalLayout = QtGui.QVBoxLayout(Item) self.verticalLayout.setSpacing(2) self.verticalLayout.setContentsMargins(2, 2, 2, 2) self.verticalLayout.setObjectName("verticalLayout") self.background = ClickBubblingGroupBox(Item) self.background.setTitle("") self.background.setObjectName("background") self.horizontalLayout = QtGui.QHBoxLayout(self.background) self.horizontalLayout.setSpacing(8) self.horizontalLayout.setContentsMargins(10, 2, 2, 2) self.horizontalLayout.setObjectName("horizontalLayout") self.light = QtGui.QLabel(self.background) self.light.setText("") self.light.setPixmap(QtGui.QPixmap(":/res/empty_bullet.png")) self.light.setObjectName("light") self.horizontalLayout.addWidget(self.light) self.thumbnail = ThumbnailLabel(self.background) self.thumbnail.setMinimumSize(QtCore.QSize(60, 40)) self.thumbnail.setMaximumSize(QtCore.QSize(60, 40)) self.thumbnail.setText("") self.thumbnail.setPixmap(QtGui.QPixmap(":/res/no_thumb.png")) self.thumbnail.setScaledContents(False) self.thumbnail.setAlignment(QtCore.Qt.AlignCenter) self.thumbnail.setObjectName("thumbnail") self.horizontalLayout.addWidget(self.thumbnail) self.details = QtGui.QLabel(self.background) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.details.sizePolicy().hasHeightForWidth()) self.details.setSizePolicy(sizePolicy) self.details.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.details.setWordWrap(True) self.details.setObjectName("details") self.horizontalLayout.addWidget(self.details) self.verticalLayout.addWidget(self.background) self.retranslateUi(Item) QtCore.QMetaObject.connectSlotsByName(Item)
def _set_thumbnail(self): if os.path.exists(self._thumb_path): self.treeWidget().itemWidget( self, self._column_names.index_name('thumb')) if not self.treeWidget().itemWidget( self, self._column_names.index_name('thumb')): image = QtGui.QPixmap(self._thumb_path) self.setSizeHint(self._column_names.index_name('thumb'), image.size()) thumbnail = QtGui.QLabel("", self.treeWidget()) thumbnail.setAlignment(QtCore.Qt.AlignHCenter) thumbnail.setPixmap(image) self.treeWidget().setItemWidget( self, self._column_names.index_name('thumb'), thumbnail) # add to json data ba = QtCore.QByteArray() buff = QtCore.QBuffer(ba) buff.open(QtCore.QIODevice.WriteOnly) image.save(buff, "JPG") if sys.version_info.major == 2: self._fields['data']['thumb'] = ba.toBase64().data() elif sys.version_info.major == 3: self._fields['data']['thumb'] = ba.toBase64().data( ).decode('UTF-8') # remove tmp file os.remove(self._thumb_path) elif 'thumb' in self._fields['data'].keys(): thumb_bytes = None if sys.version_info.major == 2: thumb_bytes = self._fields['data']['thumb'].encode("utf-8") elif sys.version_info.major == 3: thumb_bytes = bytes(self._fields['data']['thumb'], 'UTF-8') ba = QtCore.QByteArray.fromBase64(thumb_bytes) image = QtGui.QPixmap() image.loadFromData(ba, "JPG") thumbnail = QtGui.QLabel("", self.treeWidget()) thumbnail.setAlignment(QtCore.Qt.AlignHCenter) thumbnail.setPixmap(image) self.treeWidget().setItemWidget( self, self._column_names.index_name('thumb'), thumbnail) else: msg = "Could not find thumnail at '%s'. Failed to generate it!" % ( self._thumb_path) self._panel._app.log_error(msg)
def __init__(self, label, message, parent=None): super(ErrorDialog, self).__init__(parent) self.setWindowTitle('tk-multi-tickets Error') self.setWindowIcon(QtGui.QIcon(res.get_path('icon_256.png'))) self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) self.label = QtGui.QLabel(label) self.text = QtGui.QPlainTextEdit(message) self.text.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) self.button = QtGui.QPushButton('Dismiss') self.button.setSizePolicy( QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum, ) self.button.clicked.connect(self.accept) self.layout = QtGui.QVBoxLayout() self.layout.setStretch(1, 1) self.layout.addWidget(self.label) self.layout.addWidget(self.text) self.layout.addWidget(self.button) self.layout.setAlignment(self.button, QtCore.Qt.AlignRight) self.setLayout(self.layout)
def __init__(self, parent, qtwidgets, description_widget=None): QtGui.QWidget.__init__(self, parent) layout = QtGui.QVBoxLayout(self) # Label self.label = QtGui.QLabel(self) self.label.setText("Export Name") layout.addWidget(self.label) # Line edit self.editLine = QtGui.QLineEdit(self) # Layout layout.addWidget(self.editLine) self.setLayout(layout) if description_widget: layout.addWidget(description_widget) elided_label = qtwidgets.import_module("elided_label") long_label = elided_label.ElidedLabel(self) long_label.setText( "ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF" ) layout.addWidget(long_label)
def __init__(self, intSize=50, parent=None): QtGui.QWidget.__init__(self, parent) # Load the file into a QMovie self.movie = QtGui.QMovie(getRessources("preloader_%i.gif" % intSize), QtCore.QByteArray(), self) size = self.movie.scaledSize() self.setGeometry(intSize, intSize, size.width(), size.height()) self.movie_screen = QtGui.QLabel(parent=self) # Make label fit the gif #self.movie_screen.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.movie_screen.setAlignment(QtCore.Qt.AlignLeft) # Create the layout main_layout = QtGui.QVBoxLayout() main_layout.setContentsMargins(0, 0, 0, 0) main_layout.addWidget(self.movie_screen) self.setLayout(main_layout) # Add the QMovie object to the label self.movie.setCacheMode(QtGui.QMovie.CacheAll) self.movie.setSpeed(100) self.movie_screen.setMovie(self.movie) self.movie.start()
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 create_settings_widget(self, parent, items=None): """ Creates a Qt widget, for the supplied parent widget (a container widget on the right side of the publish UI). :param parent: The parent to use for the widget being created. :param items: A list of PublishItems the selected publish tasks are parented to. :return: A QtGui.QWidget or subclass that displays information about the plugin and/or editable widgets for modifying the plugin's settings. """ # defer Qt-related imports from sgtk.platform.qt import QtGui # create a group box to display the description description_group_box = QtGui.QGroupBox(parent) description_group_box.setTitle("Description:") # The publish plugin that subclasses this will implement the # `description` property. We'll use that here to display the plugin's # description in a label. description_label = QtGui.QLabel(self.description) description_label.setWordWrap(True) description_label.setOpenExternalLinks(True) # create the layout to use within the group box description_layout = QtGui.QVBoxLayout() description_layout.addWidget(description_label) description_layout.addStretch() description_group_box.setLayout(description_layout) # return the description group box as the widget to display return description_group_box
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 __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 __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)