Beispiel #1
0
    def __init__(self, base_path, file, file_config, parent=None):
        super().__init__(parent)

        board = BanBoard(file, file_config)
        board_area = QScrollArea()
        board_area.setWidget(board)
        board_area.setWidgetResizable(True)
        self.setCentralWidget(board_area)

        self.stbar = QStatusBar()

        # add a save button at the right bottom corner
        save_btn = BanButton(
            "save",
            objectName="appBtn_save",
            toolTip="save xban file",
            shortcut="Ctrl+S",
        )

        shadow = QGraphicsDropShadowEffect(self,
                                           blurRadius=10,
                                           offset=5,
                                           color=QColor("lightgrey"))
        save_btn.setGraphicsEffect(shadow)
        save_btn.pressed.connect(board.save_board)

        self.stbar.addPermanentWidget(save_btn)
        self.setStatusBar(self.stbar)
        log_handler = QLogHandler(self)
        root_logger = logging.getLogger()
        root_logger.addHandler(log_handler)
        log_handler.signal.log_msg.connect(
            partial(self.stbar.showMessage, timeout=1500))
        self.stbar.showMessage(f"Initiate {file}", 1500)
        self.show()
Beispiel #2
0
    def __init__(self, config, update_log_paths):
        super().__init__()

        # initialise the config
        self._loaded_config = config
        self._working_config = Config()
        self._default_working_config = Config()

        # setup the top menu
        self._create_actions()
        self._create_menu_bar()

        self.minimumWidth = 750

        # setup tabs
        self.tabs = QTabWidget()
        self.tabs.tabsClosable = True
        self.tabs.tabCloseRequested.connect(self.on_close_tab)

        self.metadata_tab = MetadataTab(self)
        meta_scroll_wrapper = QScrollArea()
        meta_scroll_wrapper.setWidget(self.metadata_tab)
        self.tabs.addTab(meta_scroll_wrapper, "Metadata")
        self.tabs.tabBar().setTabButton(0, QTabBar.RightSide, None)

        self.run_tab = RunTab(self)
        self.tabs.addTab(self.run_tab, "Run")
        self.tabs.tabBar().setTabButton(1, QTabBar.RightSide, None)

        # add create tab button
        self.tab_button = AddTabButton(self)
        self.tabs.setCornerWidget(self.tab_button)

        self.config_tabs = {}
        self.initialise_config_tabs(self.config)
        self.config_changed.connect(self.initialise_config_tabs)

        self.setCentralWidget(self.tabs)

        self.running_changed.connect(
            lambda b: self.menuBar().setEnabled(not b))

        self.update_log_paths = update_log_paths
Beispiel #3
0
    def onSelectedManga(self, manga_item):
        self.deleteLast()
        self.selected = manga_item

        manga = _load_manga(manga_item.meta.hash)

        summary = SummaryView(manga)

        self.layout.addWidget(summary)

        infobox = ItemInfoBox(manga_item)
        scroll = QScrollArea()
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setFrameShape(scroll.NoFrame)
        scroll.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        scroll.setWidget(infobox)

        self.layout.addWidget(scroll)
class SongSimilarityWindow(QMainWindow):
    """A list of similar songs in this group"""
    _song_similarity_list: List[Song]
    """The similarity scores for each song pair"""
    _similarity_scores: dict[tuple[Song, Song], int]
    """Parking space for all song diff guis"""
    _diff_window_list: List[SongDiffWindow]

    def __init__(self, song_similarity_list, similarity_scores):
        """Display all songs similar to one song
        :type song_similarity_list: list[Song]
        :param song_similarity_list: A list of similar songs
        :type similarity_scores: dict[tuple[Song, Song], int]
        :param similarity_scores: The similarity scores for each song pair"""
        super().__init__()
        self._song_similarity_list = song_similarity_list
        self._similarity_scores = similarity_scores
        self._diff_window_list = []

        # Main layout
        self.resize(900, 600)
        self.setWindowTitle(self._song_similarity_list[0].get_name() +
                            ' - Similar Songs')
        self.scrollableWrapper = QScrollArea()
        self.setCentralWidget(self.scrollableWrapper)

        self.centralLayout: QGridLayout = QGridLayout()
        self.centralWidget = QWidget()
        self.centralWidget.setLayout(self.centralLayout)

        self.scrollableWrapper.setWidget(self.centralWidget)
        self.scrollableWrapper.setWidgetResizable(True)

        # Add all similar songs
        row_num: int = 0
        for song in self._song_similarity_list:
            button: QPushButton = QPushButton(song.get_name(), self)
            button.clicked.connect(partial(self.show_other_songs, song))
            song.subscribe(Song.UPDATED, partial(self._song_updated, button))
            self._song_updated(button, song)
            self.centralLayout.addWidget(button, row_num, 0)
            row_num += 1

    @staticmethod
    def _song_updated(button, song):
        """The given song was updated
        :type button: QPushButton
        :param button: The button associated with this song
        :type song: Song
        :param song: The song that changed"""
        if song.is_marked_for_keeping():
            button.setStyleSheet('background-color: green')
        elif song.is_marked_for_deleting():
            button.setStyleSheet('background-color: red')

    def _clear_column(self, col_id):
        """Clear a column of all its widgets
        :type col_id: int
        :param col_id: The columns id"""
        for row_id in range(self.centralLayout.rowCount()):
            item = self.centralLayout.itemAtPosition(row_id, col_id)
            if item is not None:
                item.widget().deleteLater()
                self.centralLayout.removeItem(item)

    def show_other_songs(self, song):
        """Show all other songs to compare them
        :type song: Song
        :param song: The song to compare to"""
        # Clear old gui
        self._clear_column(1)

        # Add new gui elements
        row_num: int = -1
        for similar_song in self._song_similarity_list:
            row_num += 1
            if similar_song == song:
                self.centralLayout.addWidget(QWidget(), row_num, 1)
                continue

            similarity_score: float
            if (song, similar_song) in self._similarity_scores.keys():
                similarity_score = self._similarity_scores[(song,
                                                            similar_song)]
            else:
                similarity_score = self._similarity_scores[(similar_song,
                                                            song)]
            button: QPushButton = QPushButton(
                similar_song.get_name() + ' (' + str(similarity_score) + ')',
                self)
            button.clicked.connect(
                partial(self._show_song_diff, song, similar_song))
            self._song_updated(button, similar_song)
            similar_song.subscribe(Song.UPDATED,
                                   partial(self._song_updated, button))
            self.centralLayout.addWidget(button, row_num, 1)

    def _show_song_diff(self, orig_song, similar_song):
        """
        :type orig_song: Song
        :param orig_song: First song to compare with
        :type similar_song: Song
        :param similar_song: Second song to compare with"""
        diff_gui = SongDiffWindow(orig_song, similar_song)
        diff_gui.show()
        diff_gui.activateWindow()
        # Keep the window open
        self._diff_window_list.append(diff_gui)
class Form(QDialog):

    def __init__(self, parent=None):
        super(Form, self).__init__(parent)
        self.title = "Emoji Splitter"
        self.setWindowTitle(self.title)

        # preview_split widget
        self.preview_widget = QLabel()
        # media_preview = QPixmap('C:/Users/roela/PycharmProjects/Emojisplitter/bolkvis.png')
        # media_preview = QMovie('Naamloos.gif')  # QPixmap('Naamloos.gif')
        self.media_preview('Naamloos.gif')

        # embed preview_split in a scrollable window
        self.preview_scroll_area = QScrollArea()
        self.preview_scroll_area.setWidget(self.preview_widget)
        self.preview_scroll_area.setBackgroundRole(QPalette.Dark)
        self.preview_scroll_area.setWidgetResizable(True)

        # Create button widgets
        self.open_file_button = QPushButton("Select &File")
        self.filename = QLineEdit("C:/Users/roela/PycharmProjects/Emojisplitter/Naamloos.gif")
        self.preview_button = QPushButton("&Preview Split")
        self.fit_to_window_checkbox = QCheckBox("Fit Preview Image to &Window")
        self.horizontal_emojis_spinbox = QSpinBox()
        self.horizontal_emojis_spinbox.setMinimum(1)
        self.horizontal_emojis_label = QLabel("Number of &horizontal emojis:")
        self.horizontal_emojis_label.setBuddy(self.horizontal_emojis_spinbox)
        self.vertical_emojis_spinbox = QSpinBox()
        self.vertical_emojis_spinbox.setMinimum(1)
        self.vertical_emojis_label = QLabel("Number of &vertical emojis:")
        self.vertical_emojis_label.setBuddy(self.vertical_emojis_spinbox)
        self.split_emojis_button = QPushButton("&Split Emoji")
        self.results_folder_button = QPushButton("Open folder with &results")

        # give the button_layout a fixed width
        button_container = QWidget()
        button_container.setFixedWidth(256)

        # Create layout and add widgets
        button_layout = QVBoxLayout(button_container)
        button_layout.addWidget(self.open_file_button)
        button_layout.addWidget(self.filename)

        # Put labels next to spinboxes
        horizontal_emojis_layout = QHBoxLayout()
        horizontal_emojis_layout.addWidget(self.horizontal_emojis_label)
        horizontal_emojis_layout.addWidget(self.horizontal_emojis_spinbox)

        vertical_emojis_layout = QHBoxLayout()
        vertical_emojis_layout.addWidget(self.vertical_emojis_label)
        vertical_emojis_layout.addWidget(self.vertical_emojis_spinbox)

        button_layout.addLayout(horizontal_emojis_layout)
        button_layout.addLayout(vertical_emojis_layout)

        button_layout.addWidget(self.preview_button)
        button_layout.addWidget(self.fit_to_window_checkbox)
        button_layout.addWidget(self.split_emojis_button)
        button_layout.addWidget(self.results_folder_button)

        preview_layout = QVBoxLayout()
        # preview_layout.addWidget(self.preview_widget)
        preview_layout.addWidget(self.preview_scroll_area)

        # combine button and preview_split layout
        nested_layout = QHBoxLayout()
        nested_layout.addWidget(button_container)
        nested_layout.addLayout(preview_layout)
        # Set dialog layout
        self.setLayout(nested_layout)

        # Add button functions
        self.open_file_button.clicked.connect(self.open_file)
        self.preview_button.clicked.connect(self.preview_split)
        self.fit_to_window_checkbox.clicked.connect(self.fit_to_window)
        self.split_emojis_button.clicked.connect(self.split)
        self.results_folder_button.clicked.connect(self.open_folder_with_results)

        # update preview_split on changing value of a spinbox
        self.horizontal_emojis_spinbox.valueChanged.connect(self.preview_split)
        self.vertical_emojis_spinbox.valueChanged.connect(self.preview_split)

    # Preview the image.
    def preview_split(self):
        preview_image = emojisplitter.emojisplitter(self.filename.text(),
                                                    self.horizontal_emojis_spinbox.value(),
                                                    self.vertical_emojis_spinbox.value(),
                                                    False)
        self.preview_widget.setPixmap(preview_image)
        if self.fit_to_window_checkbox.checkState():
            self.fit_to_window()

    # Fit the image to the current window
    def fit_to_window(self):
        self.preview_widget.setPixmap(
            self.preview_widget.pixmap().scaled(self.preview_scroll_area.width(),
                                                self.preview_scroll_area.height(),
                                                aspectMode=Qt.KeepAspectRatio))

    # open file
    def open_file(self):
        self.filename.setText(QFileDialog.getOpenFileName(self, "Open Image")[0])
        self.media_preview(self.filename.text())

    def media_preview(self, filename):
        media_preview = QMovie(filename)
        self.preview_widget.setMovie(media_preview)
        self.preview_widget.movie().start()
        self.preview_widget.resize(media_preview.currentPixmap().width(), media_preview.currentPixmap().height())
        # self.preview_split()  # This immediately show where the split would be

    def split(self):
        emojisplitter.emojisplitter(self.filename.text(),
                                    self.horizontal_emojis_spinbox.value(),
                                    self.vertical_emojis_spinbox.value(),
                                    True)

    def open_folder_with_results(self):
        path = Path(self.filename.text()).parent
        webbrowser.open('file:///' + str(path))
class RemoteFileView(QWidget):
    Sg_update_files_with_new_id = Signal(str)
    Sg_add_sync_file = Signal(str)
    Sg_remove_sync_file = Signal(str)
    Sg_file_status_changed = Signal()

    def __init__(self, model: MainModel, parent=None):
        super(RemoteFileView, self).__init__(parent)

        self.env_settings = QSettings()
        self._model: RemoteFileModel = model.remote_file_model
        self.settings_model: SettingsModel = model.settings_model

        self.title = QLabel("File remoti", self)
        self.title.setAlignment(Qt.AlignLeft)
        self.title.setAccessibleName("Title")

        self.refresh_button = QPushButton("Refresh", self)
        self.refresh_button.clicked.connect(self.Sl_refresh_button_clicked)
        # scroll area
        self.scrollArea = QScrollArea()
        self.scrollArea.setAccessibleName("FileScroll")
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.horizontalScrollBar().setEnabled(False)

        # contenitore per file
        self.fileWindow = QWidget(self)
        self.fileLayout = FlowLayout()
        self.fileLayout.setContentsMargins(0, 0, 0, 0)

        self.fileWindow.setParent(self.scrollArea)
        self.fileWindow.setLayout(self.fileLayout)

        self.scrollArea.setWidget(self.fileWindow)

        header_layout = QHBoxLayout()
        header_layout.addWidget(self.title)
        header_layout.addWidget(self.refresh_button)

        layout = QVBoxLayout()
        layout.addLayout(header_layout)
        layout.addWidget(self.scrollArea)
        self.setLayout(layout)

        self.Sl_model_changed()

    @Slot()
    def Sl_model_changed(self) -> None:
        data = self._model.get_data()
        # Pulisco la vista
        for i in reversed(range(self.fileLayout.count())):
            self.fileLayout.itemAt(i).widget().setParent(None)
        # Se model.get_data ha avuto eccezioni di rete restituisce None
        if data is not None:
            list_of_files, list_of_dirs = data
            # Aggiungo le cartelle
            for i in list_of_dirs:
                self.fileLayout.addWidget(RemoteDirectoryWidget(i, self))
            # Aggiungo i file
            for i in list_of_files:
                self.fileLayout.addWidget(
                    RemoteFileWidget(i, self.settings_model))
                self.fileLayout._item_list[-1].wid.Sg_add_sync_file.connect(
                    self.Sl_add_sync_file)
                self.fileLayout._item_list[-1].wid.Sg_remove_sync_file.connect(
                    self.Sl_remove_sync_file)
                self.Sg_file_status_changed.connect(
                    self.fileLayout._item_list[-1].wid.
                    Sl_on_file_status_changed)

    @Slot(str)
    def Sl_update_files_with_new_id(self, id: str) -> None:
        self.Sg_update_files_with_new_id.emit(id)

    @Slot()
    def Sl_refresh_button_clicked(self):
        self._model.folder_queue = ["LOCAL_ROOT"]
        self.Sl_model_changed()

    @Slot()
    def Sl_add_sync_file(self, id: str) -> None:
        self.Sg_add_sync_file.emit(id)

    @Slot()
    def Sl_remove_sync_file(self, id: str) -> None:
        self.Sg_remove_sync_file.emit(id)

    @Slot()
    def Sl_file_status_changed(self) -> None:
        self.Sg_file_status_changed.emit()
