def init_conversion(self): layout = QtWidgets.QHBoxLayout() self.widgets.convert_to = QtWidgets.QComboBox() self.update_codecs(self.codecs) self.widgets.convert_bitrate = QtWidgets.QComboBox() self.widgets.convert_bitrate.addItems([ f'{x}k' for x in range(32 * self.channels, (256 * self.channels) + 1, 32 * int(self.channels)) ]) self.widgets.convert_bitrate.setCurrentIndex(3) self.widgets.convert_bitrate.currentIndexChanged.connect( lambda: self.page_update()) self.widgets.convert_to.currentIndexChanged.connect( lambda: self.page_update()) layout.addWidget(QtWidgets.QLabel("Conversion: ")) layout.addWidget(self.widgets.convert_to) layout.addWidget(QtWidgets.QLabel("Bitrate: ")) layout.addWidget(self.widgets.convert_bitrate) return layout
def __init__(self, parent=None): super(About, self).__init__(parent) layout = QtWidgets.QGridLayout() self.setMinimumSize(400, 400) build_file = Path(base_path, 'build_version') label = QtWidgets.QLabel(f"<b>FastFlix</b> v{__version__}<br>" f"{f'Build: {build_file.read_text().strip()}<br>' if build_file.exists() else ''}" f"<br>Author: <a href='https://github.com/cdgriffith'>Chris Griffith</a>" f"<br>License: MIT") label.setFont(QtGui.QFont("Arial", 14)) label.setAlignment(QtCore.Qt.AlignCenter) label.setOpenExternalLinks(True) label.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) supporting_libraries_label = QtWidgets.QLabel( "Supporting libraries<br>" f"<a href='https://www.python.org/'>Python</a> {reusables.version_string} (PSF LICENSE), " f"<a href='https://wiki.qt.io/Qt_for_Python'>PySide2</a> {pyside_version} (LGPLv3)<br>" f"<a href='https://github.com/cdgriffith/Box'>python-box</a> {box_version} (MIT), " f"<a href='https://github.com/cdgriffith/Reusables'>Reusables</a> {reusables.__version__} (MIT)<br>") supporting_libraries_label.setAlignment(QtCore.Qt.AlignCenter) supporting_libraries_label.setOpenExternalLinks(True) layout.addWidget(label) layout.addWidget(supporting_libraries_label) if Path(base_path, 'bundled').exists(): bundle_label = QtWidgets.QLabel( "Bundled with: <a href='https://github.com/OpenVisualCloud/SVT-AV1'>SVT AV1</a> (Modified BSD) and " "<a href='https://www.ffmpeg.org/download.html'>ffmpeg</a> (LGPL)") bundle_label.setAlignment(QtCore.Qt.AlignCenter) bundle_label.setOpenExternalLinks(True) layout.addWidget(bundle_label) if pyinstaller: pyinstaller_label = QtWidgets.QLabel("Packaged with: <a href='https://www.pyinstaller.org/index.html'>" "PyInstaller</a>") pyinstaller_label.setAlignment(QtCore.Qt.AlignCenter) pyinstaller_label.setOpenExternalLinks(True) layout.addWidget(pyinstaller_label) replacer = '\\' license_label = QtWidgets.QLabel( f"<a href='file:///{base_path.replace(replacer, '/')}/docs/build-licenses.txt' download>LICENSES</a>") license_label.setAlignment(QtCore.Qt.AlignCenter) license_label.setOpenExternalLinks(True) layout.addWidget(license_label) self.setLayout(layout) self.show()
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__(self, parent, main): super(AV1, self).__init__(parent) self.main = main grid = QtWidgets.QGridLayout() # grid.addWidget(QtWidgets.QLabel("FFMPEG libaom-av1"), 0, 0) self.widgets = Box(fps=None, remove_hdr=None, mode=None) self.mode = 'CRF' grid.addLayout(self.init_remove_hdr(), 0, 0, 1, 2) grid.addLayout(self.init_modes(), 0, 2, 3, 3) grid.addWidget(QtWidgets.QWidget(), 5, 0) grid.setRowStretch(5, 1) guide_label = QtWidgets.QLabel( f"<a href='https://trac.ffmpeg.org/wiki/Encode/AV1'>FFMPEG AV1 Encoding Guide</a>" ) guide_label.setAlignment(QtCore.Qt.AlignBottom) guide_label.setOpenExternalLinks(True) grid.addWidget(guide_label, 9, 0, -1, 1) self.setLayout(grid) self.hide()
def __init__(self, parent, main): super(VP9, self).__init__(parent) self.main = main grid = QtWidgets.QGridLayout() # grid.addWidget(QtWidgets.QLabel("VP9"), 0, 0) self.widgets = Box( fps=None, remove_hdr=None, mode=None) self.mode = 'CRF' grid.addLayout(self.init_remove_hdr(), 2, 0, 1, 2) grid.addLayout(self.init_modes(), 0, 2, 4, 4) grid.addLayout(self.init_quality(), 1, 0, 1, 2) grid.addLayout(self.init_speed(), 0, 0, 1, 2) grid.addLayout(self.init_row_mt(), 4, 0, 1, 2) grid.addLayout(self.init_force_420(), 5, 0, 1, 2) grid.addLayout(self.init_single_pass(), 6, 0, 1, 2) grid.addWidget(QtWidgets.QWidget(), 8, 0) grid.setRowStretch(8, 1) guide_label = QtWidgets.QLabel(f"<a href='https://trac.ffmpeg.org/wiki/Encode/VP9'>FFMPEG VP9 Encoding Guide</a>") guide_label.setAlignment(QtCore.Qt.AlignBottom) guide_label.setOpenExternalLinks(True) grid.addWidget(guide_label, 9, 0, -1, 1) self.setLayout(grid) self.hide()
def __init__(self, parent, main): super(AV1, self).__init__(parent) self.main = main grid = QtWidgets.QGridLayout() self.widgets = Box(fps=None, remove_hdr=None, mode=None, segment_size=None) self.mode = 'QP' grid.addLayout(self.init_remove_hdr(), 1, 0, 1, 2) grid.addLayout(self.init_speed(), 0, 0, 1, 2) grid.addLayout(self.init_modes(), 0, 2, 4, 4) grid.addLayout(self.init_segment_size(), 3, 0, 1, 2) grid.addWidget(QtWidgets.QWidget(), 5, 0) grid.setRowStretch(5, 1) guide_label = QtWidgets.QLabel( f"<a href='https://github.com/OpenVisualCloud/SVT-AV1'>SVT-AV1 Github</a>" ) guide_label.setAlignment(QtCore.Qt.AlignBottom) guide_label.setOpenExternalLinks(True) grid.addWidget(guide_label, 9, 0, -1, 1) self.setLayout(grid) self.hide()
def init_crop(self): crop_box = QtWidgets.QGroupBox() crop_box.setStyleSheet("QGroupBox{padding-top:17px; margin-top:-18px}") crop_layout = QtWidgets.QVBoxLayout() self.widgets.crop.top, crop_top_layout = self.build_hoz_int_field( "Top ") self.widgets.crop.left, crop_hz_layout = self.build_hoz_int_field( "Left ", right_stretch=False) self.widgets.crop.right, crop_hz_layout = self.build_hoz_int_field( " Right ", left_stretch=False, layout=crop_hz_layout) self.widgets.crop.bottom, crop_bottom_layout = self.build_hoz_int_field( "Bottom ", right_stretch=True) self.widgets.crop.top.textChanged.connect(lambda: self.page_update()) self.widgets.crop.left.textChanged.connect(lambda: self.page_update()) self.widgets.crop.right.textChanged.connect(lambda: self.page_update()) self.widgets.crop.bottom.textChanged.connect( lambda: self.page_update()) label = QtWidgets.QLabel("Crop", alignment=(Qt.AlignBottom | Qt.AlignRight)) label.setStyleSheet("QLabel{color:#777}") label.setMaximumHeight(40) crop_bottom_layout.addWidget(label) crop_layout.addLayout(crop_top_layout) crop_layout.addLayout(crop_hz_layout) crop_layout.addLayout(crop_bottom_layout) crop_box.setLayout(crop_layout) return crop_box
def init_row_mt(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel('Row multithreading')) self.widgets.row_mt = QtWidgets.QCheckBox() self.widgets.row_mt.setChecked(False) self.widgets.row_mt.toggled.connect(lambda: self.main.page_update()) layout.addWidget(self.widgets.row_mt) return layout
def init_force_420(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel('Force 4:2:0 chroma subsampling')) self.widgets.force_420 = QtWidgets.QCheckBox() self.widgets.force_420.setChecked(True) self.widgets.force_420.toggled.connect(lambda: self.main.page_update()) layout.addWidget(self.widgets.force_420) return layout
def init_single_pass(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel('Single Pass (CRF)')) self.widgets.single_pass = QtWidgets.QCheckBox() self.widgets.single_pass.setChecked(False) self.widgets.single_pass.toggled.connect(lambda: self.main.page_update()) layout.addWidget(self.widgets.single_pass) return layout
def init_speed(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel('Speed')) self.widgets.speed = QtWidgets.QComboBox() self.widgets.speed.addItems([str(x) for x in range(6)]) self.widgets.speed.setCurrentIndex(0) self.widgets.speed.currentIndexChanged.connect(lambda: self.main.page_update()) layout.addWidget(self.widgets.speed) return layout
def init_quality(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel('Quality')) self.widgets.quality = QtWidgets.QComboBox() self.widgets.quality.addItems(['realtime', 'good', 'best']) self.widgets.quality.setCurrentIndex(1) self.widgets.quality.currentIndexChanged.connect(lambda: self.main.page_update()) layout.addWidget(self.widgets.quality) return layout
def init_video_track_select(self): layout = QtWidgets.QHBoxLayout() self.widgets.video_track = QtWidgets.QComboBox() self.widgets.video_track.addItems([]) self.widgets.video_track.currentIndexChanged.connect( lambda: self.page_update()) layout.addWidget(QtWidgets.QLabel("Video Track "), stretch=0) layout.addWidget(self.widgets.video_track, stretch=1) layout.setSpacing(10) return layout
def init_fps(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel("FPS")) self.widgets.fps = QtWidgets.QComboBox() self.widgets.fps.addItems([str(x) for x in range(1, 31)]) self.widgets.fps.setCurrentIndex(14) self.widgets.fps.currentIndexChanged.connect( lambda: self.main.build_commands()) layout.addWidget(self.widgets.fps) return layout
def init_remove_hdr(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel('Remove HDR')) self.widgets.remove_hdr = QtWidgets.QComboBox() self.widgets.remove_hdr.addItems(['No', 'Yes']) self.widgets.remove_hdr.setCurrentIndex(0) self.widgets.remove_hdr.setDisabled(True) self.widgets.remove_hdr.currentIndexChanged.connect(lambda: self.main.page_update()) layout.addWidget(self.widgets.remove_hdr) return layout
def init_output_type(self): layout = QtWidgets.QHBoxLayout() self.widgets.convert_to = QtWidgets.QComboBox() self.widgets.convert_to.addItems(list(self.plugins.keys())) layout.addWidget(QtWidgets.QLabel("Output: "), stretch=0) layout.addWidget(self.widgets.convert_to, stretch=1) layout.setSpacing(10) self.widgets.convert_to.currentTextChanged.connect( self.video_options.change_conversion) return layout
def init_segment_size(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel('Segment Size (seconds)')) self.widgets.segment_size = QtWidgets.QComboBox() self.widgets.segment_size.addItems( ["10", "30", "60", "90", "120", "240"]) self.widgets.segment_size.setCurrentIndex(2) self.widgets.segment_size.currentIndexChanged.connect( lambda: self.main.page_update()) layout.addWidget(self.widgets.segment_size) return layout
def __init__(self, parent, condition, commands, number, name=""): super(Loop, self).__init__(parent) layout = QtWidgets.QVBoxLayout() layout.addWidget(QtWidgets.QLabel(f"Loop: {name}")) self.condition = condition self.number = number self.setStyleSheet("QGroupBox{padding-top:15px; margin-top:-18px}") for index, item in enumerate(commands, 1): new_item = Command(parent, item.command, index, item.name) layout.addWidget(new_item) self.setLayout(layout)
def __init__(self, parent, audio, number, enabled=True): super(Subtitle, self).__init__(parent) self.audio = audio self.widget = QtWidgets.QLineEdit() self.widget.setText(audio) self.widget.setDisabled(not enabled) self.setFixedHeight(60) grid = QtWidgets.QGridLayout() grid.addWidget(QtWidgets.QLabel(f"Track {number}"), 0, 0, 1, 2) grid.addWidget(self.widget, 1, 0, 1, 2) self.setLayout(grid)
def init_preview_image(self): self.widgets.preview = QtWidgets.QLabel() self.widgets.preview.setBackgroundRole(QtGui.QPalette.Base) self.widgets.preview.setFixedSize(320, 213) self.widgets.preview.setAlignment(QtCore.Qt.AlignCenter) self.widgets.preview.setStyleSheet( 'border: 2px solid #dddddd;') # background-color:#f0f0f0 # buttons = self.init_preview_buttons() self.grid.addWidget(self.widgets.preview, 0, 10, 5, 4, (Qt.AlignTop | Qt.AlignRight))
def init_dither(self): layout = QtWidgets.QHBoxLayout() layout.addWidget(QtWidgets.QLabel('Dither')) self.widgets.dither = QtWidgets.QComboBox() self.widgets.dither.addItems([ 'sierra2_4a', 'floyd_steinberg', 'sierra2', 'bayer:bayer_scale=1', 'bayer:bayer_scale=2', 'bayer:bayer_scale=3', 'none' ]) self.widgets.dither.setCurrentIndex(0) self.widgets.dither.currentIndexChanged.connect( lambda: self.main.build_commands()) layout.addWidget(self.widgets.dither) return layout
def __init__(self, parent): super(SubtitleList, self).__init__(parent) layout = QtWidgets.QGridLayout() layout.addWidget(QtWidgets.QLabel('Subtitle Tracks')) self.inner_widget = QtWidgets.QWidget() self.scroll_area = QtWidgets.QScrollArea(self) self.scroll_area.setMinimumHeight(200) layout.addWidget(self.scroll_area) self.setLayout(layout)
def __init__(self, parent): super(CommandList, self).__init__(parent) layout = QtWidgets.QGridLayout() layout.addWidget(QtWidgets.QLabel('Commands to execute')) self.inner_widget = QtWidgets.QWidget() self.scroll_area = QtWidgets.QScrollArea(self) self.scroll_area.setMinimumHeight(200) layout.addWidget(self.scroll_area) self.setLayout(layout)
def init_input_file(self): layout = QtWidgets.QHBoxLayout() self.widgets.input_file = QtWidgets.QLineEdit("") self.widgets.input_file.setReadOnly(True) open_input_file = QtWidgets.QPushButton("...") open_input_file.setFixedWidth(50) open_input_file.setMaximumHeight(22) open_input_file.setDefault(True) layout.addWidget(QtWidgets.QLabel("Source File:")) layout.addWidget(self.widgets.input_file) layout.addWidget(open_input_file) layout.setSpacing(10) open_input_file.clicked.connect(lambda: self.open_file()) return layout
def init_scale(self): scale_area = QtWidgets.QGroupBox() scale_area.setStyleSheet( "QGroupBox{padding-top:15px; margin-top:-18px}") scale_layout = QtWidgets.QVBoxLayout() self.widgets.scale.width, new_scale_layout = self.build_hoz_int_field( "Width ", right_stretch=False) self.widgets.scale.height, new_scale_layout, lb, rb = self.build_hoz_int_field( " Height ", left_stretch=False, layout=new_scale_layout, return_buttons=True) self.widgets.scale.height.setDisabled(True) lb.setDisabled(True) rb.setDisabled(True) QtWidgets.QPushButton() # TODO scale 0 error self.widgets.scale.width.textChanged.connect( lambda: self.scale_update()) self.widgets.scale.height.textChanged.connect( lambda: self.scale_update()) bottom_row = QtWidgets.QHBoxLayout() self.widgets.scale.keep_aspect = QtWidgets.QCheckBox( "Keep aspect ratio") self.widgets.scale.keep_aspect.setMaximumHeight(40) self.widgets.scale.keep_aspect.setChecked(True) self.widgets.scale.keep_aspect.toggled.connect( lambda: self.toggle_disable((self.widgets.scale.height, lb, rb))) self.widgets.scale.keep_aspect.toggled.connect( lambda: self.scale_update()) label = QtWidgets.QLabel('Scale', alignment=(Qt.AlignBottom | Qt.AlignRight)) label.setStyleSheet("QLabel{color:#777}") label.setMaximumHeight(40) bottom_row.addWidget(self.widgets.scale.keep_aspect, alignment=Qt.AlignCenter) scale_layout.addLayout(new_scale_layout) bottom_row.addWidget(label) scale_layout.addLayout(bottom_row) scale_area.setLayout(scale_layout) return scale_area
def __init__(self, parent, command, number, name="", enabled=True): super(Command, self).__init__(parent) self.command = command self.widget = QtWidgets.QLineEdit() self.widget.setReadOnly(True) self.widget.setText(command) self.widget.setDisabled(not enabled) self.setFixedHeight(60) grid = QtWidgets.QGridLayout() grid.addWidget( QtWidgets.QLabel(f"Command {number}" if not name else name), 0, 0, 1, 2) grid.addWidget(self.widget, 1, 0, 1, 2) self.setLayout(grid)
def __init__(self, parent, available_audio_encoders): super(AudioList, self).__init__(parent) self.main = parent.main self.inner_layout = None self.available_audio_encoders = available_audio_encoders layout = QtWidgets.QGridLayout() layout.addWidget(QtWidgets.QLabel('Audio Tracks')) self.inner_widget = QtWidgets.QWidget() self.scroll_area = QtWidgets.QScrollArea(self) self.scroll_area.setMinimumHeight(200) layout.addWidget(self.scroll_area) self.tracks = [] self.setLayout(layout)
def build_hoz_int_field(self, name, button_size=22, left_stretch=True, right_stretch=True, layout=None, return_buttons=False, time_field=False): widget = QtWidgets.QLineEdit( self.number_to_time(0) if time_field else "0") widget.setFixedHeight(button_size) if not layout: layout = QtWidgets.QHBoxLayout() layout.setSpacing(0) if left_stretch: layout.addStretch() layout.addWidget(QtWidgets.QLabel(name)) minus_button = QtWidgets.QPushButton("-") minus_button.setAutoRepeat(True) minus_button.setFixedSize(button_size, button_size) minus_button.clicked.connect( lambda: self.modify_int(widget, 'minus', time_field)) plus_button = QtWidgets.QPushButton("+") plus_button.setAutoRepeat(True) plus_button.setFixedSize(button_size, button_size) plus_button.clicked.connect( lambda: self.modify_int(widget, 'add', time_field)) if not time_field: widget.setFixedWidth(40) layout.addWidget(minus_button) layout.addWidget(widget) layout.addWidget(plus_button) if right_stretch: layout.addStretch() if return_buttons: return widget, layout, minus_button, plus_button return widget, layout
def __init__(self, parent, audio, index, codec, available_audio_encoders, outdex=None, enabled=True, original=False, first=False, last=False, codecs=(), channels=2): super(Audio, self).__init__(parent) self.parent = parent self.audio = audio self.setFixedHeight(60) self.original = original self.outdex = index if self.original else outdex self.first = first self.last = last self.index = index self.codec = codec self.codecs = codecs self.channels = channels self.loading = True self.available_audio_encoders = available_audio_encoders self.widgets = Box( track_number=QtWidgets.QLabel( f'{index}:{self.outdex}' if enabled else '❌'), audio_info=QtWidgets.QLineEdit(audio), up_button=QtWidgets.QPushButton("^"), down_button=QtWidgets.QPushButton("v"), enable_check=QtWidgets.QCheckBox("Enabled"), dup_button=QtWidgets.QPushButton("➕"), delete_button=QtWidgets.QPushButton("⛔"), convert_to=None, convert_bitrate=None, ) self.widgets.enable_check.setChecked(enabled) #self.widgets.enable_check.toggled.connect(lambda: self.parent.reorder()) self.widgets.dup_button.clicked.connect(lambda: self.dup_me()) self.widgets.dup_button.setFixedWidth(20) self.widgets.delete_button.clicked.connect(lambda: self.del_me()) self.widgets.delete_button.setFixedWidth(20) self.widgets.track_number.setFixedWidth(20) grid = QtWidgets.QGridLayout() grid.addLayout(self.init_move_buttons(), 0, 0) grid.addWidget(self.widgets.track_number, 0, 1) grid.addWidget(self.widgets.audio_info, 0, 2) grid.addLayout(self.init_conversion(), 0, 3) if not original: grid.addWidget(self.widgets.delete_button, 0, 4) else: grid.addWidget(self.widgets.dup_button, 0, 5) grid.addWidget(self.widgets.enable_check, 0, 4) self.setLayout(grid) self.loading = False
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