def create(self, parent=None): """Creates the fields under the given layout :param parent: :return: """ self.parent = parent # Main Layout self.layout = QtWidgets.QHBoxLayout(parent) layout_widget = self.layout.widget() # Shot Name Field self.shot_name_field = QtWidgets.QLineEdit(layout_widget) self.layout.addWidget(self.shot_name_field) # FBX file field self.fbx_file_field = QtWidgets.QLineEdit(layout_widget) self.fbx_file_field.setPlaceholderText("Choose FBX File") self.layout.addWidget(self.fbx_file_field) # FBX Button self.fbx_choose_button = QtWidgets.QPushButton(layout_widget) self.fbx_choose_button.setText("...") self.layout.addWidget(self.fbx_choose_button) # Video file field self.video_file_field = QtWidgets.QLineEdit(layout_widget) self.video_file_field.setPlaceholderText("Choose Video File") self.layout.addWidget(self.video_file_field) # FBX Button self.video_choose_button = QtWidgets.QPushButton(layout_widget) self.video_choose_button.setText("...") self.layout.addWidget(self.video_choose_button) # Cut in Field self.cut_in_field = QtWidgets.QSpinBox() self.cut_in_field.setMinimum(0) self.cut_in_field.setMaximum(9999999) self.layout.addWidget(self.cut_in_field) # Cut out Field self.cut_out_field = QtWidgets.QSpinBox() self.cut_out_field.setMinimum(0) self.cut_out_field.setMaximum(9999999) self.layout.addWidget(self.cut_out_field) # FPS Field self.fps_field = QtWidgets.QDoubleSpinBox() self.fps_field.setMinimum(0) self.fps_field.setMaximum(9999999) self.fps_field.setDecimals(2) self.layout.addWidget(self.fps_field) # Delete Button self.delete_push_button = QtWidgets.QPushButton(layout_widget) self.delete_push_button.setText("Delete") self.layout.addWidget(self.delete_push_button) # Signals import functools # Choose FBX Push Button QtCore.QObject.connect( self.fbx_choose_button, QtCore.SIGNAL("clicked()"), functools.partial(self.fbx_choose_button_clicked)) # Choose Video Push Button QtCore.QObject.connect( self.video_choose_button, QtCore.SIGNAL("clicked()"), functools.partial(self.video_choose_button_clicked)) QtCore.QObject.connect(self.delete_push_button, QtCore.SIGNAL("clicked()"), functools.partial(self.delete)) QtCore.QObject.connect( self.video_file_field, QtCore.SIGNAL("editingFinished()"), functools.partial(self.video_file_field_changed))
def setup_ui(self): self.resize(328, 184) self.vertical_layout = QtWidgets.QVBoxLayout(self) self.dialog_label = QtWidgets.QLabel(self) self.dialog_label.setStyleSheet("color: rgb(71, 143, 202);\n" "font: 18pt;") self.vertical_layout.addWidget(self.dialog_label) self.line = QtWidgets.QFrame(self) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.vertical_layout.addWidget(self.line) self.form_layout = QtWidgets.QFormLayout() self.form_layout.setLabelAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.name_fields_vertical_layout = QtWidgets.QVBoxLayout() self.name_validator_label = QtWidgets.QLabel(self) self.name_validator_label.setStyleSheet("color: rgb(255, 0, 0);") self.name_fields_vertical_layout.addWidget(self.name_validator_label) self.form_layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.name_fields_vertical_layout) self.width_height_label = QtWidgets.QLabel(self) self.form_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.width_height_label) self.horizontal_layout = QtWidgets.QHBoxLayout() self.width_spin_box = QtWidgets.QSpinBox(self) self.width_spin_box.setMaximum(99999) self.horizontal_layout.addWidget(self.width_spin_box) self.label = QtWidgets.QLabel(self) self.horizontal_layout.addWidget(self.label) self.height_spin_box = QtWidgets.QSpinBox(self) self.height_spin_box.setMaximum(99999) self.horizontal_layout.addWidget(self.height_spin_box) self.horizontal_layout.setStretch(0, 1) self.horizontal_layout.setStretch(2, 1) self.form_layout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.horizontal_layout) self.pixel_aspect_label = QtWidgets.QLabel(self) self.form_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pixel_aspect_label) self.pixel_aspect_double_spin_box = QtWidgets.QDoubleSpinBox(self) self.pixel_aspect_double_spin_box.setProperty("value", 1.0) self.form_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.pixel_aspect_double_spin_box) self.name_label = QtWidgets.QLabel(self) self.form_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.name_label) self.vertical_layout.addLayout(self.form_layout) self.button_box = QtWidgets.QDialogButtonBox(self) self.button_box.setOrientation(QtCore.Qt.Horizontal) self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok) self.vertical_layout.addWidget(self.button_box) self.vertical_layout.setStretch(2, 1) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL("accepted()"), self.accept) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL("rejected()"), self.reject) QtCore.QMetaObject.connectSlotsByName(self) self.setWindowTitle("Image Format Dialog") self.dialog_label.setText("Create Image Format") self.name_validator_label.setText("Validator Message") self.width_height_label.setText("Width x Height") self.label.setText("x") self.pixel_aspect_label.setText("Pixel Aspect") self.name_label.setText("Name")