Beispiel #7
0
class Ui_EditRenderPreset_UI(object):
    def setupUi(self, EditRenderPreset_UI):
        if not EditRenderPreset_UI.objectName():
            EditRenderPreset_UI.setObjectName(u"EditRenderPreset_UI")
        EditRenderPreset_UI.resize(463, 630)
        self.verticalLayout_2 = QVBoxLayout(EditRenderPreset_UI)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.mainBox = QHBoxLayout()
        self.mainBox.setObjectName(u"mainBox")
        self.formLayout_6 = QFormLayout()
        self.formLayout_6.setObjectName(u"formLayout_6")
        self.formLayout_6.setContentsMargins(-1, 20, 10, -1)
        self.groupLabel = QLabel(EditRenderPreset_UI)
        self.groupLabel.setObjectName(u"groupLabel")

        self.formLayout_6.setWidget(0, QFormLayout.LabelRole, self.groupLabel)

        self.presetNameLabel = QLabel(EditRenderPreset_UI)
        self.presetNameLabel.setObjectName(u"presetNameLabel")

        self.formLayout_6.setWidget(1, QFormLayout.LabelRole,
                                    self.presetNameLabel)

        self.preset_name = QLineEdit(EditRenderPreset_UI)
        self.preset_name.setObjectName(u"preset_name")

        self.formLayout_6.setWidget(1, QFormLayout.FieldRole, self.preset_name)

        self.label_2 = QLabel(EditRenderPreset_UI)
        self.label_2.setObjectName(u"label_2")

        self.formLayout_6.setWidget(2, QFormLayout.LabelRole, self.label_2)

        self.formatCombo = QComboBox(EditRenderPreset_UI)
        self.formatCombo.setObjectName(u"formatCombo")

        self.formLayout_6.setWidget(2, QFormLayout.FieldRole, self.formatCombo)

        self.tabWidget = QTabWidget(EditRenderPreset_UI)
        self.tabWidget.setObjectName(u"tabWidget")
        self.video_tab = QWidget()
        self.video_tab.setObjectName(u"video_tab")
        self.verticalLayout_3 = QVBoxLayout(self.video_tab)
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
        self.scrollArea = QScrollArea(self.video_tab)
        self.scrollArea.setObjectName(u"scrollArea")
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding,
                                 QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.scrollArea.sizePolicy().hasHeightForWidth())
        self.scrollArea.setSizePolicy(sizePolicy)
        self.scrollArea.setFrameShape(QFrame.NoFrame)
        self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.scrollAreaWidgetContents = QWidget()
        self.scrollAreaWidgetContents.setObjectName(
            u"scrollAreaWidgetContents")
        self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 428, 650))
        self.formLayout_3 = QFormLayout(self.scrollAreaWidgetContents)
        self.formLayout_3.setObjectName(u"formLayout_3")
        self.formLayout_3.setContentsMargins(-1, -1, 40, -1)
        self.label_4 = QLabel(self.scrollAreaWidgetContents)
        self.label_4.setObjectName(u"label_4")

        self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.label_4)

        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.resWidth = QSpinBox(self.scrollAreaWidgetContents)
        self.resWidth.setObjectName(u"resWidth")
        self.resWidth.setMinimum(1)
        self.resWidth.setMaximum(8192)
        self.resWidth.setSingleStep(2)
        self.resWidth.setValue(1)

        self.horizontalLayout_3.addWidget(self.resWidth)

        self.label_9 = QLabel(self.scrollAreaWidgetContents)
        self.label_9.setObjectName(u"label_9")
        self.label_9.setMinimumSize(QSize(10, 0))
        self.label_9.setText(u"x")
        self.label_9.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_3.addWidget(self.label_9)

        self.resHeight = QSpinBox(self.scrollAreaWidgetContents)
        self.resHeight.setObjectName(u"resHeight")
        self.resHeight.setMinimum(1)
        self.resHeight.setMaximum(8192)
        self.resHeight.setSingleStep(2)

        self.horizontalLayout_3.addWidget(self.resHeight)

        self.linkResoultion = QToolButton(self.scrollAreaWidgetContents)
        self.linkResoultion.setObjectName(u"linkResoultion")
        icon = QIcon()
        iconThemeName = u"link"
        if QIcon.hasThemeIcon(iconThemeName):
            icon = QIcon.fromTheme(iconThemeName)
        else:
            icon.addFile(u".", QSize(), QIcon.Normal, QIcon.Off)

        self.linkResoultion.setIcon(icon)
        self.linkResoultion.setCheckable(True)
        self.linkResoultion.setAutoRaise(True)

        self.horizontalLayout_3.addWidget(self.linkResoultion)

        self.formLayout_3.setLayout(0, QFormLayout.FieldRole,
                                    self.horizontalLayout_3)

        self.label_6 = QLabel(self.scrollAreaWidgetContents)
        self.label_6.setObjectName(u"label_6")

        self.formLayout_3.setWidget(1, QFormLayout.LabelRole, self.label_6)

        self.parCombo = QComboBox(self.scrollAreaWidgetContents)
        self.parCombo.setObjectName(u"parCombo")
        self.parCombo.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        self.formLayout_3.setWidget(1, QFormLayout.FieldRole, self.parCombo)

        self.label_16 = QLabel(self.scrollAreaWidgetContents)
        self.label_16.setObjectName(u"label_16")

        self.formLayout_3.setWidget(2, QFormLayout.LabelRole, self.label_16)

        self.horizontalLayout_4 = QHBoxLayout()
        self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
        self.displayAspectNum = QSpinBox(self.scrollAreaWidgetContents)
        self.displayAspectNum.setObjectName(u"displayAspectNum")
        self.displayAspectNum.setMinimum(1)
        self.displayAspectNum.setMaximum(8192)

        self.horizontalLayout_4.addWidget(self.displayAspectNum)

        self.label_17 = QLabel(self.scrollAreaWidgetContents)
        self.label_17.setObjectName(u"label_17")
        self.label_17.setMinimumSize(QSize(10, 0))
        self.label_17.setText(u":")
        self.label_17.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_4.addWidget(self.label_17)

        self.displayAspectDen = QSpinBox(self.scrollAreaWidgetContents)
        self.displayAspectDen.setObjectName(u"displayAspectDen")
        self.displayAspectDen.setMinimum(1)
        self.displayAspectDen.setMaximum(8192)

        self.horizontalLayout_4.addWidget(self.displayAspectDen)

        self.formLayout_3.setLayout(2, QFormLayout.FieldRole,
                                    self.horizontalLayout_4)

        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.framerateNum = QSpinBox(self.scrollAreaWidgetContents)
        self.framerateNum.setObjectName(u"framerateNum")
        self.framerateNum.setMinimum(1)
        self.framerateNum.setMaximum(1000000)

        self.horizontalLayout.addWidget(self.framerateNum)

        self.label_8 = QLabel(self.scrollAreaWidgetContents)
        self.label_8.setObjectName(u"label_8")
        sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(
            self.label_8.sizePolicy().hasHeightForWidth())
        self.label_8.setSizePolicy(sizePolicy1)
        self.label_8.setMinimumSize(QSize(10, 0))
        self.label_8.setText(u"/")
        self.label_8.setAlignment(Qt.AlignCenter)

        self.horizontalLayout.addWidget(self.label_8)

        self.framerateDen = QSpinBox(self.scrollAreaWidgetContents)
        self.framerateDen.setObjectName(u"framerateDen")
        self.framerateDen.setMinimum(1)
        self.framerateDen.setMaximum(9999)

        self.horizontalLayout.addWidget(self.framerateDen)

        self.formLayout_3.setLayout(3, QFormLayout.FieldRole,
                                    self.horizontalLayout)

        self.label_3 = QLabel(self.scrollAreaWidgetContents)
        self.label_3.setObjectName(u"label_3")

        self.formLayout_3.setWidget(3, QFormLayout.LabelRole, self.label_3)

        self.label_22 = QLabel(self.scrollAreaWidgetContents)
        self.label_22.setObjectName(u"label_22")

        self.formLayout_3.setWidget(4, QFormLayout.LabelRole, self.label_22)

        self.frameRateDisplay = QLabel(self.scrollAreaWidgetContents)
        self.frameRateDisplay.setObjectName(u"frameRateDisplay")
        self.frameRateDisplay.setEnabled(True)

        self.formLayout_3.setWidget(4, QFormLayout.FieldRole,
                                    self.frameRateDisplay)

        self.label_7 = QLabel(self.scrollAreaWidgetContents)
        self.label_7.setObjectName(u"label_7")

        self.formLayout_3.setWidget(5, QFormLayout.LabelRole, self.label_7)

        self.scanningCombo = QComboBox(self.scrollAreaWidgetContents)
        self.scanningCombo.addItem("")
        self.scanningCombo.addItem("")
        self.scanningCombo.setObjectName(u"scanningCombo")

        self.formLayout_3.setWidget(5, QFormLayout.FieldRole,
                                    self.scanningCombo)

        self.fieldOrderLabel = QLabel(self.scrollAreaWidgetContents)
        self.fieldOrderLabel.setObjectName(u"fieldOrderLabel")

        self.formLayout_3.setWidget(6, QFormLayout.LabelRole,
                                    self.fieldOrderLabel)

        self.fieldOrderCombo = QComboBox(self.scrollAreaWidgetContents)
        self.fieldOrderCombo.addItem("")
        self.fieldOrderCombo.addItem("")
        self.fieldOrderCombo.setObjectName(u"fieldOrderCombo")
        self.fieldOrderCombo.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        self.formLayout_3.setWidget(6, QFormLayout.FieldRole,
                                    self.fieldOrderCombo)

        self.colorspaceLabel = QLabel(self.scrollAreaWidgetContents)
        self.colorspaceLabel.setObjectName(u"colorspaceLabel")
        self.colorspaceLabel.setEnabled(False)

        self.formLayout_3.setWidget(7, QFormLayout.LabelRole,
                                    self.colorspaceLabel)

        self.colorspaceCombo = QComboBox(self.scrollAreaWidgetContents)
        self.colorspaceCombo.setObjectName(u"colorspaceCombo")
        self.colorspaceCombo.setEnabled(False)

        self.formLayout_3.setWidget(7, QFormLayout.FieldRole,
                                    self.colorspaceCombo)

        self.vCodecCombo = QComboBox(self.scrollAreaWidgetContents)
        self.vCodecCombo.setObjectName(u"vCodecCombo")
        sizePolicy2 = QSizePolicy(QSizePolicy.MinimumExpanding,
                                  QSizePolicy.Fixed)
        sizePolicy2.setHorizontalStretch(0)
        sizePolicy2.setVerticalStretch(0)
        sizePolicy2.setHeightForWidth(
            self.vCodecCombo.sizePolicy().hasHeightForWidth())
        self.vCodecCombo.setSizePolicy(sizePolicy2)

        self.formLayout_3.setWidget(8, QFormLayout.FieldRole, self.vCodecCombo)

        self.vRateControlCombo = QComboBox(self.scrollAreaWidgetContents)
        self.vRateControlCombo.setObjectName(u"vRateControlCombo")
        sizePolicy2.setHeightForWidth(
            self.vRateControlCombo.sizePolicy().hasHeightForWidth())
        self.vRateControlCombo.setSizePolicy(sizePolicy2)

        self.formLayout_3.setWidget(9, QFormLayout.FieldRole,
                                    self.vRateControlCombo)

        self.label_24 = QLabel(self.scrollAreaWidgetContents)
        self.label_24.setObjectName(u"label_24")

        self.formLayout_3.setWidget(8, QFormLayout.LabelRole, self.label_24)

        self.label_12 = QLabel(self.scrollAreaWidgetContents)
        self.label_12.setObjectName(u"label_12")

        self.formLayout_3.setWidget(9, QFormLayout.LabelRole, self.label_12)

        self.default_vbitrate_label = QLabel(self.scrollAreaWidgetContents)
        self.default_vbitrate_label.setObjectName(u"default_vbitrate_label")

        self.formLayout_3.setWidget(10, QFormLayout.LabelRole,
                                    self.default_vbitrate_label)

        self.default_vbitrate = QSpinBox(self.scrollAreaWidgetContents)
        self.default_vbitrate.setObjectName(u"default_vbitrate")
        self.default_vbitrate.setMaximum(500000)

        self.formLayout_3.setWidget(10, QFormLayout.FieldRole,
                                    self.default_vbitrate)

        self.vBuffer_label = QLabel(self.scrollAreaWidgetContents)
        self.vBuffer_label.setObjectName(u"vBuffer_label")

        self.formLayout_3.setWidget(11, QFormLayout.LabelRole,
                                    self.vBuffer_label)

        self.vBuffer = QSpinBox(self.scrollAreaWidgetContents)
        self.vBuffer.setObjectName(u"vBuffer")
        self.vBuffer.setMaximum(9999)

        self.formLayout_3.setWidget(11, QFormLayout.FieldRole, self.vBuffer)

        self.vquality_label = QLabel(self.scrollAreaWidgetContents)
        self.vquality_label.setObjectName(u"vquality_label")

        self.formLayout_3.setWidget(12, QFormLayout.LabelRole,
                                    self.vquality_label)

        self.default_vquality = QSpinBox(self.scrollAreaWidgetContents)
        self.default_vquality.setObjectName(u"default_vquality")
        self.default_vquality.setMaximum(500000)

        self.formLayout_3.setWidget(12, QFormLayout.FieldRole,
                                    self.default_vquality)

        self.label_26 = QLabel(self.scrollAreaWidgetContents)
        self.label_26.setObjectName(u"label_26")

        self.formLayout_3.setWidget(13, QFormLayout.LabelRole, self.label_26)

        self.gopSpinner = QSpinBox(self.scrollAreaWidgetContents)
        self.gopSpinner.setObjectName(u"gopSpinner")
        self.gopSpinner.setMaximum(999)
        self.gopSpinner.setSingleStep(1)

        self.formLayout_3.setWidget(13, QFormLayout.FieldRole, self.gopSpinner)

        self.fixedGop = QCheckBox(self.scrollAreaWidgetContents)
        self.fixedGop.setObjectName(u"fixedGop")
        self.fixedGop.setEnabled(False)

        self.formLayout_3.setWidget(14, QFormLayout.FieldRole, self.fixedGop)

        self.bFramesSpinner = QSpinBox(self.scrollAreaWidgetContents)
        self.bFramesSpinner.setObjectName(u"bFramesSpinner")
        self.bFramesSpinner.setEnabled(False)
        self.bFramesSpinner.setMinimum(-1)
        self.bFramesSpinner.setMaximum(8)
        self.bFramesSpinner.setValue(-1)

        self.formLayout_3.setWidget(15, QFormLayout.FieldRole,
                                    self.bFramesSpinner)

        self.bFramesLabel = QLabel(self.scrollAreaWidgetContents)
        self.bFramesLabel.setObjectName(u"bFramesLabel")

        self.formLayout_3.setWidget(15, QFormLayout.LabelRole,
                                    self.bFramesLabel)

        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        self.verticalLayout_3.addWidget(self.scrollArea)

        self.tabWidget.addTab(self.video_tab, "")
        self.audio_tab = QWidget()
        self.audio_tab.setObjectName(u"audio_tab")
        self.formLayout_2 = QFormLayout(self.audio_tab)
        self.formLayout_2.setObjectName(u"formLayout_2")
        self.label_15 = QLabel(self.audio_tab)
        self.label_15.setObjectName(u"label_15")

        self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.label_15)

        self.audioChannels = QComboBox(self.audio_tab)
        self.audioChannels.setObjectName(u"audioChannels")

        self.formLayout_2.setWidget(0, QFormLayout.FieldRole,
                                    self.audioChannels)

        self.label_13 = QLabel(self.audio_tab)
        self.label_13.setObjectName(u"label_13")

        self.formLayout_2.setWidget(1, QFormLayout.LabelRole, self.label_13)

        self.aCodecCombo = QComboBox(self.audio_tab)
        self.aCodecCombo.setObjectName(u"aCodecCombo")

        self.formLayout_2.setWidget(1, QFormLayout.FieldRole, self.aCodecCombo)

        self.label_11 = QLabel(self.audio_tab)
        self.label_11.setObjectName(u"label_11")

        self.formLayout_2.setWidget(2, QFormLayout.LabelRole, self.label_11)

        self.horizontalLayout_5 = QHBoxLayout()
        self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
        self.audioSampleRate = QComboBox(self.audio_tab)
        self.audioSampleRate.addItem("")
        self.audioSampleRate.addItem("")
        self.audioSampleRate.addItem("")
        self.audioSampleRate.addItem("")
        self.audioSampleRate.addItem("")
        self.audioSampleRate.addItem("")
        self.audioSampleRate.addItem("")
        self.audioSampleRate.addItem("")
        self.audioSampleRate.setObjectName(u"audioSampleRate")
        self.audioSampleRate.setEditable(True)

        self.horizontalLayout_5.addWidget(self.audioSampleRate)

        self.label_20 = QLabel(self.audio_tab)
        self.label_20.setObjectName(u"label_20")

        self.horizontalLayout_5.addWidget(self.label_20)

        self.formLayout_2.setLayout(2, QFormLayout.FieldRole,
                                    self.horizontalLayout_5)

        self.label_14 = QLabel(self.audio_tab)
        self.label_14.setObjectName(u"label_14")

        self.formLayout_2.setWidget(3, QFormLayout.LabelRole, self.label_14)

        self.aRateControlCombo = QComboBox(self.audio_tab)
        self.aRateControlCombo.setObjectName(u"aRateControlCombo")

        self.formLayout_2.setWidget(3, QFormLayout.FieldRole,
                                    self.aRateControlCombo)

        self.label_18 = QLabel(self.audio_tab)
        self.label_18.setObjectName(u"label_18")

        self.formLayout_2.setWidget(4, QFormLayout.LabelRole, self.label_18)

        self.aBitrate = QSpinBox(self.audio_tab)
        self.aBitrate.setObjectName(u"aBitrate")
        self.aBitrate.setMaximum(500000)

        self.formLayout_2.setWidget(4, QFormLayout.FieldRole, self.aBitrate)

        self.label_19 = QLabel(self.audio_tab)
        self.label_19.setObjectName(u"label_19")

        self.formLayout_2.setWidget(5, QFormLayout.LabelRole, self.label_19)

        self.aQuality = QSpinBox(self.audio_tab)
        self.aQuality.setObjectName(u"aQuality")
        self.aQuality.setMaximum(500000)

        self.formLayout_2.setWidget(5, QFormLayout.FieldRole, self.aQuality)

        self.tabWidget.addTab(self.audio_tab, "")
        self.tab = QWidget()
        self.tab.setObjectName(u"tab")
        self.verticalLayout = QVBoxLayout(self.tab)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.speedsLabel = QLabel(self.tab)
        self.speedsLabel.setObjectName(u"speedsLabel")

        self.verticalLayout.addWidget(self.speedsLabel)

        self.speeds_list = QTextEdit(self.tab)
        self.speeds_list.setObjectName(u"speeds_list")
        self.speeds_list.setAcceptRichText(False)

        self.verticalLayout.addWidget(self.speeds_list)

        self.label = QLabel(self.tab)
        self.label.setObjectName(u"label")

        self.verticalLayout.addWidget(self.label)

        self.overrideParamsWarning = KMessageWidget(self.tab)
        self.overrideParamsWarning.setObjectName(u"overrideParamsWarning")
        self.overrideParamsWarning.setProperty("wordWrap", True)
        self.overrideParamsWarning.setProperty("closeButtonVisible", False)

        self.verticalLayout.addWidget(self.overrideParamsWarning)

        self.additionalParams = QPlainTextEdit(self.tab)
        self.additionalParams.setObjectName(u"additionalParams")

        self.verticalLayout.addWidget(self.additionalParams)

        self.parametersLabel = QLabel(self.tab)
        self.parametersLabel.setObjectName(u"parametersLabel")
        self.parametersLabel.setTextFormat(Qt.RichText)
        self.parametersLabel.setWordWrap(True)
        self.parametersLabel.setOpenExternalLinks(True)

        self.verticalLayout.addWidget(self.parametersLabel)

        self.tabWidget.addTab(self.tab, "")

        self.formLayout_6.setWidget(4, QFormLayout.SpanningRole,
                                    self.tabWidget)

        self.parameters = QTextEdit(EditRenderPreset_UI)
        self.parameters.setObjectName(u"parameters")
        self.parameters.setReadOnly(True)
        self.parameters.setAcceptRichText(False)

        self.formLayout_6.setWidget(5, QFormLayout.SpanningRole,
                                    self.parameters)

        self.groupName = QComboBox(EditRenderPreset_UI)
        self.groupName.setObjectName(u"groupName")
        sizePolicy2.setHeightForWidth(
            self.groupName.sizePolicy().hasHeightForWidth())
        self.groupName.setSizePolicy(sizePolicy2)
        self.groupName.setEditable(True)
        self.groupName.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        self.formLayout_6.setWidget(0, QFormLayout.FieldRole, self.groupName)

        self.mainBox.addLayout(self.formLayout_6)

        self.verticalLayout_2.addLayout(self.mainBox)

        self.buttonBox = QDialogButtonBox(EditRenderPreset_UI)
        self.buttonBox.setObjectName(u"buttonBox")
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok)

        self.verticalLayout_2.addWidget(self.buttonBox)

        self.retranslateUi(EditRenderPreset_UI)
        self.buttonBox.rejected.connect(EditRenderPreset_UI.reject)

        self.tabWidget.setCurrentIndex(0)

        QMetaObject.connectSlotsByName(EditRenderPreset_UI)

    # setupUi

    def retranslateUi(self, EditRenderPreset_UI):
        EditRenderPreset_UI.setWindowTitle(
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"Save Render Preset", None))
        self.groupLabel.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Group:", None))
        self.presetNameLabel.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Preset name:",
                                       None))
        self.label_2.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Container:",
                                       None))
        self.label_4.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Resolution:",
                                       None))
        self.linkResoultion.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"...", None))
        self.label_6.setText(
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"Pixel Aspect Ratio:", None))
        self.label_16.setText(
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"Display Aspect Ratio:", None))
        self.label_3.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Frame Rate:",
                                       None))
        self.label_22.setText(
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"Fields per Second:", None))
        self.frameRateDisplay.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Placeholder",
                                       None))
        self.label_7.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Scanning:",
                                       None))
        self.scanningCombo.setItemText(
            0,
            QCoreApplication.translate("EditRenderPreset_UI", u"Interlaced",
                                       None))
        self.scanningCombo.setItemText(
            1,
            QCoreApplication.translate("EditRenderPreset_UI", u"Progressive",
                                       None))

        self.fieldOrderLabel.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Field Order:",
                                       None))
        self.fieldOrderCombo.setItemText(
            0,
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"Bottom Field First", None))
        self.fieldOrderCombo.setItemText(
            1,
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"Top Field First", None))

        self.colorspaceLabel.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Colorspace:",
                                       None))
        self.label_24.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Codec:", None))
        self.label_12.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Rate Control:",
                                       None))
        self.default_vbitrate_label.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Bitrate:",
                                       None))
        self.default_vbitrate.setSuffix(
            QCoreApplication.translate("EditRenderPreset_UI", u"k", None))
        self.vBuffer_label.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Buffer Size:",
                                       None))
        self.vBuffer.setSuffix(
            QCoreApplication.translate("EditRenderPreset_UI", u" KiB", None))
        self.vquality_label.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Quality:",
                                       None))
        #if QT_CONFIG(tooltip)
        self.label_26.setToolTip(
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"GOP = Group of Pictures", None))
        #endif // QT_CONFIG(tooltip)
        self.label_26.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"GOP:", None))
        self.gopSpinner.setSpecialValueText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Auto", None))
        self.gopSpinner.setSuffix(
            QCoreApplication.translate("EditRenderPreset_UI", u" frame(s)",
                                       None))
        #if QT_CONFIG(tooltip)
        self.fixedGop.setToolTip(
            QCoreApplication.translate(
                "EditRenderPreset_UI",
                u"A fixed GOP means that keyframes will not be inserted at detected scene changes.",
                None))
        #endif // QT_CONFIG(tooltip)
        self.fixedGop.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Fixed", None))
        self.bFramesSpinner.setSpecialValueText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Auto", None))
        self.bFramesSpinner.setSuffix(
            QCoreApplication.translate("EditRenderPreset_UI", u" frame(s)",
                                       None))
        self.bFramesLabel.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"B Frames:",
                                       None))
        self.tabWidget.setTabText(
            self.tabWidget.indexOf(self.video_tab),
            QCoreApplication.translate("EditRenderPreset_UI", u"Video", None))
        self.label_15.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Channels:",
                                       None))
        self.label_13.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Codec:", None))
        self.label_11.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Sample Rate:",
                                       None))
        self.audioSampleRate.setItemText(
            0, QCoreApplication.translate("EditRenderPreset_UI", u"8000",
                                          None))
        self.audioSampleRate.setItemText(
            1, QCoreApplication.translate("EditRenderPreset_UI", u"12000",
                                          None))
        self.audioSampleRate.setItemText(
            2, QCoreApplication.translate("EditRenderPreset_UI", u"16000",
                                          None))
        self.audioSampleRate.setItemText(
            3, QCoreApplication.translate("EditRenderPreset_UI", u"22050",
                                          None))
        self.audioSampleRate.setItemText(
            4, QCoreApplication.translate("EditRenderPreset_UI", u"32000",
                                          None))
        self.audioSampleRate.setItemText(
            5, QCoreApplication.translate("EditRenderPreset_UI", u"44100",
                                          None))
        self.audioSampleRate.setItemText(
            6, QCoreApplication.translate("EditRenderPreset_UI", u"48000",
                                          None))
        self.audioSampleRate.setItemText(
            7, QCoreApplication.translate("EditRenderPreset_UI", u"96000",
                                          None))

        self.label_20.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Hz", None))
        self.label_14.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Rate Control:",
                                       None))
        self.label_18.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Bitrate:",
                                       None))
        self.aBitrate.setSuffix(
            QCoreApplication.translate("EditRenderPreset_UI", u"k", None))
        self.label_19.setText(
            QCoreApplication.translate("EditRenderPreset_UI", u"Quality:",
                                       None))
        self.tabWidget.setTabText(
            self.tabWidget.indexOf(self.audio_tab),
            QCoreApplication.translate("EditRenderPreset_UI", u"Audio", None))
        self.speedsLabel.setText(
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"Speed options:", None))
        #if QT_CONFIG(tooltip)
        self.speeds_list.setToolTip(
            QCoreApplication.translate(
                "EditRenderPreset_UI",
                u"One line of options per speedup step, from slowest to fastest",
                None))
        #endif // QT_CONFIG(tooltip)
        self.label.setText(
            QCoreApplication.translate("EditRenderPreset_UI",
                                       u"Additional Parameters:", None))
        self.parametersLabel.setText(
            QCoreApplication.translate(
                "EditRenderPreset_UI",
                u"<html><head/><body><p>See <a href=\"https://www.mltframework.org/plugins/ConsumerAvformat/\"><span style=\" text-decoration: underline; color:#2980b9;\">MLT documentation</span></a> for reference.</p></body></html>",
                None))
        self.tabWidget.setTabText(
            self.tabWidget.indexOf(self.tab),
            QCoreApplication.translate("EditRenderPreset_UI", u"Other", None))
