def __init__(self, parent=None): QtWidgets.QMainWindow.__init__(self, parent=parent) MAYA = True self.setWindowFlags(QtCore.Qt.Window) self.ui = QtWidgets.QWidget() self.ui.master_layout = QtWidgets.QVBoxLayout() # self.ui.master_layout.setMargin(0) self.ui.setLayout(self.ui.master_layout) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.parent = parent self.setWindowTitle(self.window_label) self.setObjectName(self.window_name) self.setCentralWidget(self.ui) self.setWindowIcon(logo_icon) self.ui.main_layout = QtWidgets.QVBoxLayout() #self.ui.main_layout.setMargin(0) self.ui.main_layout.setSpacing(3) self.ui.master_layout.addLayout(self.ui.main_layout) if MAYA: self.setProperty('saveWindowPref', True) self.align_to_center(self.parent)
def __init__(self, *args, **kwargs): super(MayaCaptureWidget, self).__init__(*args, **kwargs) self.textw = QtWidgets.QLineEdit() self.layout = QtWidgets.QVBoxLayout() self.layout.addWidget(self.textw) self.ui_mainLeft_gridLayout = QtWidgets.QGridLayout() self.decorate_ui() self.layout.addLayout(self.ui_mainLeft_gridLayout) self.setLayout(self.layout)
def create_layout(self): self.info_title = QtWidgets.QLabel(self.info_text) self.info_pushButton = QtWidgets.QPushButton() self.info_pushButton.setText(self.media_url) main_layout = QtWidgets.QVBoxLayout() main_layout.addWidget(self.info_title) main_layout.addWidget(self.info_pushButton) self.setLayout(main_layout)
def __init__(self, parent=None, label = ''): QtWidgets.QGridLayout.__init__(self) self.label = QtWidgets.QLabel(label) self.addWidget(self.label, 0, 0) self.setColumnMinimumWidth(0,90) self.setColumnStretch(0,0) self.setColumnStretch(1,1) self.setSpacing(2)
def align_to_center(self, align_object): """ If the UI has a parent, align to it. If not, align to the center of the desktop. """ ui_size = self.geometry() if align_object: align_object_center = align_object.frameGeometry().center() x_coordinate = align_object_center.x() -(ui_size.width() / 2) y_coordinate = align_object_center.y() -(ui_size.height() / 2) else: desktop_screen = QtWidgets.QDesktopWidget().screenGeometry() x_coordinate =(desktop_screen.width() - ui_size.width()) / 2 y_coordinate =(desktop_screen.height() - ui_size.height()) / 2 self.move(x_coordinate, y_coordinate) return self.geometry()
def decorate_ui(self): self.ui.ui_formatpreset_layout = QtWidgets.QHBoxLayout() self.ui.ui_formatpreset_layout.setSpacing(1) self.ui.ui_formatPreset_comboBox = RegularComboBox() self.ui.ui_formatpreset_layout.addWidget( self.ui.ui_formatPreset_comboBox) self.ui.ps_new_preset_pushButton = RegularToolButton() self.ui.ps_new_preset_pushButton.setIcon(add_icon) self.ui.ps_rename_preset_pushButton = RegularToolButton() self.ui.ps_rename_preset_pushButton.setIcon(edit_icon) self.ui.ps_delete_preset_pushButton = RegularToolButton() self.ui.ps_delete_preset_pushButton.setIcon(delete_icon) self.ui.ui_formatpreset_layout.addWidget( self.ui.ps_rename_preset_pushButton) self.ui.ui_formatpreset_layout.addWidget( self.ui.ps_new_preset_pushButton) self.ui.ui_formatpreset_layout.addWidget( self.ui.ps_delete_preset_pushButton) # 720p HD self.ui.ui_format_layout = RegularGridLayout(self, label='Format') self.ui.format_comboBox = RegularComboBox() self.ui.ui_format_layout.addWidget(self.ui.format_comboBox, 0, 1) # avi, qt self.ui.ui_encoding_layout = RegularGridLayout(self, label='Encoding') self.ui.encoding_comboBox = RegularComboBox() self.ui.ui_encoding_layout.addWidget(self.ui.encoding_comboBox, 0, 1) # H.264 # upload_layout - range self.ui.ui_resolution_layout = RegularGridLayout(self, label='Resolution') self.ui.ui_resolution_comboBox = RegularComboBox(self) self.ui.ui_resolution_comboBox.addItems( ["Custom", "From Render Settings", "From Viewport"]) self.ui.width_spinBox = RegularQSpinBox() self.ui.ui_resolutionX_label = QtWidgets.QLabel() self.ui.ui_resolutionX_label.setText("x") self.ui.ui_resolutionX_label.setFixedWidth(8) self.ui.height_spinBox = RegularQSpinBox() self.ui.ui_resolution_layout.addWidget(self.ui.ui_resolution_comboBox, 0, 1) self.ui.ui_resolution_layout.addWidget(self.ui.width_spinBox, 0, 2) self.ui.ui_resolution_layout.setColumnStretch(2, 0) self.ui.ui_resolution_layout.addWidget(self.ui.ui_resolutionX_label, 0, 3) self.ui.ui_resolution_layout.addWidget(self.ui.height_spinBox, 0, 4) self.ui.ui_resolution_layout.setColumnStretch(3, 0) self.ui.width_spinBox.setFixedWidth(45) self.ui.height_spinBox.setFixedWidth(45) self.ui.width_spinBox.setMinimum(4) self.ui.width_spinBox.setMaximum(32000) self.ui.height_spinBox.setMinimum(4) self.ui.height_spinBox.setMaximum(32000) self.ui.scaleButton_layout = QtWidgets.QHBoxLayout() for key, factor in { "¼": 0.25, "½": 0.5, "¾": 0.75, "1": 1.0, "2": 2.0 }.iteritems(): logger.info("key: %s\nfactor: %s" % (key, factor)) btn = RegularToolButton() btn.setText(key) self.ui.scaleButton_layout.addWidget(btn) btn.setFixedWidth(20) btn.clicked.connect(partial(self.multiply_res, factor)) self.ui.ui_resolution_layout.addLayout(self.ui.scaleButton_layout, 0, 5) self.ui.width_spinBox.setAlignment(QtCore.Qt.AlignRight) self.ui.height_spinBox.setAlignment(QtCore.Qt.AlignRight) self.ui.buttons_horizontalLayout = QtWidgets.QHBoxLayout() self.ui.cancel_pushButton = RegularButton() self.ui.cancel_pushButton.setText("Cancel") self.ui.save_pushButton = RegularButton() self.ui.save_pushButton.setText("Save") self.ui.buttons_horizontalLayout.setSpacing(1) self.ui.buttons_horizontalLayout.addWidget(self.ui.cancel_pushButton) self.ui.buttons_horizontalLayout.addWidget(self.ui.save_pushButton) self.ui.main_layout.addLayout(self.ui.ui_formatpreset_layout) self.ui.main_layout.addLayout(self.ui.ui_format_layout) self.ui.main_layout.addLayout(self.ui.ui_encoding_layout) self.ui.main_layout.addLayout(self.ui.ui_resolution_layout) self.ui.main_layout.addLayout(self.ui.buttons_horizontalLayout) self.ui.master_layout.addLayout(self.ui.main_layout)
def decorate_ui(self): self.ui.ui_greasepencilDownload_layout = QtWidgets.QVBoxLayout() self.ui.ui_downloadGeneral_layout = QtWidgets.QVBoxLayout() self.ui.ui_downloadGP_layout = QtWidgets.QVBoxLayout() self.ui.main_layout.addLayout(self.ui.ui_downloadGeneral_layout) self.ui.thumbnail_pushButton = RegularThumbnail(width=480, height=270) self.ui.review_target_name = RegularLineEdit() self.ui.review_target_url = RegularLineEdit() self.ui.ui_status_label = RegularStatusLabel() self.ui.ui_downloadGeneral_layout.addWidget(self.ui.ui_status_label) self.ui.ui_downloadGeneral_layout.addWidget( self.ui.thumbnail_pushButton) self.ui.ui_downloadGeneral_layout.addWidget(self.ui.review_target_url) # GP Range Row self.ui.downloadGP_range_layout = RegularGridLayout( self, label='Frame Offset') self.ui.ui_downloadGP_rangeIn_textEdit = RegularQSpinBox() self.ui.ui_downloadGP_rangeIn_textEdit.setValue(0) self.ui.ui_downloadGP_rangeIn_textEdit.setMinimum(-10000) self.ui.downloadGP_range_layout.addWidget( self.ui.ui_downloadGP_rangeIn_textEdit, 0, 1) self.ui.downloadGP_range_layout.setColumnStretch(2, 0) # GP Application Row self.ui.downloadGP_application_layout = RegularGridLayout( self, label='After Download') self.ui.downloadGP_application_checkbox = QtWidgets.QCheckBox() self.ui.downloadGP_application_checkbox.setText("Apply") self.ui.downloadGP_application_checkbox.setChecked(1) self.ui.downloadGP_application_checkbox.setFixedWidth(60) self.ui.downloadGP_application_layout.setColumnStretch(1, 0) self.ui.downloadGP_application_comboBox = RegularComboBox() self.ui.downloadGP_application_comboBox.addItems( maya_scene.get_available_cameras()) self.ui.downloadGP_application_layout.addWidget( self.ui.downloadGP_application_checkbox, 0, 1) self.ui.downloadGP_application_layout.addWidget( self.ui.downloadGP_application_comboBox, 0, 2) self.ui.downloadGP_application_layout.setColumnStretch(2, 1) self.ui.ui_downloadGP_pushButton = RegularButton() self.ui.ui_downloadGP_pushButton.clicked.connect( self.download_greasepencil) self.ui.ui_downloadGP_pushButton.setText("Download\nGrease Pencil") self.ui.ui_downloadVideoAnnotated_pushButton = RegularButton() self.ui.ui_downloadVideoAnnotated_pushButton.clicked.connect( self.download_video_annotated) self.ui.ui_downloadVideoAnnotated_pushButton.setText( "Download\nAnnotated Video") self.ui.download_buttons_layout = QtWidgets.QHBoxLayout() self.ui.download_buttons_layout.addWidget( self.ui.ui_downloadGP_pushButton) self.ui.download_buttons_layout.addWidget( self.ui.ui_downloadVideoAnnotated_pushButton) # self.ui.ui_downloadGP_groupbox = QtWidgets.QGroupBox() self.ui.ui_downloadGP_groupbox.setTitle('Grease Pencil') self.ui.ui_downloadGP_groupbox.setLayout(self.ui.ui_downloadGP_layout) self.ui.ui_downloadGP_layout.addLayout(self.ui.downloadGP_range_layout) self.ui.ui_downloadGP_layout.addLayout( self.ui.downloadGP_application_layout) self.ui.ui_downloadGP_layout.addLayout(self.ui.download_buttons_layout) self.ui.main_layout.addWidget(self.ui.ui_downloadGP_groupbox)
def decorate_ui(self): file_icon = self.style().standardIcon(QtWidgets.QStyle.SP_FileIcon) directory_icon = self.style().standardIcon(QtWidgets.QStyle.SP_DirIcon) # Adding the two colums to main_layout #self.ui_mainLeft_gridLayout = QtWidgets.QGridLayout() #self.ui_mainRight_gridLayout = QtWidgets.QVBoxLayout() self.ui_mainLeft_gridLayout.setSpacing(1) #self.ui_mainRight_gridLayout.setSpacing(2) self.ui_reviewSelection_hBoxLayout = QtWidgets.QHBoxLayout() #self.main_layout.addLayout(self.ui_mainLeft_gridLayout, 0, 0) #self.main_layout.addLayout(self.ui_mainRight_gridLayout, 0, 1) #self.main_layout.setColumnMinimumWidth(0, 320) #self.main_layout.setColumnMinimumWidth(1, 320) #self.main_layout.setColumnStretch(0, 1) #self.main_layout.setColumnStretch(1, 0) # Adding ui_mainLeft_gridLayout self.ui_record_gridLayout = QtWidgets.QVBoxLayout() self.ui_clipSelection_gridLayout = QtWidgets.QVBoxLayout() self.ui_targetSelection_gridLayout = QtWidgets.QVBoxLayout() self.ui_targetSelection_gridLayout.setSpacing(3) self.ui_record_groupbox = QtWidgets.QGroupBox() self.ui_mainLeft_gridLayout.addWidget(self.ui_record_groupbox) self.ui_record_groupbox.setTitle('RECORD') self.ui_record_groupbox.setLayout(self.ui_record_gridLayout) self.ui_upload_groupbox = QtWidgets.QGroupBox() self.ui_mainLeft_gridLayout.addWidget(self.ui_upload_groupbox) self.ui_upload_groupbox.setTitle('FILE TO UPLOAD') self.ui_upload_groupbox.setLayout(self.ui_clipSelection_gridLayout) self.ui_targetSelection_groupbox = QtWidgets.QGroupBox() self.ui_targetSelection_groupbox.setTitle('TARGET FOR UPLOAD') self.ui_targetSelection_groupbox.setLayout( self.ui_targetSelection_gridLayout) self.ui_mainLeft_gridLayout.addLayout(self.ui_record_gridLayout, 0, 0) self.ui_mainLeft_gridLayout.addLayout(self.ui_clipSelection_gridLayout, 1, 0) # upload_layout - format preset self.upload_formatPreset_layout = RegularGridLayout( self, label='Format Preset') self.ui_record_gridLayout.addLayout(self.upload_formatPreset_layout) self.ui_formatPreset_comboBox = RegularComboBox(self) self.ps_preset_description = QtWidgets.QLabel() self.ps_preset_description.setStyleSheet("font: 9pt") self.ps_preset_description.setIndent(5) self.ps_format_toolButton = RegularToolButton(self, icon=file_icon) self.upload_formatPreset_layout.addWidget( self.ui_formatPreset_comboBox, 0, 1) self.upload_formatPreset_layout.addWidget(self.ps_format_toolButton, 0, 2) self.upload_formatPreset_layout.addWidget(self.ps_preset_description, 1, 1, 1, 2) # upload_layout - viewport preset self.upload_viewportPreset_layout = RegularGridLayout( self, label='Viewport Preset') self.ui_record_gridLayout.addLayout(self.upload_viewportPreset_layout) self.ui_viewportpreset_comboBox = RegularComboBox(self) self.ui_viewport_toolButton = RegularToolButton(self, icon=preset_icon) self.upload_viewportPreset_layout.addWidget( self.ui_viewportpreset_comboBox, 0, 1) self.upload_viewportPreset_layout.addWidget( self.ui_viewport_toolButton, 0, 2) # upload_layout - camera self.upload_cameraPreset_layout = RegularGridLayout(self, label='Camera') self.ui_record_gridLayout.addLayout(self.upload_cameraPreset_layout) self.ui_cameraPreset_comboBox = RegularComboBox(self) self.ui_camera_toolButton = RegularToolButton(self, icon=fill_icon) self.upload_cameraPreset_layout.addWidget( self.ui_cameraPreset_comboBox, 0, 1) self.upload_cameraPreset_layout.addWidget(self.ui_camera_toolButton, 0, 2) # upload_layout - range self.upload_range_layout = RegularGridLayout(self, label='Frame Range') self.ui_record_gridLayout.addLayout(self.upload_range_layout) self.ui_range_comboBox = RegularComboBox(self) self.ui_range_comboBox.addItems( ["Start / End", "Time Slider", "Highlighted", "Current Frame"]) self.ui_range_toolButton = RegularToolButton(self, icon=fill_icon) self.ui_rangeIn_textEdit = RegularLineEdit() self.ui_rangeOut_textEdit = RegularLineEdit() self.upload_range_layout.addWidget(self.ui_range_comboBox, 0, 1) self.upload_range_layout.addWidget(self.ui_rangeIn_textEdit, 0, 2) self.upload_range_layout.setColumnStretch(2, 0) self.upload_range_layout.addWidget(self.ui_rangeOut_textEdit, 0, 3) self.upload_range_layout.setColumnStretch(3, 0) self.ui_rangeIn_textEdit.setFixedWidth(40) self.ui_rangeOut_textEdit.setFixedWidth(40) self.ui_rangeIn_textEdit.setAlignment(QtCore.Qt.AlignRight) self.ui_rangeOut_textEdit.setAlignment(QtCore.Qt.AlignRight) self.upload_range_layout.addWidget(self.ui_range_toolButton, 0, 4) self.onlyInt = QtGui.QIntValidator() self.ui_rangeIn_textEdit.setValidator(self.onlyInt) self.ui_rangeIn_textEdit.setPlaceholderText('Start') self.ui_rangeOut_textEdit.setValidator(self.onlyInt) self.ui_rangeOut_textEdit.setPlaceholderText('End') # upload_layout - Directory self.upload_directory_layout = RegularGridLayout(self, label='Directory') self.ui_record_gridLayout.addLayout(self.upload_directory_layout) self.ps_directory_lineEdit = QtWidgets.QLineEdit() self.ps_directory_lineEdit.setPlaceholderText('Output Directory') self.ps_directory_toolButton = RegularToolButton(self, icon=directory_icon) self.upload_directory_layout.addWidget(self.ps_directory_lineEdit, 0, 1) self.upload_directory_layout.addWidget(self.ps_directory_toolButton, 0, 2) # record_layout - filename self.upload_filename_layout = RegularGridLayout(self, label='Clip Name') self.ui_record_gridLayout.addLayout(self.upload_filename_layout) self.us_filename_lineEdit = QtWidgets.QLineEdit() self.us_filename_lineEdit.setPlaceholderText('File Name or Prefix') self.ps_filename_toolButton = RegularToolButton(self) self.ps_filename_toolButton.setEnabled(0) self.upload_filename_layout.addWidget(self.us_filename_lineEdit, 0, 1) self.upload_filename_layout.addWidget(self.ps_filename_toolButton, 0, 2) # record_layout - clipname self.upload_clipname_layout = RegularGridLayout(self, label='Clip Suffix ') self.ui_record_gridLayout.addLayout(self.upload_clipname_layout) self.ps_clipname_lineEdit = QtWidgets.QLineEdit() self.ps_clipname_lineEdit.setPlaceholderText('Clip Suffix (optional)') self.ps_clipname_toolButton = RegularToolButton(self) self.ps_clipname_toolButton.setEnabled(0) self.upload_clipname_layout.addWidget(self.ps_clipname_lineEdit, 0, 1) self.upload_clipname_layout.addWidget(self.ps_clipname_toolButton, 0, 2) # record_layout - after record self.upload_after_layout = RegularGridLayout(self, label='After Record') self.ps_play_after_creation_checkBox = QtWidgets.QCheckBox() self.ps_play_after_creation_checkBox.setChecked(True) self.ps_play_after_creation_checkBox.setText('Play') self.ps_upload_after_creation_checkBox = QtWidgets.QCheckBox() self.ps_upload_after_creation_checkBox.setText('Upload') self.upload_after_layout.addWidget( self.ps_play_after_creation_checkBox, 0, 1) self.upload_after_layout.addWidget( self.ps_upload_after_creation_checkBox, 0, 2) self.ui_record_gridLayout.addLayout(self.upload_after_layout) # record_layout - record button self.ui_record_pushButton = RegularButton(self, icon=record_icon, color=record_color) self.ui_record_pushButton.setText("RECORD") self.ui_record_gridLayout.addWidget(self.ui_record_pushButton) self.ui_formatPreset_comboBox.populate_combo_list( PRESET_YAML, DEFAULT_PRESET) self.ui_viewportpreset_comboBox.populate_combo_list( VIEWPORT_YAML, DEFAULT_VIEWPORT_PRESET)
def decorate_ui(self): self.ui.ps_thumb_horizontalLayout = QtWidgets.QGridLayout() self.ui.screenshot_pushButton = RegularThumbnail(width=480, height=270) self.ui.ui_thumbcamera_label = HoverButton(icon=refresh_icon) self.ui.ui_thumbcamera_label.setLayoutDirection(QtCore.Qt.RightToLeft) self.ui.ui_thumbcamera_label.setMinimumSize(480, 270) self.ui.ps_thumb_horizontalLayout.addWidget( self.ui.screenshot_pushButton, 0, 0) self.ui.ps_thumb_horizontalLayout.addWidget( self.ui.ui_thumbcamera_label, 0, 0) # Viewport Preset Selection and Handling self.ui.ps_preset_horizontalLayout = QtWidgets.QHBoxLayout() self.ui.ui_viewportpreset_comboBox = RegularComboBox() self.ui.ps_new_preset_pushButton = RegularToolButton() self.ui.ps_new_preset_pushButton.setIcon(add_icon) self.ui.ps_rename_preset_pushButton = RegularToolButton() self.ui.ps_rename_preset_pushButton.setIcon(edit_icon) self.ui.ps_delete_preset_pushButton = RegularToolButton() self.ui.ps_delete_preset_pushButton.setIcon(delete_icon) self.ui.ps_refresh_pushButton = RegularToolButton() self.ui.ps_refresh_pushButton.setIcon(refresh_icon) self.ui.ps_preset_horizontalLayout.addWidget( self.ui.ps_refresh_pushButton) self.ui.ps_preset_horizontalLayout.addWidget( self.ui.ui_viewportpreset_comboBox) self.ui.ps_preset_horizontalLayout.addWidget( self.ui.ps_rename_preset_pushButton) self.ui.ps_preset_horizontalLayout.addWidget( self.ui.ps_new_preset_pushButton) self.ui.ps_preset_horizontalLayout.addWidget( self.ui.ps_delete_preset_pushButton) # Viewport Preset Application self.ui.buttons_horizontalLayout = QtWidgets.QHBoxLayout() self.ui.ps_apply_preset_pushButton = RegularButton() self.ui.ps_apply_preset_pushButton.setText("Apply \nto current view") self.ui.buttons_horizontalLayout.addWidget( self.ui.ps_apply_preset_pushButton) self.ui.ps_applyToAll_preset_pushButton = RegularButton() self.ui.ps_applyToAll_preset_pushButton.setText("Apply\nto all views") self.ui.buttons_horizontalLayout.addWidget( self.ui.ps_applyToAll_preset_pushButton) self.ui.ps_save_preset_pushButton = RegularButton() self.ui.ps_save_preset_pushButton.setText("Override preset\nfrom view") self.ui.buttons_horizontalLayout.addWidget( self.ui.ps_save_preset_pushButton) self.ui.ui_status_label = RegularStatusLabel() self.ui.ui_status_label.setFixedHeight(30) self.ui.master_layout.setSpacing(1) self.ui.master_layout.addWidget(self.ui.ui_status_label) self.ui.master_layout.addLayout(self.ui.ps_thumb_horizontalLayout) self.ui.master_layout.addLayout(self.ui.ps_preset_horizontalLayout) self.ui.master_layout.addLayout(self.ui.buttons_horizontalLayout)