def init_modes(self): layout = QtWidgets.QGridLayout() crf_group_box = QtWidgets.QGroupBox() crf_group_box.setStyleSheet("QGroupBox{padding-top:5px; margin-top:-18px}") crf_box_layout = QtWidgets.QHBoxLayout() bitrate_group_box = QtWidgets.QGroupBox() bitrate_group_box.setStyleSheet("QGroupBox{padding-top:5px; margin-top:-18px}") bitrate_box_layout = QtWidgets.QHBoxLayout() # rotation_dir = Path(base_path, 'data', 'rotations') # group_box.setStyleSheet("QGroupBox{padding-top:15px; margin-top:-15px; padding-bottom:-5px}") self.widgets.mode = QtWidgets.QButtonGroup() self.widgets.mode.buttonClicked.connect(self.set_mode) bitrate_radio = QtWidgets.QRadioButton("Bitrate") bitrate_radio.setFixedWidth(80) self.widgets.mode.addButton(bitrate_radio) self.widgets.bitrate = QtWidgets.QComboBox() self.widgets.bitrate.setFixedWidth(250) self.widgets.bitrate.addItems(recommended_bitrates) self.widgets.bitrate.currentIndexChanged.connect(lambda: self.main.build_commands()) self.widgets.bitrate.setCurrentIndex(6) self.widgets.custom_bitrate = QtWidgets.QLineEdit("3000") self.widgets.custom_bitrate.setFixedWidth(100) bitrate_box_layout.addWidget(bitrate_radio) bitrate_box_layout.addWidget(self.widgets.bitrate) bitrate_box_layout.addStretch() bitrate_box_layout.addWidget(QtWidgets.QLabel("Custom:")) bitrate_box_layout.addWidget(self.widgets.custom_bitrate) crf_radio = QtWidgets.QRadioButton("CRF") crf_radio.setChecked(True) crf_radio.setFixedWidth(80) self.widgets.mode.addButton(crf_radio) self.widgets.crf = QtWidgets.QComboBox() self.widgets.crf.setFixedWidth(250) self.widgets.crf.addItems(recommended_crfs) self.widgets.crf.setCurrentIndex(4) self.widgets.crf.currentIndexChanged.connect(lambda: self.main.build_commands()) self.widgets.custom_crf = QtWidgets.QLineEdit("30") self.widgets.custom_crf.setFixedWidth(100) crf_box_layout.addWidget(crf_radio) crf_box_layout.addWidget(self.widgets.crf) crf_box_layout.addStretch() crf_box_layout.addWidget(QtWidgets.QLabel("Custom:")) crf_box_layout.addWidget(self.widgets.custom_crf) bitrate_group_box.setLayout(bitrate_box_layout) crf_group_box.setLayout(crf_box_layout) layout.addWidget(crf_group_box, 0, 0) layout.addWidget(bitrate_group_box, 1, 0) return layout
def init_rotate(self): group_box = QtWidgets.QGroupBox() rotation_dir = Path(base_path, 'data', 'rotations') group_box.setStyleSheet( "QGroupBox{padding-top:15px; margin-top:-15px; padding-bottom:-5px}" ) group = QtWidgets.QButtonGroup() v_size = QtCore.QSize(40, 60) h_size = QtCore.QSize(60, 40) rot_none = QtWidgets.QRadioButton("No Rotation") rot_none.setIcon(QtGui.QIcon(str(Path(rotation_dir, 'FastFlix.png')))) rot_none.setIconSize(h_size) rot_none.name = None rot_1 = QtWidgets.QRadioButton("90°") rot_1.setIcon(QtGui.QIcon(str(Path(rotation_dir, 'FastFlix C90.png')))) rot_1.setIconSize(v_size) rot_1.name = 1 rot_2 = QtWidgets.QRadioButton("270°") rot_2.setIcon(QtGui.QIcon(str(Path(rotation_dir, 'FastFlix CC90.png')))) rot_2.setIconSize(v_size) rot_2.name = 2 rot_4 = QtWidgets.QRadioButton("180°") rot_4.setIcon(QtGui.QIcon(str(Path(rotation_dir, 'FastFlix 180.png')))) rot_4.setIconSize(h_size) rot_4.name = 4 self.widgets.v_flip = QtWidgets.QCheckBox("Vertical Flip") self.widgets.v_flip.setIcon( QtGui.QIcon(str(Path(rotation_dir, 'FastFlix VF.png')))) self.widgets.v_flip.setIconSize(h_size) self.widgets.v_flip.toggled.connect(lambda: self.page_update()) self.widgets.h_flip = QtWidgets.QCheckBox("Horizontal Flip") self.widgets.h_flip.setIcon( QtGui.QIcon(str(Path(rotation_dir, 'FastFlix HF.png')))) self.widgets.h_flip.setIconSize(h_size) self.widgets.h_flip.toggled.connect(lambda: self.page_update()) group.addButton(rot_1) group.addButton(rot_2) group.addButton(rot_4) group.addButton(rot_none) layout = QtWidgets.QGridLayout() layout.addWidget(rot_none, 1, 0) layout.addWidget(rot_1, 0, 0) layout.addWidget(rot_2, 0, 2) layout.addWidget(rot_4, 0, 1) layout.addWidget(self.widgets.v_flip, 1, 2) layout.addWidget(self.widgets.h_flip, 1, 1) label = QtWidgets.QLabel("Rotation", alignment=(Qt.AlignBottom | Qt.AlignRight)) label.setStyleSheet("QLabel{color:#777}") layout.addWidget(label, 1, 3) group_box.setLayout(layout) rot_none.setChecked(True) self.widgets.rotate = group self.widgets.rotate.buttonClicked.connect(lambda: self.page_update()) return group_box