Beispiel #8
0
class Config(QWidget):
    def __init__(self):
        super().__init__()
        # global self.config_params

        self.xml_root = None

        # self.tab = QWidget()
        # self.tabs.resize(200,5)

        #-------------------------------------------
        label_width = 110
        domain_value_width = 100
        value_width = 60
        label_height = 20
        units_width = 70

        self.scroll = QScrollArea()  # might contain centralWidget

        self.config_params = QWidget()
        self.vbox = QVBoxLayout()
        self.vbox.addStretch(0)

        #============  Domain ================================
        label = QLabel("Domain (micron)")
        label.setFixedHeight(label_height)
        label.setStyleSheet("background-color: orange")
        label.setAlignment(QtCore.Qt.AlignCenter)
        self.vbox.addWidget(label)

        hbox = QHBoxLayout()

        label = QLabel("Xmin")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.xmin = QLineEdit()
        self.xmin.setFixedWidth(domain_value_width)
        self.xmin.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.xmin)

        label = QLabel("Xmax")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.xmax = QLineEdit()
        self.xmax.setFixedWidth(domain_value_width)
        self.xmax.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.xmax)

        label = QLabel("dx")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.xdel = QLineEdit()
        self.xdel.setFixedWidth(value_width)
        self.xdel.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.xdel)

        self.vbox.addLayout(hbox)
        #----------
        hbox = QHBoxLayout()
        label = QLabel("Ymin")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.ymin = QLineEdit()
        self.ymin.setFixedWidth(domain_value_width)
        self.ymin.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.ymin)

        label = QLabel("Ymax")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.ymax = QLineEdit()
        self.ymax.setFixedWidth(domain_value_width)
        self.ymax.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.ymax)

        label = QLabel("dy")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.ydel = QLineEdit()
        self.ydel.setFixedWidth(value_width)
        self.ydel.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.ydel)

        self.vbox.addLayout(hbox)
        #----------
        hbox = QHBoxLayout()
        label = QLabel("Zmin")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.zmin = QLineEdit()
        self.zmin.setFixedWidth(domain_value_width)
        self.zmin.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.zmin)

        label = QLabel("Zmax")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.zmax = QLineEdit()
        self.zmax.setFixedWidth(domain_value_width)
        self.zmax.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.zmax)

        label = QLabel("dz")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.zdel = QLineEdit()
        self.zdel.setFixedWidth(value_width)
        self.zdel.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.zdel)

        self.vbox.addLayout(hbox)
        #----------
        hbox = QHBoxLayout()
        self.virtual_walls = QCheckBox("Virtual walls")
        # self.motility_enabled.setAlignment(QtCore.Qt.AlignRight)
        # label.setFixedWidth(label_width)
        hbox.addWidget(self.virtual_walls)
        self.vbox.addLayout(hbox)

        # self.vbox.addWidget(QHLine())

        #============  Misc ================================
        label = QLabel("Misc runtime parameters")
        label.setFixedHeight(label_height)
        label.setStyleSheet("background-color: orange")
        label.setAlignment(QtCore.Qt.AlignCenter)
        self.vbox.addWidget(label)

        hbox = QHBoxLayout()
        # hbox.setFixedHeight(label_width)

        label = QLabel("Max Time")
        # label_width = 210
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)

        self.max_time = QLineEdit()
        # self.max_time.setFixedWidth(200)
        self.max_time.setFixedWidth(domain_value_width)
        self.max_time.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.max_time)

        label = QLabel("min")
        label.setFixedWidth(units_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        self.vbox.addLayout(hbox)
        #----------
        hbox = QHBoxLayout()

        label = QLabel("# threads")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)

        self.num_threads = QLineEdit()
        # self.num_threads.setFixedWidth(value_width)
        self.num_threads.setFixedWidth(domain_value_width)
        self.num_threads.setValidator(QtGui.QIntValidator())
        hbox.addWidget(self.num_threads)

        label = QLabel("   ")
        label.setFixedWidth(units_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        self.vbox.addLayout(hbox)

        #------------------
        hbox = QHBoxLayout()

        label = QLabel("Save data:")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        #------
        self.save_svg = QCheckBox("SVG")
        # self.motility_2D.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(self.save_svg)

        label = QLabel("every")
        # label_width = 210
        # label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)

        self.svg_interval = QLineEdit()
        self.svg_interval.setFixedWidth(value_width)
        self.svg_interval.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.svg_interval)

        label = QLabel("min")
        # label.setFixedWidth(units_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        #------
        self.save_full = QCheckBox("Full")
        # self.motility_2D.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(self.save_full)

        label = QLabel("every")
        # label_width = 210
        # label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)

        self.full_interval = QLineEdit()
        self.full_interval.setFixedWidth(value_width)
        self.full_interval.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.full_interval)

        label = QLabel("min")
        # label.setFixedWidth(units_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        self.vbox.addLayout(hbox)

        #============  Cells IC ================================
        label = QLabel("Initial conditions of cells (x,y,z, type)")
        label.setFixedHeight(label_height)
        label.setStyleSheet("background-color: orange")
        label.setAlignment(QtCore.Qt.AlignCenter)

        self.vbox.addWidget(label)
        self.cells_csv = QCheckBox("config/cells.csv")
        self.vbox.addWidget(self.cells_csv)

        #--------------------------
        # Dummy widget for filler??
        # label = QLabel("")
        # label.setFixedHeight(1000)
        # # label.setStyleSheet("background-color: orange")
        # label.setAlignment(QtCore.Qt.AlignCenter)
        # self.vbox.addWidget(label)

        self.vbox.addStretch()

        #==================================================================
        self.config_params.setLayout(self.vbox)

        self.scroll.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.scroll.setWidgetResizable(True)

        self.scroll.setWidget(
            self.config_params)  # self.config_params = QWidget()

        self.layout = QVBoxLayout(self)

        self.layout.addWidget(self.scroll)

    # @QtCore.Slot()
    # def save_xml(self):
    #     # self.text.setText(random.choice(self.hello))
    #     pass

    def fill_gui(self):

        self.xmin.setText(self.xml_root.find(".//x_min").text)
        self.xmax.setText(self.xml_root.find(".//x_max").text)
        self.xdel.setText(self.xml_root.find(".//dx").text)

        self.ymin.setText(self.xml_root.find(".//y_min").text)
        self.ymax.setText(self.xml_root.find(".//y_max").text)
        self.ydel.setText(self.xml_root.find(".//dy").text)

        self.zmin.setText(self.xml_root.find(".//z_min").text)
        self.zmax.setText(self.xml_root.find(".//z_max").text)
        self.zdel.setText(self.xml_root.find(".//dz").text)

        self.max_time.setText(self.xml_root.find(".//max_time").text)

        self.num_threads.setText(self.xml_root.find(".//omp_num_threads").text)

        self.svg_interval.setText(self.xml_root.find(".//SVG//interval").text)
        # NOTE: do this *after* filling the mcds_interval, directly above, due to the callback/constraints on them??
        if self.xml_root.find(".//SVG//enable").text.lower() == 'true':
            self.save_svg.setChecked(True)
        else:
            self.save_svg.setChecked(False)

        self.full_interval.setText(
            self.xml_root.find(".//full_data//interval").text)
        if self.xml_root.find(".//full_data//enable").text.lower() == 'true':
            self.save_full.setChecked(True)
        else:
            self.save_full.setChecked(False)

    # Read values from the GUI widgets and generate/write a new XML
    def fill_xml(self):
        # pass
        # self.xmin.setText(self.xml_root.find(".//x_min").text)
        print("config_tab: fill_xml: xmin=", str(self.xmin.text))
        self.xml_root.find(".//x_min").text = self.xmin.text()
        self.xml_root.find(".//x_max").text = self.xmax.text()
        self.xml_root.find(".//dx").text = self.xdel.text()

        self.xml_root.find(".//y_min").text = self.ymin.text()
        self.xml_root.find(".//y_max").text = self.ymax.text()
        self.xml_root.find(".//dy").text = self.ydel.text()

        self.xml_root.find(".//z_min").text = self.zmin.text()
        self.xml_root.find(".//z_max").text = self.zmax.text()
        self.xml_root.find(".//dz").text = self.zdel.text()

        if not self.xml_root.find(".//virtual_wall_at_domain_edge"):
            # create it?
            print("config_tab.py: no virtual_wall_at_domain_edge tag")
        else:
            if self.virtual_walls.isChecked():
                self.xml_root.find(
                    ".//virtual_wall_at_domain_edge").text = 'true'
            else:
                self.xml_root.find(
                    ".//virtual_wall_at_domain_edge").text = 'false'

        self.xml_root.find(".//max_time").text = self.max_time.text()
        self.xml_root.find(".//omp_num_threads").text = self.num_threads.text()

        if self.save_svg.isChecked():
            self.xml_root.find(".//SVG//enable").text = 'true'
        else:
            self.xml_root.find(".//SVG//enable").text = 'false'
        self.xml_root.find(".//SVG//interval").text = self.svg_interval.text()

        if self.save_full.isChecked():
            self.xml_root.find(".//full_data//enable").text = 'true'
        else:
            self.xml_root.find(".//full_data//enable").text = 'false'
        self.xml_root.find(
            ".//full_data//interval").text = self.full_interval.text()

        if self.cells_csv.isChecked():
            self.xml_root.find(".//initial_conditions//cell_positions"
                               ).attrib['enabled'] = 'true'
        else:
            self.xml_root.find(".//initial_conditions//cell_positions"
                               ).attrib['enabled'] = 'false'
