def update_commands(self, commands): if not commands: return self.inner_widget = QtWidgets.QWidget() sp = QtWidgets.QSizePolicy() sp.setHorizontalPolicy(QtWidgets.QSizePolicy.Policy.Maximum) self.inner_widget.setSizePolicy(sp) layout = QtWidgets.QVBoxLayout() layout.setSpacing(5) for index, item in enumerate(commands, 1): if item.item == "command": new_item = Command(self.scroll_area, item.command, index, name=item.name) layout.addWidget(new_item) elif item.item == "loop": new_item = Loop(self.scroll_area, item.condition, item.commands, index, name=item.name) layout.addWidget(new_item) layout.addStretch() self.inner_widget.setLayout(layout) self.scroll_area.setWidget(self.inner_widget) self.scroll_area.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.inner_widget.setFixedWidth(self.scroll_area.width() - 3)
def init_inner(self): sp = QtWidgets.QSizePolicy() sp.setHorizontalPolicy(QtWidgets.QSizePolicy.Policy.Maximum) self.inner_widget.setSizePolicy(sp) self.scroll_area.setWidget(self.inner_widget) self.scroll_area.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.inner_widget.setFixedWidth(self.scroll_area.width() - 3)
def update_audio(self, subtitles): self.inner_widget = QtWidgets.QWidget() sp = QtWidgets.QSizePolicy() sp.setHorizontalPolicy(QtWidgets.QSizePolicy.Policy.Maximum) self.inner_widget.setSizePolicy(sp) layout = QtWidgets.QVBoxLayout() layout.setSpacing(5) for index, track in enumerate(subtitles, 1): new_item = Subtitle(self.scroll_area, track, index) layout.addWidget(new_item) layout.addStretch() self.inner_widget.setLayout(layout) self.scroll_area.setWidget(self.inner_widget) self.scroll_area.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.inner_widget.setFixedWidth(self.scroll_area.width() - 3)