Exemplo n.º 1
0
class ExportPdfOptionDialog(QDialog):
    """
    Displays options UI for the PDF
    """

    def __init__(self, parent=None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter="*.pdf")
        self._fileNameField.setFilename(os.path.join(os.getenv("HOME"), "Desktop", "Sequence.pdf"))
        self._optionDropdown = QComboBox()
        self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]}

        for pdfMode in sorted(self._pdfActionSettings, reverse=True):
            self._optionDropdown.addItem(pdfMode)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._optionDropdown)
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

    def numRows(self):
        """Returns the number of rows for the pdf"""
        optionText = self._optionDropdown.currentText()
        return self._pdfActionSettings[optionText][0]

    def numColumns(self):
        """Returns the number of columns for the pdf"""
        optionText = self._optionDropdown.currentText()
        return self._pdfActionSettings[optionText][1]

    def filePath(self):
        """Returns the filepath for the pdf"""
        filename = self._fileNameField.filename()
        if not filename.endswith(".pdf"):
            filename = filename + ".pdf"
        return filename
Exemplo n.º 2
0
    def __init__(self, parent=None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter="*.pdf")
        self._fileNameField.setFilename(os.path.join(os.getenv("HOME"), "Desktop", "Sequence.pdf"))
        self._optionDropdown = QComboBox()
        self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]}

        for pdfMode in sorted(self._pdfActionSettings, reverse=True):
            self._optionDropdown.addItem(pdfMode)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._optionDropdown)
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
    def __init__(self, parent = None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField  = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter='*.pdf')
        self._fileNameField.setFilename(os.path.join(os.getenv('HOME'), "Desktop", "Sequence.pdf"))
        self._pdfLayoutDropdown  = QComboBox()
        self._pdfLayoutDropdown.setToolTip("Set the PDF page layout type.")
        self._thumbFrameTypeDropdown  = QComboBox()
        self._thumbFrameTypeDropdown.setToolTip("Set which frame to take the thumbnail from.")

        self._buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfLayouts = PDFExporter.PAGE_LAYOUTS_DICT

        self._thumbFrameTypes = PDFExporter.THUMB_FRAME_TYPES

        for pdfLayout in sorted(self._pdfLayouts, reverse=True):
            self._pdfLayoutDropdown.addItem(pdfLayout)

        for frameType in self._thumbFrameTypes:
            self._thumbFrameTypeDropdown.addItem(frameType)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._pdfLayoutDropdown)
        layout.addRow("Thumbnail Frame:", self._thumbFrameTypeDropdown)        
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
class ExportPdfOptionDialog(QDialog):
    """
    Displays options UI for the PDF
    """

    def __init__(self, parent = None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField  = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter='*.pdf')
        self._fileNameField.setFilename(os.path.join(os.getenv('HOME'), "Desktop", "Sequence.pdf"))
        self._pdfLayoutDropdown  = QComboBox()
        self._pdfLayoutDropdown.setToolTip("Set the PDF page layout type.")
        self._thumbFrameTypeDropdown  = QComboBox()
        self._thumbFrameTypeDropdown.setToolTip("Set which frame to take the thumbnail from.")

        self._buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfLayouts = PDFExporter.PAGE_LAYOUTS_DICT

        self._thumbFrameTypes = PDFExporter.THUMB_FRAME_TYPES

        for pdfLayout in sorted(self._pdfLayouts, reverse=True):
            self._pdfLayoutDropdown.addItem(pdfLayout)

        for frameType in self._thumbFrameTypes:
            self._thumbFrameTypeDropdown.addItem(frameType)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._pdfLayoutDropdown)
        layout.addRow("Thumbnail Frame:", self._thumbFrameTypeDropdown)        
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )

    def _thumbnailFrameType(self):
        """Returns the currently selected thumbnail frame type"""
        return self._thumbFrameTypeDropdown.currentText()

    def _numRows(self):
        """Returns the number of rows for the pdf"""
        optionText = self._pdfLayoutDropdown.currentText()
        return self._pdfLayouts[optionText][0]

    def _numColumns(self):
        """Returns the number of columns for the pdf"""
        optionText = self._pdfLayoutDropdown.currentText()
        return self._pdfLayouts[optionText][1]

    def _filePath(self):
        """Returns the filepath for the pdf"""
        filename = self._fileNameField.filename()
        if not filename.endswith('.pdf'):
            filename = filename + ".pdf"
        return filename