Beispiel #9
0
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(500, 400)
        Dialog.setSizeGripEnabled(False)
        self.main_layout = QVBoxLayout(Dialog)
        self.main_layout.setObjectName(u"main_layout")
        self.scrollArea = QScrollArea(Dialog)
        self.scrollArea.setObjectName(u"scrollArea")
        self.scrollArea.setWidgetResizable(True)
        self.credits_list = QWidget()
        self.credits_list.setObjectName(u"credits_list")
        self.credits_list.setGeometry(QRect(0, 0, 480, 349))
        self.credits_layout = QGridLayout(self.credits_list)
        self.credits_layout.setObjectName(u"credits_layout")
        self.version_label = QLabel(self.credits_list)
        self.version_label.setObjectName(u"version_label")
        self.version_label.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                        | Qt.AlignVCenter)

        self.credits_layout.addWidget(self.version_label, 0, 0, 1, 1)

        self.version = QLabel(self.credits_list)
        self.version.setObjectName(u"version")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.version.sizePolicy().hasHeightForWidth())
        self.version.setSizePolicy(sizePolicy)

        self.credits_layout.addWidget(self.version, 0, 1, 1, 1)

        self.scrollArea.setWidget(self.credits_list)

        self.main_layout.addWidget(self.scrollArea)

        self.buttonBox = QDialogButtonBox(Dialog)
        self.buttonBox.setObjectName(u"buttonBox")
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok)

        self.main_layout.addWidget(self.buttonBox)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)

        QMetaObject.connectSlotsByName(Dialog)

    # setupUi

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QCoreApplication.translate("Dialog", u"About {application_name}",
                                       None))
        self.version_label.setText(
            QCoreApplication.translate("Dialog", u"Zero Play Version:", None))
        self.version.setText(QCoreApplication.translate(
            "Dialog", u"0.0", None))
Beispiel #10
0
class Config(QWidget):
    def __init__(self):
        super().__init__()
        # global self.params_cell_def

        self.tab = QWidget()
        # self.tabs.resize(200,5)

        #-------------------------------------------
        label_width = 110
        domain_value_width = 100
        value_width = 60
        label_height = 20
        units_width = 70

        self.scroll = QScrollArea()  # might contain centralWidget

        self.params_cell_def = QWidget()
        self.vbox = QVBoxLayout()
        self.vbox.addStretch(0)

        #============  Domain ================================
        label = QLabel("Domain (micron)")
        label.setFixedHeight(label_height)
        label.setStyleSheet("background-color: orange")
        label.setAlignment(QtCore.Qt.AlignCenter)
        self.vbox.addWidget(label)

        hbox = QHBoxLayout()

        label = QLabel("Xmin")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.xmin = QLineEdit()
        self.xmin.setFixedWidth(domain_value_width)
        self.xmin.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.xmin)

        label = QLabel("Xmax")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.xmax = QLineEdit()
        self.xmax.setFixedWidth(domain_value_width)
        self.xmax.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.xmax)

        self.vbox.addLayout(hbox)
        #----------
        hbox = QHBoxLayout()

        label = QLabel("Ymin")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.ymin = QLineEdit()
        self.ymin.setFixedWidth(domain_value_width)
        self.ymin.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.ymin)

        label = QLabel("Ymax")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)
        self.ymax = QLineEdit()
        self.ymax.setFixedWidth(domain_value_width)
        self.ymax.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.ymax)

        self.vbox.addLayout(hbox)
        #----------
        hbox = QHBoxLayout()
        self.virtual_walls = QCheckBox("Virtual walls")
        # self.motility_enabled.setAlignment(QtCore.Qt.AlignRight)
        # label.setFixedWidth(label_width)
        hbox.addWidget(self.virtual_walls)
        self.vbox.addLayout(hbox)

        self.vbox.addWidget(QHLine())

        #----------
        hbox = QHBoxLayout()
        # hbox.setFixedHeight(label_width)

        label = QLabel("Max Time")
        # label_width = 210
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)

        self.max_time = QLineEdit()
        self.max_time.setFixedWidth(200)
        self.max_time.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.max_time)

        label = QLabel("min")
        label.setFixedWidth(units_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        self.vbox.addLayout(hbox)
        #----------
        hbox = QHBoxLayout()

        label = QLabel("# threads")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)

        self.num_threads = QLineEdit()
        self.num_threads.setFixedWidth(value_width)
        self.num_threads.setValidator(QtGui.QIntValidator())
        hbox.addWidget(self.num_threads)

        self.vbox.addLayout(hbox)

        #------------------
        hbox = QHBoxLayout()

        label = QLabel("Save data:")
        label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        #------
        self.save_svg = QCheckBox("SVG")
        # self.motility_2D.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(self.save_svg)

        label = QLabel("every")
        # label_width = 210
        # label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)

        self.svg_interval = QLineEdit()
        self.svg_interval.setFixedWidth(value_width)
        self.svg_interval.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.svg_interval)

        label = QLabel("min")
        # label.setFixedWidth(units_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        #------
        self.save_svg = QCheckBox("Full")
        # self.motility_2D.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(self.save_svg)

        label = QLabel("every")
        # label_width = 210
        # label.setFixedWidth(label_width)
        label.setAlignment(QtCore.Qt.AlignRight)
        hbox.addWidget(label)

        self.full_interval = QLineEdit()
        self.full_interval.setFixedWidth(value_width)
        self.full_interval.setValidator(QtGui.QDoubleValidator())
        hbox.addWidget(self.full_interval)

        label = QLabel("min")
        # label.setFixedWidth(units_width)
        label.setAlignment(QtCore.Qt.AlignLeft)
        hbox.addWidget(label)

        self.vbox.addLayout(hbox)

        #--------------
        self.cells_csv = QCheckBox("cells.csv")
        self.vbox.addWidget(self.cells_csv)

        #--------------------------
        # Dummy widget for filler??
        label = QLabel("")
        label.setFixedHeight(300)
        # label.setStyleSheet("background-color: orange")
        label.setAlignment(QtCore.Qt.AlignCenter)
        self.vbox.addWidget(label)

        #==================================================================
        self.params_cell_def.setLayout(self.vbox)

        self.scroll.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.scroll.setWidgetResizable(True)
        self.scroll.setWidget(self.params_cell_def)

        self.layout = QVBoxLayout(self)

        self.layout.addWidget(self.scroll)
Beispiel #11
0
class MainWidget(TritonWidget):
    def __init__(self, base):
        TritonWidget.__init__(self, base)
        self.addOTP = None
        self.closeEvent = self.widgetDeleted

        self.setWindowTitle('TritonAuth')
        self.setBackgroundColor(self, Qt.white)

        self.menu = QMenuBar()
        self.addMenu = self.menu.addMenu('Add')
        self.authAction = QAction('Authenticator', self)
        self.authAction.triggered.connect(self.openAddOTP)
        self.steamAction = QAction('Steam', self)
        self.steamAction.triggered.connect(self.openAddSteam)

        self.addMenu.addAction(self.authAction)
        self.addMenu.addAction(self.steamAction)

        self.sortMenu = self.menu.addMenu('Sort')
        self.nameAction = QAction('Sort by name', self)
        self.nameAction.triggered.connect(self.sortByName)

        self.sortMenu.addAction(self.nameAction)

        self.exportMenu = self.menu.addMenu('Export')
        self.andOTPAction = QAction('Export to andOTP', self)
        self.andOTPAction.triggered.connect(self.exportToAndOTP)

        self.exportMenu.addAction(self.andOTPAction)

        self.widget = QWidget()
        self.widget.setContentsMargins(10, 10, 10, 10)

        self.scrollArea = QScrollArea()
        self.scrollArea.setFixedSize(400, 495)
        self.scrollArea.setWidgetResizable(True)
        self.scrollWidget = QWidget()
        self.scrollLayout = QVBoxLayout(self.scrollWidget)
        self.scrollLayout.setAlignment(Qt.AlignTop)

        self.createAccounts()

        self.scrollArea.setWidget(self.scrollWidget)

        self.widgetLayout = QVBoxLayout(self.widget)
        self.widgetLayout.addWidget(self.scrollArea)

        self.boxLayout = QVBoxLayout(self)
        self.boxLayout.setContentsMargins(0, 5, 0, 0)
        self.boxLayout.addWidget(self.menu)
        self.boxLayout.addWidget(self.widget)

        self.setFixedSize(self.sizeHint())
        self.center()
        self.show()

    def keyPressEvent(self, event):
        if type(event) != QKeyEvent:
            return

        letter = event.text().strip().lower()

        for i in range(self.scrollLayout.count()):
            widget = self.scrollLayout.itemAt(i).widget()

            if widget is not None and widget.name[0].lower() == letter:
                self.scrollArea.verticalScrollBar().setValue(
                    widget.geometry().top())
                return

    def widgetDeleted(self, arg):
        self.closeAddOTP()

    def closeAddOTP(self):
        if self.addOTP:
            self.addOTP.close()
            self.addOTP = None

    def addAccount(self, account):
        entry = EntryWidget(self.base, account)
        self.scrollLayout.addWidget(entry)

    def deleteAccount(self, account):
        for i in range(self.scrollLayout.count()):
            widget = self.scrollLayout.itemAt(i).widget()

            if widget.account == account:
                widget.close()

    def clearAccounts(self):
        for i in range(self.scrollLayout.count()):
            self.scrollLayout.itemAt(i).widget().close()

    def createAccounts(self):
        for account in self.base.getAccounts():
            self.addAccount(account)

    def openAddOTP(self):
        self.closeAddOTP()
        self.addOTP = AddOTPWidget(self.base)

    def openAddSteam(self):
        self.closeAddOTP()
        self.addOTP = AddSteamWidget(self.base)

    def sortByName(self):
        self.base.sortAccountsByName()
        self.clearAccounts()
        self.createAccounts()

    def exportToAndOTP(self):
        accounts = []

        for account in self.base.getAccounts():
            type = account['type']

            if type == Globals.OTPAuth:
                accounts.append({
                    'secret': account['key'],
                    'digits': 6,
                    'period': 30,
                    'label': account['name'],
                    'type': 'TOTP',
                    'algorithm': 'SHA1',
                    'thumbnail': 'Default',
                    'last_used': 0,
                    'tags': []
                })
            elif type == Globals.SteamAuth:
                accounts.append({
                    'secret':
                    base64.b32encode(base64.b64decode(
                        account['sharedSecret'])).decode('utf-8'),
                    'digits':
                    5,
                    'period':
                    30,
                    'label':
                    account['name'],
                    'type':
                    'STEAM',
                    'algorithm':
                    'SHA1',
                    'thumbnail':
                    'Default',
                    'last_used':
                    0,
                    'tags': []
                })

        accounts = json.dumps(accounts)
        filename, _ = QFileDialog.getSaveFileName(
            self, 'Export to andOTP JSON file', '', 'All Files (*)')

        if filename:
            with open(filename, 'w') as file:
                file.write(accounts)
Beispiel #12
0
class Window(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)

        self.images = []
        self.index = -1
        self.ratio = 1  # ratio for QLabel image
        self.mouse_position = None
        self.settings = None

        # Extensions
        self.extensions = []
        for format in QImageReader.supportedImageFormats():
            self.extensions.append(format.data().decode('utf-8'))

        # Filters
        self.filters = []
        for extension in self.extensions:
            self.filters.append('*.{0}'.format(str(extension)))

        # UI
        self.set_up_ui()

        # settings
        self.load_settings()

    def on_message_received(self, msg):
        """ on message received from single application

        Args:
            msg (string): file path
        """
        self.create_images(msg)
        self.display_image()

    def set_up_ui(self):
        # Status Bar
        self.status_bar = self.statusBar()
        self.label_name = QLabel()
        self.label_numero = QLabel()
        self.status_bar.addPermanentWidget(self.label_name, 1)
        self.status_bar.addPermanentWidget(self.label_numero, 0)

        # Main Window
        self.setWindowTitle('BaloViewer')
        self.setWindowIcon(QIcon('baloviewer.ico'))

        # Label image
        self.image = QLabel()
        self.image.setScaledContents(True)

        # Scroll area
        self.scroll_area = QScrollArea()
        self.scroll_area.setWidget(self.image)
        self.scroll_area.showMaximized()
        self.scroll_area.setFocusPolicy(Qt.FocusPolicy.NoFocus)
        self.scroll_area.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.scroll_area.viewport().installEventFilter(self)

        # image list
        self.image_gallery = ImageGallery()
        self.image_gallery.itemClicked.connect(self.image_gallery_clicked)
        self.image_gallery.viewport().installEventFilter(self)
        self.dock_widget = QDockWidget('Image Gallery', self)
        self.dock_widget.setWidget(self.image_gallery)
        self.dock_widget.setFloating(False)
        self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_widget)

        # central widget
        self.setCentralWidget(self.scroll_area)

        # Action bar
        self.create_actions()
        self.create_menubar()
        self.create_toolbar()

        # option parser
        parser = OptionParser()
        parser.add_option("-f", "--file", dest="filename", help="open a file")
        (options, args) = parser.parse_args()
        parser_file = options.filename
        if parser_file is not None and os.path.isfile(parser_file):
            self.create_images(parser_file)
            self.display_image()

    def create_actions(self):
        # Action Open
        self.action_open = QAction(QIcon.fromTheme('document-open'), 'Open',
                                   self)
        self.action_open.setShortcut('Ctrl+O')
        self.action_open.setStatusTip('Open file')
        self.action_open.triggered.connect(self.open)

        # Action Save
        self.action_save = QAction(QIcon.fromTheme('document-save'), 'Save',
                                   self)
        self.action_save.setShortcut('Ctrl+S')
        self.action_save.setStatusTip('Save file')
        self.action_save.triggered.connect(self.save)

        # Action Copy
        self.action_copy = QAction(QIcon.fromTheme('edit-copy'), 'Copy', self)
        self.action_copy.setStatusTip('Copy')
        self.action_copy.triggered.connect(self.copy)

        # Action move
        self.action_move = QAction(QIcon.fromTheme('edit-cut'), 'Move', self)
        self.action_move.setStatusTip('Move')
        self.action_move.triggered.connect(self.move)

        # Action Delete
        self.action_delete = QAction(QIcon.fromTheme('edit-delete'), 'Delete',
                                     self)
        self.action_delete.setStatusTip('Delete')
        self.action_delete.triggered.connect(self.delete)

        # Action Quit
        self.action_quit = QAction(QIcon.fromTheme('application-exit'), 'Quit',
                                   self)
        self.action_quit.setShortcut('Ctrl+Q')
        self.action_quit.setStatusTip('Quit')
        self.action_quit.triggered.connect(self.close)

        # Action Rotate left
        self.action_rotate_left = QAction(
            QIcon.fromTheme('object-rotate-left'), 'Rotate left', self)
        self.action_rotate_left.setStatusTip('Rotate left')
        self.action_rotate_left.triggered.connect(self.rotate_left)

        # Action Rotate right
        self.action_rotate_right = QAction(
            QIcon.fromTheme('object-rotate-right'), 'Rotate right', self)
        self.action_rotate_right.setStatusTip('Rotate right')
        self.action_rotate_right.triggered.connect(self.rotate_right)

        # Action Mirror
        self.action_flip_horizontal = QAction(
            QIcon.fromTheme('object-flip-horizontal'), 'Flip horizontally',
            self)
        self.action_flip_horizontal.setStatusTip('Flip horizontally')
        self.action_flip_horizontal.triggered.connect(self.flip_horizontal)

        # Action Flip vertical
        self.action_flip_vertical = QAction(
            QIcon.fromTheme('object-flip-vertical'), 'Flip vertically', self)
        self.action_flip_vertical.setStatusTip('Flip vertically')
        self.action_flip_vertical.triggered.connect(self.flip_vertical)

        # Action Previous image
        self.action_previous_image = QAction(QIcon.fromTheme('go-previous'),
                                             'Previous image', self)
        self.action_previous_image.setStatusTip('Previous image')
        self.action_previous_image.triggered.connect(self.previous_image)

        # Action Full screen
        self.action_fullscreen = QAction(QIcon.fromTheme('view-fullscreen'),
                                         'Full screen', self)
        self.action_fullscreen.setStatusTip('Full screen')
        self.action_fullscreen.triggered.connect(self.fullscreen)

        # Action Normal size
        self.action_normal_size = QAction(QIcon.fromTheme('zoom-original'),
                                          'Normal size', self)
        self.action_normal_size.setStatusTip('Normal Size')
        self.action_normal_size.triggered.connect(self.normal_size)

        # Action Fit Screen
        self.action_fit_screen = QAction(QIcon.fromTheme('zoom-fit-best'),
                                         'Fit to screen', self)
        self.action_fit_screen.setStatusTip('Fit to screen')
        self.action_fit_screen.setCheckable(True)
        self.action_fit_screen.triggered.connect(self.fit_screen)

        # Action Zoom in
        self.action_zoom_in = QAction(QIcon.fromTheme('zoom-in'), 'Zoom in',
                                      self)
        self.action_zoom_in.setStatusTip('Zoom in')
        self.action_zoom_in.triggered.connect(self.zoom_in)

        # Action Zoom out
        self.action_zoom_out = QAction(QIcon.fromTheme('zoom-out'), 'Zoom out',
                                       self)
        self.action_zoom_out.setStatusTip('Zoom out')
        self.action_zoom_out.triggered.connect(self.zoom_out)

        # Action Fit height
        self.action_fit_vertical = QAction('Fit vertically', self)
        self.action_fit_vertical.setStatusTip('Fit vertically')
        self.action_fit_vertical.setCheckable(True)
        self.action_fit_vertical.triggered.connect(self.fit_height)

        # Action Fit width
        self.action_fit_horizontal = QAction('Fit horizontally', self)
        self.action_fit_horizontal.setStatusTip('Fit horizontally')
        self.action_fit_horizontal.setCheckable(True)
        self.action_fit_horizontal.triggered.connect(self.fit_width)

        # Action Fit width
        self.action_fit_horizontal = QAction('Fit horizontally', self)
        self.action_fit_horizontal.setStatusTip('Fit horizontally')
        self.action_fit_horizontal.setCheckable(True)
        self.action_fit_horizontal.triggered.connect(self.fit_width)

        # Action Image list
        self.action_image_gallery = QAction('Image gallery', self)
        self.action_image_gallery.setStatusTip('Image gallery')
        self.action_image_gallery.setCheckable(True)
        self.action_image_gallery.triggered.connect(
            self.image_gallery_triggered)

        # Action Next_image
        self.action_next_image = QAction(QIcon.fromTheme('go-next'),
                                         'Next image', self)
        self.action_next_image.setStatusTip('Next image')
        self.action_next_image.triggered.connect(self.next_image)

        # Action First image
        self.action_first_image = QAction(QIcon.fromTheme('go-first'),
                                          'First image', self)
        self.action_first_image.setStatusTip('First image')
        self.action_first_image.triggered.connect(self.first_image)

        # Action Last image
        self.action_last_image = QAction(QIcon.fromTheme('go-last'),
                                         'Last image', self)
        self.action_last_image.setStatusTip('Last image')
        self.action_last_image.triggered.connect(self.last_image)

        # Action About
        self.action_about = QAction(QIcon.fromTheme('help-about'), 'About',
                                    self)
        self.action_about.setStatusTip('About')
        self.action_about.triggered.connect(self.about)

    def create_menubar(self):
        self.menubar = self.menuBar()

        # File
        self.menu_file = self.menubar.addMenu('File')
        self.menu_file.addAction(self.action_open)
        self.menu_file.addAction(self.action_save)
        self.menu_file.addSeparator()
        self.menu_file.addAction(self.action_copy)
        self.menu_file.addAction(self.action_move)
        self.menu_file.addAction(self.action_delete)
        self.menu_file.addSeparator()
        self.menu_file.addAction(self.action_quit)

        # Edit
        self.menu_edit = self.menubar.addMenu('Edit')
        self.menu_edit.addAction(self.action_rotate_left)
        self.menu_edit.addAction(self.action_rotate_right)
        self.menu_edit.addSeparator()
        self.menu_edit.addAction(self.action_flip_horizontal)
        self.menu_edit.addAction(self.action_flip_vertical)

        # View
        self.menu_view = self.menubar.addMenu('View')
        self.menu_view.addAction(self.action_fullscreen)
        self.menu_view.addAction(self.action_normal_size)
        self.menu_view.addAction(self.action_fit_screen)
        self.menu_view.addSeparator()
        self.menu_view.addAction(self.action_zoom_in)
        self.menu_view.addAction(self.action_zoom_out)
        self.menu_view.addSeparator()
        self.menu_view.addAction(self.action_fit_vertical)
        self.menu_view.addAction(self.action_fit_horizontal)
        self.menu_view.addSeparator()
        self.menu_view.addAction(self.action_image_gallery)

        # Go
        self.menu_go = self.menubar.addMenu('Go')
        self.menu_go.addAction(self.action_previous_image)
        self.menu_go.addAction(self.action_next_image)
        self.menu_go.addSeparator()
        self.menu_go.addAction(self.action_first_image)
        self.menu_go.addAction(self.action_last_image)

        # About
        self.menu_about = self.menubar.addMenu('About')
        self.menu_about.addAction(self.action_about)

    def create_toolbar(self):
        self.toolbar = self.addToolBar('Tool bar')

        self.toolbar.addAction(self.action_open)
        self.toolbar.addAction(self.action_save)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.action_fullscreen)
        self.toolbar.addAction(self.action_normal_size)
        self.toolbar.addAction(self.action_fit_screen)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.action_zoom_in)
        self.toolbar.addAction(self.action_zoom_out)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.action_rotate_left)
        self.toolbar.addAction(self.action_rotate_right)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.action_first_image)
        self.toolbar.addAction(self.action_previous_image)
        self.toolbar.addAction(self.action_next_image)
        self.toolbar.addAction(self.action_last_image)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.action_copy)
        self.toolbar.addAction(self.action_move)

    def load_settings(self):
        self.settings = QSettings()
        check_state = self.settings.value('view/image_gallery',
                                          True,
                                          type=bool)
        self.action_image_gallery.setChecked(check_state)
        self.image_gallery_triggered()

    def contextMenuEvent(self, QContextMenuEvent):
        menu = QMenu()
        menu.addAction(self.action_fullscreen)
        menu.addSeparator()
        menu.addAction(self.action_image_gallery)
        menu.addSeparator()
        menu.addAction(self.action_previous_image)
        menu.addAction(self.action_next_image)
        menu.addSeparator()
        menu.addAction(self.action_normal_size)
        menu.addAction(self.action_fit_screen)
        menu.addAction(self.action_fit_vertical)
        menu.addAction(self.action_fit_horizontal)
        menu.addSeparator()
        menu.addAction(self.action_zoom_in)
        menu.addAction(self.action_zoom_out)
        menu.addSeparator()
        menu.addAction(self.action_copy)
        menu.addAction(self.action_move)
        menu.addSeparator()
        menu.addAction(self.action_delete)
        menu.exec_(QContextMenuEvent.globalPos())

    def eventFilter(self, obj, event):
        """ filter events for wheel events

        Args:
            obj (QWidget): scroll_area
            event (QEvent): event
        """

        # try:
        if event.type() == QEvent.Wheel:
            if event.angleDelta().y() < 0:
                self.next_image()
            else:
                self.previous_image()

            return True
        elif event.type() == QEvent.MouseButtonPress and event.button(
        ) == Qt.RightButton:
            index = self.image_gallery.select_row_pos()
            if index > -1:
                self.index = index
                self.display_image()
                return True
        # pass the event on to the parent class
        return super(QMainWindow, self).eventFilter(obj, event)

    def keyPressEvent(self, event):
        key = event.key()
        if key == Qt.Key_Delete:
            self.delete()
        elif key == Qt.Key_Left:
            self.previous_image()
        elif key == Qt.Key_Right:
            self.next_image()
        elif key == Qt.Key_PageUp:
            self.first_image()
        elif key == Qt.Key_PageDown:
            self.last_image()
        elif key == Qt.Key_Escape and self.isFullScreen():
            self.fullscreen()
        else:
            QWidget.keyPressEvent(self, event)

    def mouseDoubleClickEvent(self, QMouseEvent):
        self.fullscreen()

    def mousePressEvent(self, QMouseEvent):
        self.mouse_position = QMouseEvent.pos()

    def mouseMoveEvent(self, QMouseEvent):
        diff = QPoint(QMouseEvent.pos() - self.mouse_position)
        self.mouse_position = QMouseEvent.pos()
        self.scroll_area.verticalScrollBar().setValue(
            self.scroll_area.verticalScrollBar().value() - diff.y())
        self.scroll_area.horizontalScrollBar().setValue(
            self.scroll_area.horizontalScrollBar().value() - diff.x())

    def resizeEvent(self, event):
        if not self.index == -1:
            self.display_image()

    def create_images(self, filename):
        """Create image list

        Args:
            filename (string): file from which to retrieve the list of images in the folder
        """

        self.images.clear()
        # get images only with an allowed extension
        for ext in self.extensions:
            self.images += glob.glob(
                os.path.join(
                    glob.escape(os.path.dirname(filename)),
                    '*.' + ''.join('[%s%s]' % (e.lower(), e.upper())
                                   for e in ext)))

        self.images.sort()
        if filename in self.images:
            self.index = self.images.index(filename)
        else:
            self.index = -1

        # iamge list
        self.image_gallery.add_images(self.images)

    def remove_index(self):
        """ remove file from list images and display next or previous image
        """

        del self.images[self.index]
        self.image_gallery.remove_row(self.index)

        if len(self.images) == 0:
            self.images.clear()
            self.index = -1
            self.image.clear()
            self.image.resize(self.image.minimumSizeHint())
        elif self.index < len(self.images) - 1:
            self.display_image()
        else:
            self.index = len(self.images) - 1
            self.display_image()

    def display_image(self):
        if not self.index == -1:
            self.image.clear()
            self.image.resize(self.image.minimumSizeHint())

            file = self.images[self.index]
            if os.path.isfile(file):
                self.label_name.setText(file)
                self.label_numero.setText(
                    str(self.index + 1) + ' / ' + str(len(self.images)))

                # image list
                self.image_gallery.select_row(self.index)

                image_reader = QImageReader(file)
                if image_reader.imageCount() > 1:
                    # Animated image
                    movie = QMovie(file)
                    movie.setCacheMode(QMovie.CacheAll)
                    movie.jumpToFrame(0)
                    movie_size = movie.currentPixmap().size()
                    self.image.setMovie(movie)
                    self.image.resize(movie_size)
                    movie.start()
                else:
                    self.image.setPixmap(QPixmap(file))
                    self.image.resize(self.image.pixmap().size())

                # fit image
                if self.action_fit_screen.isChecked():
                    self.fit_screen()
                elif self.action_fit_horizontal.isChecked():
                    self.fit_width()
                elif self.action_fit_vertical.isChecked():
                    self.fit_height()

                else:
                    self.ratio = 1.0

                self.action_zoom_in.setEnabled(True)
                self.action_zoom_out.setEnabled(True)

                # scrollbar position
                self.scroll_area.verticalScrollBar().setSliderPosition(0)
                self.scroll_area.horizontalScrollBar().setSliderPosition(0)

    def resize_image(self):
        if self.action_fit_screen.isChecked():
            self.fit_screen()
        elif self.action_fit_horizontal.isChecked():
            self.fit_width()
        elif self.action_fit_vertical.isChecked():
            self.fit_height()
        elif self.image.pixmap():
            self.image.resize(self.ratio * self.image.pixmap().size())
        elif movie := self.image.movie():
            movie.jumpToFrame(0)
            movie_size = movie.currentPixmap().size()
            self.image.resize(self.ratio * movie_size)
Beispiel #13
0
class FileView(QWidget):
    Sg_update_files_with_new_path = Signal(str)

    def __init__(self, model: FileModel, parent=None):
        super(FileView, self).__init__(parent)

        self.env_settings = QSettings()
        self._model = model

        self.title = QLabel("File locali", self)
        self.title.setAlignment(Qt.AlignLeft)
        self.title.setAccessibleName("Title")

        # scroll area
        self.scrollArea = QScrollArea()
        self.scrollArea.setAccessibleName("FileScroll")
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.horizontalScrollBar().setEnabled(False)

        # contenitore per file
        self.fileWindow = QWidget(self)
        self.fileLayout = FlowLayout()
        self.fileLayout.setContentsMargins(0, 0, 0, 0)

        self.show_path_button = QPushButton("Apri file manager", self)
        self.force_sync_button = QPushButton("Sincronizza ora", self)

        self.fileWindow.setParent(self.scrollArea)
        self.fileWindow.setLayout(self.fileLayout)

        self.scrollArea.setWidget(self.fileWindow)

        header_layout = QHBoxLayout()
        header_layout.addWidget(self.title)
        header_layout.addWidget(self.force_sync_button)
        header_layout.addWidget(self.show_path_button)

        layout = QVBoxLayout()
        layout.addLayout(header_layout)
        layout.addWidget(self.scrollArea)
        self.setLayout(layout)

        self.Sl_model_changed()

    @Slot()
    def Sl_show_path_button_clicked(self) -> None:
        path = QUrl.fromUserInput(self.env_settings.value("sync_path"))
        QDesktopServices.openUrl(path)

    @Slot()
    def Sl_model_changed(self) -> None:
        list_of_files, list_of_dirs = self._model.get_data()

        for i in reversed(range(self.fileLayout.count())):
            self.fileLayout.itemAt(i).widget().setParent(None)
        for i in list_of_dirs:
            self.fileLayout.addWidget(LocalDirectoryWidget(i, self))
        for i in list_of_files:
            self.fileLayout.addWidget(LocalFileWidget(i))

    @Slot(str)
    def Sl_update_files_with_new_path(self, path: str) -> None:
        self.Sg_update_files_with_new_path.emit(path)

    def toggle_files_update(self, file_path: str, is_sync: bool) -> None:
        for widget in self.fileLayout._item_list:
            if type(widget.wid) == LocalFileWidget:
                if os.path.samefile(widget.wid.path, file_path):
                    widget.wid.show_synced(is_sync)
Beispiel #14
0
class Ui_opsWidget(object):
    def setupUi(self, opsWidget):
        if not opsWidget.objectName():
            opsWidget.setObjectName(u"opsWidget")
        opsWidget.resize(484, 788)
        self.opLayout = QVBoxLayout(opsWidget)
        self.opLayout.setObjectName(u"opLayout")
        self.operationSelect = QGroupBox(opsWidget)
        self.operationSelect.setObjectName(u"operationSelect")
        self.operationSelect.setEnabled(True)
        self.operationSelect.setFlat(True)
        self.verticalLayout_3 = QVBoxLayout(self.operationSelect)
        self.verticalLayout_3.setSpacing(10)
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.verticalLayout_3.setContentsMargins(4, 4, 4, 4)
        self.formLayout = QFormLayout()
        self.formLayout.setObjectName(u"formLayout")
        self.formLayout.setVerticalSpacing(10)
        self.formLayout.setContentsMargins(5, 20, 5, 20)
        self.applyOpLabel = QLabel(self.operationSelect)
        self.applyOpLabel.setObjectName(u"applyOpLabel")

        self.formLayout.setWidget(1, QFormLayout.LabelRole, self.applyOpLabel)

        self.opCombo = QComboBox(self.operationSelect)
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.addItem("")
        self.opCombo.setObjectName(u"opCombo")
        self.opCombo.setEnabled(True)

        self.formLayout.setWidget(1, QFormLayout.FieldRole, self.opCombo)

        self.applyToLabel = QLabel(self.operationSelect)
        self.applyToLabel.setObjectName(u"applyToLabel")

        self.formLayout.setWidget(2, QFormLayout.LabelRole, self.applyToLabel)

        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.verticalLayout_18 = QVBoxLayout()
        self.verticalLayout_18.setObjectName(u"verticalLayout_18")
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.allDemoCheck = QCheckBox(self.operationSelect)
        self.allDemoCheck.setObjectName(u"allDemoCheck")
        self.allDemoCheck.setMaximumSize(QSize(10000, 16777215))

        self.horizontalLayout_2.addWidget(self.allDemoCheck)

        self.allStepsCheck = QCheckBox(self.operationSelect)
        self.allStepsCheck.setObjectName(u"allStepsCheck")
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.allStepsCheck.sizePolicy().hasHeightForWidth())
        self.allStepsCheck.setSizePolicy(sizePolicy)
        self.allStepsCheck.setMinimumSize(QSize(180, 0))
        self.allStepsCheck.setLayoutDirection(Qt.LeftToRight)

        self.horizontalLayout_2.addWidget(self.allStepsCheck)

        self.verticalLayout_18.addLayout(self.horizontalLayout_2)

        self.matchSubstringCheck = QCheckBox(self.operationSelect)
        self.matchSubstringCheck.setObjectName(u"matchSubstringCheck")

        self.verticalLayout_18.addWidget(self.matchSubstringCheck)

        self.horizontalLayout_13 = QHBoxLayout()
        self.horizontalLayout_13.setObjectName(u"horizontalLayout_13")
        self.label_16 = QLabel(self.operationSelect)
        self.label_16.setObjectName(u"label_16")
        self.label_16.setEnabled(False)

        self.horizontalLayout_13.addWidget(self.label_16)

        self.matchSubstringText = QLineEdit(self.operationSelect)
        self.matchSubstringText.setObjectName(u"matchSubstringText")
        self.matchSubstringText.setEnabled(False)

        self.horizontalLayout_13.addWidget(self.matchSubstringText)

        self.verticalLayout_18.addLayout(self.horizontalLayout_13)

        self.horizontalLayout.addLayout(self.verticalLayout_18)

        self.formLayout.setLayout(2, QFormLayout.FieldRole,
                                  self.horizontalLayout)

        self.applyDemoLabel = QLabel(self.operationSelect)
        self.applyDemoLabel.setObjectName(u"applyDemoLabel")

        self.formLayout.setWidget(0, QFormLayout.LabelRole,
                                  self.applyDemoLabel)

        self.demoTargetCombo = QComboBox(self.operationSelect)
        self.demoTargetCombo.setObjectName(u"demoTargetCombo")

        self.formLayout.setWidget(0, QFormLayout.FieldRole,
                                  self.demoTargetCombo)

        self.verticalLayout_3.addLayout(self.formLayout)

        self.opLayout.addWidget(self.operationSelect)

        self.groupBox_6 = QGroupBox(opsWidget)
        self.groupBox_6.setObjectName(u"groupBox_6")
        self.groupBox_6.setEnabled(True)
        self.groupBox_6.setFlat(True)
        self.verticalLayout = QVBoxLayout(self.groupBox_6)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(4, 4, 4, 4)
        self.opsParamsStack = QStackedWidget(self.groupBox_6)
        self.opsParamsStack.setObjectName(u"opsParamsStack")
        self.opsParamsStack.setAutoFillBackground(False)
        self.shellTab = QWidget()
        self.shellTab.setObjectName(u"shellTab")
        self.shellTab.setAutoFillBackground(False)
        self.formLayout_2 = QFormLayout(self.shellTab)
        self.formLayout_2.setObjectName(u"formLayout_2")
        self.formLayout_2.setLabelAlignment(Qt.AlignLeading | Qt.AlignLeft
                                            | Qt.AlignVCenter)
        self.formLayout_2.setFormAlignment(Qt.AlignLeading | Qt.AlignLeft
                                           | Qt.AlignVCenter)
        self.formLayout_2.setVerticalSpacing(40)
        self.formLayout_2.setContentsMargins(-1, 11, -1, -1)
        self.label = QLabel(self.shellTab)
        self.label.setObjectName(u"label")

        self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.label)

        self.horizontalLayout_4 = QHBoxLayout()
        self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
        self.shellImgPath = QLineEdit(self.shellTab)
        self.shellImgPath.setObjectName(u"shellImgPath")

        self.horizontalLayout_4.addWidget(self.shellImgPath)

        self.shellBrowseImgBtn = QPushButton(self.shellTab)
        self.shellBrowseImgBtn.setObjectName(u"shellBrowseImgBtn")

        self.horizontalLayout_4.addWidget(self.shellBrowseImgBtn)

        self.formLayout_2.setLayout(0, QFormLayout.FieldRole,
                                    self.horizontalLayout_4)

        self.label_2 = QLabel(self.shellTab)
        self.label_2.setObjectName(u"label_2")

        self.formLayout_2.setWidget(1, QFormLayout.LabelRole, self.label_2)

        self.horizontalLayout_7 = QHBoxLayout()
        self.horizontalLayout_7.setObjectName(u"horizontalLayout_7")
        self.label_3 = QLabel(self.shellTab)
        self.label_3.setObjectName(u"label_3")
        self.label_3.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_7.addWidget(self.label_3)

        self.shellFgX = QSpinBox(self.shellTab)
        self.shellFgX.setObjectName(u"shellFgX")
        self.shellFgX.setMaximum(100000000)

        self.horizontalLayout_7.addWidget(self.shellFgX)

        self.label_4 = QLabel(self.shellTab)
        self.label_4.setObjectName(u"label_4")
        self.label_4.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_7.addWidget(self.label_4)

        self.shellFgY = QSpinBox(self.shellTab)
        self.shellFgY.setObjectName(u"shellFgY")
        self.shellFgY.setMaximum(100000000)

        self.horizontalLayout_7.addWidget(self.shellFgY)

        self.formLayout_2.setLayout(1, QFormLayout.FieldRole,
                                    self.horizontalLayout_7)

        self.label_5 = QLabel(self.shellTab)
        self.label_5.setObjectName(u"label_5")

        self.formLayout_2.setWidget(2, QFormLayout.LabelRole, self.label_5)

        self.horizontalLayout_8 = QHBoxLayout()
        self.horizontalLayout_8.setObjectName(u"horizontalLayout_8")
        self.label_7 = QLabel(self.shellTab)
        self.label_7.setObjectName(u"label_7")
        self.label_7.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_8.addWidget(self.label_7)

        self.shellFgW = QSpinBox(self.shellTab)
        self.shellFgW.setObjectName(u"shellFgW")
        self.shellFgW.setMaximum(100000000)

        self.horizontalLayout_8.addWidget(self.shellFgW)

        self.label_6 = QLabel(self.shellTab)
        self.label_6.setObjectName(u"label_6")
        self.label_6.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_8.addWidget(self.label_6)

        self.shellFgH = QSpinBox(self.shellTab)
        self.shellFgH.setObjectName(u"shellFgH")
        self.shellFgH.setMaximum(10000000)

        self.horizontalLayout_8.addWidget(self.shellFgH)

        self.formLayout_2.setLayout(2, QFormLayout.FieldRole,
                                    self.horizontalLayout_8)

        self.opsParamsStack.addWidget(self.shellTab)
        self.insertTab = QWidget()
        self.insertTab.setObjectName(u"insertTab")
        self.formLayout_3 = QFormLayout(self.insertTab)
        self.formLayout_3.setObjectName(u"formLayout_3")
        self.formLayout_3.setVerticalSpacing(40)
        self.formLayout_3.setContentsMargins(-1, 40, -1, -1)
        self.label_32 = QLabel(self.insertTab)
        self.label_32.setObjectName(u"label_32")

        self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.label_32)

        self.horizontalLayout_20 = QHBoxLayout()
        self.horizontalLayout_20.setObjectName(u"horizontalLayout_20")
        self.insertImgPath = QLineEdit(self.insertTab)
        self.insertImgPath.setObjectName(u"insertImgPath")

        self.horizontalLayout_20.addWidget(self.insertImgPath)

        self.insertBrowseImgBtn = QPushButton(self.insertTab)
        self.insertBrowseImgBtn.setObjectName(u"insertBrowseImgBtn")

        self.horizontalLayout_20.addWidget(self.insertBrowseImgBtn)

        self.formLayout_3.setLayout(0, QFormLayout.FieldRole,
                                    self.horizontalLayout_20)

        self.label_13 = QLabel(self.insertTab)
        self.label_13.setObjectName(u"label_13")

        self.formLayout_3.setWidget(1, QFormLayout.LabelRole, self.label_13)

        self.horizontalLayout_18 = QHBoxLayout()
        self.horizontalLayout_18.setObjectName(u"horizontalLayout_18")
        self.label_26 = QLabel(self.insertTab)
        self.label_26.setObjectName(u"label_26")
        self.label_26.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_18.addWidget(self.label_26)

        self.insertFgX = QSpinBox(self.insertTab)
        self.insertFgX.setObjectName(u"insertFgX")
        sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(
            self.insertFgX.sizePolicy().hasHeightForWidth())
        self.insertFgX.setSizePolicy(sizePolicy1)
        self.insertFgX.setMaximum(10000000)

        self.horizontalLayout_18.addWidget(self.insertFgX)

        self.label_29 = QLabel(self.insertTab)
        self.label_29.setObjectName(u"label_29")
        self.label_29.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_18.addWidget(self.label_29)

        self.insertFgY = QSpinBox(self.insertTab)
        self.insertFgY.setObjectName(u"insertFgY")
        self.insertFgY.setMaximum(10000000)

        self.horizontalLayout_18.addWidget(self.insertFgY)

        self.formLayout_3.setLayout(1, QFormLayout.FieldRole,
                                    self.horizontalLayout_18)

        self.label_12 = QLabel(self.insertTab)
        self.label_12.setObjectName(u"label_12")

        self.formLayout_3.setWidget(2, QFormLayout.LabelRole, self.label_12)

        self.horizontalLayout_21 = QHBoxLayout()
        self.horizontalLayout_21.setObjectName(u"horizontalLayout_21")
        self.label_33 = QLabel(self.insertTab)
        self.label_33.setObjectName(u"label_33")
        self.label_33.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_21.addWidget(self.label_33)

        self.insertFgW = QSpinBox(self.insertTab)
        self.insertFgW.setObjectName(u"insertFgW")
        self.insertFgW.setBaseSize(QSize(1920, 0))
        self.insertFgW.setMaximum(1000000)
        self.insertFgW.setValue(1920)

        self.horizontalLayout_21.addWidget(self.insertFgW)

        self.label_34 = QLabel(self.insertTab)
        self.label_34.setObjectName(u"label_34")
        self.label_34.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_21.addWidget(self.label_34)

        self.insertFgH = QSpinBox(self.insertTab)
        self.insertFgH.setObjectName(u"insertFgH")
        self.insertFgH.setMaximum(1000000000)
        self.insertFgH.setValue(1080)

        self.horizontalLayout_21.addWidget(self.insertFgH)

        self.formLayout_3.setLayout(2, QFormLayout.FieldRole,
                                    self.horizontalLayout_21)

        self.opsParamsStack.addWidget(self.insertTab)
        self.sectionTab = QWidget()
        self.sectionTab.setObjectName(u"sectionTab")
        self.formLayout_6 = QFormLayout(self.sectionTab)
        self.formLayout_6.setObjectName(u"formLayout_6")
        self.sectionRulesListWidget = QListWidget(self.sectionTab)
        QListWidgetItem(self.sectionRulesListWidget)
        QListWidgetItem(self.sectionRulesListWidget)
        QListWidgetItem(self.sectionRulesListWidget)
        QListWidgetItem(self.sectionRulesListWidget)
        QListWidgetItem(self.sectionRulesListWidget)
        QListWidgetItem(self.sectionRulesListWidget)
        QListWidgetItem(self.sectionRulesListWidget)
        self.sectionRulesListWidget.setObjectName(u"sectionRulesListWidget")
        self.sectionRulesListWidget.setMaximumSize(QSize(16777215, 100))

        self.formLayout_6.setWidget(1, QFormLayout.FieldRole,
                                    self.sectionRulesListWidget)

        self.label_10 = QLabel(self.sectionTab)
        self.label_10.setObjectName(u"label_10")
        self.label_10.setMaximumSize(QSize(16777215, 20))

        self.formLayout_6.setWidget(0, QFormLayout.FieldRole, self.label_10)

        self.sectionCoverageLabel = QLabel(self.sectionTab)
        self.sectionCoverageLabel.setObjectName(u"sectionCoverageLabel")
        self.sectionCoverageLabel.setMaximumSize(QSize(16777215, 20))

        self.formLayout_6.setWidget(2, QFormLayout.FieldRole,
                                    self.sectionCoverageLabel)

        self.label_11 = QLabel(self.sectionTab)
        self.label_11.setObjectName(u"label_11")
        self.label_11.setMaximumSize(QSize(16777215, 20))

        self.formLayout_6.setWidget(3, QFormLayout.FieldRole, self.label_11)

        self.opsParamsStack.addWidget(self.sectionTab)
        self.audioTab = QWidget()
        self.audioTab.setObjectName(u"audioTab")
        self.formLayout_8 = QFormLayout(self.audioTab)
        self.formLayout_8.setObjectName(u"formLayout_8")
        self.comboBox = QComboBox(self.audioTab)
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.setObjectName(u"comboBox")

        self.formLayout_8.setWidget(0, QFormLayout.FieldRole, self.comboBox)

        self.label_8 = QLabel(self.audioTab)
        self.label_8.setObjectName(u"label_8")

        self.formLayout_8.setWidget(0, QFormLayout.LabelRole, self.label_8)

        self.opsParamsStack.addWidget(self.audioTab)
        self.cropTab = QWidget()
        self.cropTab.setObjectName(u"cropTab")
        self.formLayout_4 = QFormLayout(self.cropTab)
        self.formLayout_4.setObjectName(u"formLayout_4")
        self.formLayout_4.setVerticalSpacing(40)
        self.formLayout_4.setContentsMargins(-1, 40, -1, -1)
        self.label_14 = QLabel(self.cropTab)
        self.label_14.setObjectName(u"label_14")

        self.formLayout_4.setWidget(0, QFormLayout.LabelRole, self.label_14)

        self.horizontalLayout_19 = QHBoxLayout()
        self.horizontalLayout_19.setObjectName(u"horizontalLayout_19")
        self.label_30 = QLabel(self.cropTab)
        self.label_30.setObjectName(u"label_30")
        self.label_30.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_19.addWidget(self.label_30)

        self.spinBox_21 = QSpinBox(self.cropTab)
        self.spinBox_21.setObjectName(u"spinBox_21")

        self.horizontalLayout_19.addWidget(self.spinBox_21)

        self.label_31 = QLabel(self.cropTab)
        self.label_31.setObjectName(u"label_31")
        self.label_31.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_19.addWidget(self.label_31)

        self.spinBox_22 = QSpinBox(self.cropTab)
        self.spinBox_22.setObjectName(u"spinBox_22")

        self.horizontalLayout_19.addWidget(self.spinBox_22)

        self.formLayout_4.setLayout(0, QFormLayout.FieldRole,
                                    self.horizontalLayout_19)

        self.label_15 = QLabel(self.cropTab)
        self.label_15.setObjectName(u"label_15")

        self.formLayout_4.setWidget(1, QFormLayout.LabelRole, self.label_15)

        self.horizontalLayout_22 = QHBoxLayout()
        self.horizontalLayout_22.setObjectName(u"horizontalLayout_22")
        self.label_35 = QLabel(self.cropTab)
        self.label_35.setObjectName(u"label_35")
        self.label_35.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_22.addWidget(self.label_35)

        self.spinBox_25 = QSpinBox(self.cropTab)
        self.spinBox_25.setObjectName(u"spinBox_25")

        self.horizontalLayout_22.addWidget(self.spinBox_25)

        self.label_36 = QLabel(self.cropTab)
        self.label_36.setObjectName(u"label_36")
        self.label_36.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_22.addWidget(self.label_36)

        self.spinBox_26 = QSpinBox(self.cropTab)
        self.spinBox_26.setObjectName(u"spinBox_26")

        self.horizontalLayout_22.addWidget(self.spinBox_26)

        self.formLayout_4.setLayout(1, QFormLayout.FieldRole,
                                    self.horizontalLayout_22)

        self.opsParamsStack.addWidget(self.cropTab)
        self.composeTab = QWidget()
        self.composeTab.setObjectName(u"composeTab")
        self.verticalLayout_12 = QVBoxLayout(self.composeTab)
        self.verticalLayout_12.setObjectName(u"verticalLayout_12")
        self.verticalLayout_11 = QVBoxLayout()
        self.verticalLayout_11.setObjectName(u"verticalLayout_11")

        self.verticalLayout_12.addLayout(self.verticalLayout_11)

        self.opsParamsStack.addWidget(self.composeTab)
        self.resizeTab = QWidget()
        self.resizeTab.setObjectName(u"resizeTab")
        self.verticalLayout_10 = QVBoxLayout(self.resizeTab)
        self.verticalLayout_10.setObjectName(u"verticalLayout_10")
        self.verticalLayout_9 = QVBoxLayout()
        self.verticalLayout_9.setObjectName(u"verticalLayout_9")

        self.verticalLayout_10.addLayout(self.verticalLayout_9)

        self.opsParamsStack.addWidget(self.resizeTab)
        self.pacingTab = QWidget()
        self.pacingTab.setObjectName(u"pacingTab")
        self.verticalLayout_5 = QVBoxLayout(self.pacingTab)
        self.verticalLayout_5.setObjectName(u"verticalLayout_5")
        self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
        self.tabWidget = QTabWidget(self.pacingTab)
        self.tabWidget.setObjectName(u"tabWidget")
        self.tab = QWidget()
        self.tab.setObjectName(u"tab")
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QWidget()
        self.tab_2.setObjectName(u"tab_2")
        self.tabWidget.addTab(self.tab_2, "")

        self.verticalLayout_5.addWidget(self.tabWidget)

        self.opsParamsStack.addWidget(self.pacingTab)
        self.animateTab = QWidget()
        self.animateTab.setObjectName(u"animateTab")
        self.verticalLayout_14 = QVBoxLayout(self.animateTab)
        self.verticalLayout_14.setObjectName(u"verticalLayout_14")
        self.verticalLayout_13 = QVBoxLayout()
        self.verticalLayout_13.setObjectName(u"verticalLayout_13")

        self.verticalLayout_14.addLayout(self.verticalLayout_13)

        self.opsParamsStack.addWidget(self.animateTab)
        self.renderTab = QWidget()
        self.renderTab.setObjectName(u"renderTab")
        self.verticalLayout_4 = QVBoxLayout(self.renderTab)
        self.verticalLayout_4.setObjectName(u"verticalLayout_4")
        self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
        self.renderTabTabs = QTabWidget(self.renderTab)
        self.renderTabTabs.setObjectName(u"renderTabTabs")
        self.renderTabVideoTab = QWidget()
        self.renderTabVideoTab.setObjectName(u"renderTabVideoTab")
        self.verticalLayout_2 = QVBoxLayout(self.renderTabVideoTab)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.verticalLayout_2.setContentsMargins(5, 5, 5, 5)
        self.scrollArea = QScrollArea(self.renderTabVideoTab)
        self.scrollArea.setObjectName(u"scrollArea")
        self.scrollArea.setFrameShape(QFrame.Panel)
        self.scrollArea.setFrameShadow(QFrame.Plain)
        self.scrollArea.setLineWidth(0)
        self.scrollArea.setWidgetResizable(True)
        self.scrollAreaWidgetContents = QWidget()
        self.scrollAreaWidgetContents.setObjectName(
            u"scrollAreaWidgetContents")
        self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 438, 412))
        self.formLayout_10 = QFormLayout(self.scrollAreaWidgetContents)
        self.formLayout_10.setObjectName(u"formLayout_10")
        self.videoTitleLabel = QLabel(self.scrollAreaWidgetContents)
        self.videoTitleLabel.setObjectName(u"videoTitleLabel")

        self.formLayout_10.setWidget(0, QFormLayout.LabelRole,
                                     self.videoTitleLabel)

        self.renderOutputTitle = QLineEdit(self.scrollAreaWidgetContents)
        self.renderOutputTitle.setObjectName(u"renderOutputTitle")

        self.formLayout_10.setWidget(0, QFormLayout.FieldRole,
                                     self.renderOutputTitle)

        self.videoDirectoryLabel = QLabel(self.scrollAreaWidgetContents)
        self.videoDirectoryLabel.setObjectName(u"videoDirectoryLabel")

        self.formLayout_10.setWidget(1, QFormLayout.LabelRole,
                                     self.videoDirectoryLabel)

        self.renderOutputDir = QLineEdit(self.scrollAreaWidgetContents)
        self.renderOutputDir.setObjectName(u"renderOutputDir")

        self.formLayout_10.setWidget(1, QFormLayout.FieldRole,
                                     self.renderOutputDir)

        self.videoFormatLabel = QLabel(self.scrollAreaWidgetContents)
        self.videoFormatLabel.setObjectName(u"videoFormatLabel")

        self.formLayout_10.setWidget(2, QFormLayout.LabelRole,
                                     self.videoFormatLabel)

        self.renderOutputFormat = QComboBox(self.scrollAreaWidgetContents)
        self.renderOutputFormat.addItem("")
        self.renderOutputFormat.addItem("")
        self.renderOutputFormat.setObjectName(u"renderOutputFormat")

        self.formLayout_10.setWidget(2, QFormLayout.FieldRole,
                                     self.renderOutputFormat)

        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        self.verticalLayout_2.addWidget(self.scrollArea)

        self.renderTabTabs.addTab(self.renderTabVideoTab, "")
        self.renderTabAudioTab = QWidget()
        self.renderTabAudioTab.setObjectName(u"renderTabAudioTab")
        self.verticalLayout_6 = QVBoxLayout(self.renderTabAudioTab)
        self.verticalLayout_6.setObjectName(u"verticalLayout_6")
        self.scrollArea_2 = QScrollArea(self.renderTabAudioTab)
        self.scrollArea_2.setObjectName(u"scrollArea_2")
        self.scrollArea_2.setWidgetResizable(True)
        self.scrollAreaWidgetContents_2 = QWidget()
        self.scrollAreaWidgetContents_2.setObjectName(
            u"scrollAreaWidgetContents_2")
        self.scrollAreaWidgetContents_2.setGeometry(QRect(0, 0, 428, 402))
        self.formLayout_11 = QFormLayout(self.scrollAreaWidgetContents_2)
        self.formLayout_11.setObjectName(u"formLayout_11")
        self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2)

        self.verticalLayout_6.addWidget(self.scrollArea_2)

        self.renderTabTabs.addTab(self.renderTabAudioTab, "")
        self.renderTabPacingTab = QWidget()
        self.renderTabPacingTab.setObjectName(u"renderTabPacingTab")
        self.verticalLayout_8 = QVBoxLayout(self.renderTabPacingTab)
        self.verticalLayout_8.setObjectName(u"verticalLayout_8")
        self.scrollArea_3 = QScrollArea(self.renderTabPacingTab)
        self.scrollArea_3.setObjectName(u"scrollArea_3")
        self.scrollArea_3.setWidgetResizable(True)
        self.scrollAreaWidgetContents_3 = QWidget()
        self.scrollAreaWidgetContents_3.setObjectName(
            u"scrollAreaWidgetContents_3")
        self.scrollAreaWidgetContents_3.setGeometry(QRect(0, 0, 428, 402))
        self.formLayout_12 = QFormLayout(self.scrollAreaWidgetContents_3)
        self.formLayout_12.setObjectName(u"formLayout_12")
        self.scrollArea_3.setWidget(self.scrollAreaWidgetContents_3)

        self.verticalLayout_8.addWidget(self.scrollArea_3)

        self.renderTabTabs.addTab(self.renderTabPacingTab, "")

        self.verticalLayout_4.addWidget(self.renderTabTabs)

        self.opsParamsStack.addWidget(self.renderTab)
        self.extraTab = QWidget()
        self.extraTab.setObjectName(u"extraTab")
        self.formLayout_7 = QFormLayout(self.extraTab)
        self.formLayout_7.setObjectName(u"formLayout_7")
        self.opsParamsStack.addWidget(self.extraTab)

        self.verticalLayout.addWidget(self.opsParamsStack)

        self.opLayout.addWidget(self.groupBox_6)

        self.horizontalLayout_9 = QHBoxLayout()
        self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
        self.horizontalLayout_9.setContentsMargins(10, 10, 10, 10)
        self.resetStepParamsBtn = QPushButton(opsWidget)
        self.resetStepParamsBtn.setObjectName(u"resetStepParamsBtn")

        self.horizontalLayout_9.addWidget(self.resetStepParamsBtn)

        self.saveStepParamsBtn = QPushButton(opsWidget)
        self.saveStepParamsBtn.setObjectName(u"saveStepParamsBtn")

        self.horizontalLayout_9.addWidget(self.saveStepParamsBtn)

        self.opLayout.addLayout(self.horizontalLayout_9)

        self.retranslateUi(opsWidget)
        self.opCombo.currentIndexChanged.connect(
            self.opsParamsStack.setCurrentIndex)

        self.opsParamsStack.setCurrentIndex(9)
        self.renderTabTabs.setCurrentIndex(0)

        QMetaObject.connectSlotsByName(opsWidget)

    # setupUi

    def retranslateUi(self, opsWidget):
        self.operationSelect.setTitle(
            QCoreApplication.translate("opsWidget", u"Operation", None))
        self.applyOpLabel.setText(
            QCoreApplication.translate("opsWidget", u"Operation", None))
        self.opCombo.setItemText(
            0, QCoreApplication.translate("opsWidget", u"Shell", None))
        self.opCombo.setItemText(
            1, QCoreApplication.translate("opsWidget", u"Insert", None))
        self.opCombo.setItemText(
            2, QCoreApplication.translate("opsWidget", u"Section", None))
        self.opCombo.setItemText(
            3, QCoreApplication.translate("opsWidget", u"Audio", None))
        self.opCombo.setItemText(
            4, QCoreApplication.translate("opsWidget", u"Crop", None))
        self.opCombo.setItemText(
            5, QCoreApplication.translate("opsWidget", u"Compose Demos", None))
        self.opCombo.setItemText(
            6, QCoreApplication.translate("opsWidget", u"Resize", None))
        self.opCombo.setItemText(
            7, QCoreApplication.translate("opsWidget", u"Add pacing", None))
        self.opCombo.setItemText(
            8,
            QCoreApplication.translate("opsWidget", u"Animate scroll steps",
                                       None))
        self.opCombo.setItemText(
            9, QCoreApplication.translate("opsWidget", u"Render to video",
                                          None))

        self.applyToLabel.setText(
            QCoreApplication.translate("opsWidget", u"Apply to:", None))
        self.allDemoCheck.setText(
            QCoreApplication.translate("opsWidget", u"Apply to all demos",
                                       None))
        self.allStepsCheck.setText(
            QCoreApplication.translate("opsWidget", u"Apply to all steps",
                                       None))
        self.matchSubstringCheck.setText(
            QCoreApplication.translate(
                "opsWidget", u"Apply to steps with matching substring:", None))
        self.label_16.setText(
            QCoreApplication.translate("opsWidget", u"Steps containing:",
                                       None))
        self.applyDemoLabel.setText(
            QCoreApplication.translate("opsWidget", u"Demo", None))
        self.groupBox_6.setTitle(
            QCoreApplication.translate("opsWidget", u"Parameters", None))
        self.label.setText(
            QCoreApplication.translate("opsWidget", u"Background", None))
        #if QT_CONFIG(statustip)
        self.shellImgPath.setStatusTip(
            QCoreApplication.translate(
                "opsWidget",
                u"Filepath of image to be used as shell for demo assets",
                None))
        #endif // QT_CONFIG(statustip)
        self.shellBrowseImgBtn.setText(
            QCoreApplication.translate("opsWidget", u"Browse", None))
        self.label_2.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Coordinates of assets on shell",
                                       None))
        self.label_3.setText(
            QCoreApplication.translate("opsWidget", u"X", None))
        self.label_4.setText(
            QCoreApplication.translate("opsWidget", u"Y", None))
        self.label_5.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Dimensions of assets on shell", None))
        self.label_7.setText(
            QCoreApplication.translate("opsWidget", u"Width", None))
        self.label_6.setText(
            QCoreApplication.translate("opsWidget", u"Height", None))
        self.label_32.setText(
            QCoreApplication.translate("opsWidget", u"Image to paste", None))
        self.insertBrowseImgBtn.setText(
            QCoreApplication.translate("opsWidget", u"Browse", None))
        self.label_13.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Coords of image on assets", None))
        self.label_26.setText(
            QCoreApplication.translate("opsWidget", u"X", None))
        self.label_29.setText(
            QCoreApplication.translate("opsWidget", u"Y", None))
        self.label_12.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Dimensions of image on assets", None))
        self.label_33.setText(
            QCoreApplication.translate("opsWidget", u"Width", None))
        self.label_34.setText(
            QCoreApplication.translate("opsWidget", u"Height", None))

        __sortingEnabled = self.sectionRulesListWidget.isSortingEnabled()
        self.sectionRulesListWidget.setSortingEnabled(False)
        ___qlistwidgetitem = self.sectionRulesListWidget.item(0)
        ___qlistwidgetitem.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Step has TP, next step without TP",
                                       None))
        ___qlistwidgetitem1 = self.sectionRulesListWidget.item(1)
        ___qlistwidgetitem1.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Step has TP, next step with TP",
                                       None))
        ___qlistwidgetitem2 = self.sectionRulesListWidget.item(2)
        ___qlistwidgetitem2.setText(
            QCoreApplication.translate(
                "opsWidget", u"Step has TP, previous step without TP", None))
        ___qlistwidgetitem3 = self.sectionRulesListWidget.item(3)
        ___qlistwidgetitem3.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Step has TP, previous step with TP",
                                       None))
        ___qlistwidgetitem4 = self.sectionRulesListWidget.item(4)
        ___qlistwidgetitem4.setText(
            QCoreApplication.translate("opsWidget", u"Step has fade-in", None))
        ___qlistwidgetitem5 = self.sectionRulesListWidget.item(5)
        ___qlistwidgetitem5.setText(
            QCoreApplication.translate("opsWidget", u"Step has jump box",
                                       None))
        ___qlistwidgetitem6 = self.sectionRulesListWidget.item(6)
        ___qlistwidgetitem6.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Step TP contains text pattern...",
                                       None))
        self.sectionRulesListWidget.setSortingEnabled(__sortingEnabled)

        self.label_10.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Insert new section on...", None))
        self.sectionCoverageLabel.setText(
            QCoreApplication.translate(
                "opsWidget", u"Covers 0 steps in selected sections/steps",
                None))
        self.label_11.setText(
            QCoreApplication.translate(
                "opsWidget",
                u"May not match number of audio soundbites (audio not imported)",
                None))
        self.comboBox.setItemText(
            0,
            QCoreApplication.translate("opsWidget",
                                       u"Mixed section and step audio", None))
        self.comboBox.setItemText(
            1,
            QCoreApplication.translate("opsWidget", u"Section audio only",
                                       None))
        self.comboBox.setItemText(
            2, QCoreApplication.translate("opsWidget", u"Step audio only",
                                          None))

        self.label_8.setText(
            QCoreApplication.translate("opsWidget",
                                       u"Audio attachment behavior", None))
        self.label_14.setText(
            QCoreApplication.translate("opsWidget", u"Crop start coordinates",
                                       None))
        self.label_30.setText(
            QCoreApplication.translate("opsWidget", u"X", None))
        self.label_31.setText(
            QCoreApplication.translate("opsWidget", u"Y", None))
        self.label_15.setText(
            QCoreApplication.translate("opsWidget", u"Crop dimensions", None))
        self.label_35.setText(
            QCoreApplication.translate("opsWidget", u"Width", None))
        self.label_36.setText(
            QCoreApplication.translate("opsWidget", u"Height", None))
        self.tabWidget.setTabText(
            self.tabWidget.indexOf(self.tab),
            QCoreApplication.translate("opsWidget", u"Tab 1", None))
        self.tabWidget.setTabText(
            self.tabWidget.indexOf(self.tab_2),
            QCoreApplication.translate("opsWidget", u"Tab 2", None))
        self.videoTitleLabel.setText(
            QCoreApplication.translate("opsWidget", u"Video Title", None))
        self.videoDirectoryLabel.setText(
            QCoreApplication.translate("opsWidget", u"Video Directory", None))
        self.videoFormatLabel.setText(
            QCoreApplication.translate("opsWidget", u"Video Format", None))
        self.renderOutputFormat.setItemText(
            0, QCoreApplication.translate("opsWidget", u"avi", None))
        self.renderOutputFormat.setItemText(
            1, QCoreApplication.translate("opsWidget", u"mp4", None))

        self.renderTabTabs.setTabText(
            self.renderTabTabs.indexOf(self.renderTabVideoTab),
            QCoreApplication.translate("opsWidget", u"Video", None))
        self.renderTabTabs.setTabText(
            self.renderTabTabs.indexOf(self.renderTabAudioTab),
            QCoreApplication.translate("opsWidget", u"Audio", None))
        self.renderTabTabs.setTabText(
            self.renderTabTabs.indexOf(self.renderTabPacingTab),
            QCoreApplication.translate("opsWidget", u"Pacing", None))
        self.resetStepParamsBtn.setText(
            QCoreApplication.translate("opsWidget", u"Reset to default", None))
        self.saveStepParamsBtn.setText(
            QCoreApplication.translate("opsWidget", u"Save step parameters",
                                       None))
        pass
Beispiel #15
0
class ParameterEditor(QWidget):
    onParametersChanged = Signal()

    def __init__(self, program: Program):
        super().__init__()
        self._program = program

        parametersLabel = QLabel("Parameters")
        newParameterButton = QPushButton("Add Parameter")
        newParameterButton.clicked.connect(self.AddParameter)

        layout = QVBoxLayout()
        titleLayout = QHBoxLayout()
        titleLayout.addWidget(parametersLabel)
        titleLayout.addWidget(newParameterButton)
        layout.addLayout(titleLayout)

        self._listArea = QScrollArea()
        self._listArea.setWidgetResizable(True)
        self._listArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self._listArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        layout.addWidget(self._listArea, stretch=1)
        listWidget = QWidget()
        self._itemLayout = QVBoxLayout()
        self._itemLayout.setAlignment(Qt.AlignTop)
        listWidget.setLayout(self._itemLayout)
        self.setLayout(layout)
        self._listArea.setWidget(listWidget)

        self.items: List[ParameterEditorItem] = []

        self._temporaryParameters = program.parameters.copy()

        self.Populate()

    def AddParameter(self):
        newParameter = Parameter()
        self._temporaryParameters.append(newParameter)
        self.onParametersChanged.emit()
        self.AddToList(newParameter)

    def Populate(self):
        for parameter in self._temporaryParameters:
            self.AddToList(parameter)
        self._listArea.updateGeometry()

    def AddToList(self, parameter: Parameter):
        newItem = ParameterEditorItem(parameter)
        newItem.onRemoveParameter.connect(self.RemoveParameter)
        newItem.onMoveParameterUp.connect(self.MoveParameterUp)
        newItem.onMoveParameterDown.connect(self.MoveParameterDown)
        newItem.onChanged.connect(self.onParametersChanged.emit)
        self._itemLayout.addWidget(newItem)
        self.items.append(newItem)

    def RemoveFromList(self, parameter: Parameter):
        item = [item for item in self.items if item.parameter is parameter]
        item[0].deleteLater()
        self.items.remove(item[0])

    def RemoveParameter(self, parameter: Parameter):
        self._temporaryParameters.remove(parameter)
        self.onParametersChanged.emit()
        self.RemoveFromList(parameter)

    def Reorder(self, parameter: Parameter, newPosition: int):
        item = [item for item in self.items if item.parameter is parameter][0]
        self._itemLayout.removeWidget(item)
        self._itemLayout.insertWidget(newPosition, item)
        self.items.remove(item)
        self.items.insert(newPosition, item)
        self._temporaryParameters.remove(parameter)
        self._temporaryParameters.insert(newPosition, parameter)
        self.onParametersChanged.emit()

    def MoveParameterUp(self, parameter: Parameter):
        index = self._temporaryParameters.index(parameter)
        self.Reorder(parameter, index - 1)

    def MoveParameterDown(self, parameter: Parameter):
        index = self._temporaryParameters.index(parameter)
        self.Reorder(parameter, index + 1)

    def Save(self):
        self._program.parameters = self._temporaryParameters
        self._temporaryParameters = self._program.parameters.copy()
        for item in self.items:
            item.UpdateParameter()