Exemple #1
0
    def importPath(self):
        ''' Returns path selected file or archive'''

        self.import_dialog = DialogImport()
        self.import_dialog.exec_()
        if (isinstance(self.import_dialog.filesSelected(), list)):
            path = self.import_dialog.filesSelected()
        else:
            path = self.import_dialog.selectedFiles()
        self.importEdit.setText(path[0])
Exemple #2
0
    def importPath(self):
        ''' Returns path selected file or archive'''

        self.import_dialog = DialogImport()
        self.import_dialog.exec_()
        if (isinstance(self.import_dialog.filesSelected(), list)):
            path = self.import_dialog.filesSelected()
        else:
            path = self.import_dialog.selectedFiles()
        self.importEdit.setText(path[0])
Exemple #3
0
class ImportPage(QtWidgets.QWizardPage):

    def __init__(self, Wizard, parent=None):
        super(ImportPage, self).__init__(parent)

        self.base = Wizard.base

        self.setTitle(self.tr("Beginning"))
        self.setSubTitle(self.tr("Choose distribution and import " +
                                 "tarball or folder with source code"))
        self.textLabel = QLabel()
        self.textLabel.setText(
            "<html><head/><body><p><span style=\"font-size:12pt;\">" +
            "RPG - RPM Package Generator is tool, that guides you through" +
            " the creation of a RPM package.<br>" +
            "Please fill following details about your package.<br>For " +
            "more information use tool tips (move the cursor on the label)." +
            "<br><strong>Note:</strong> You can change target distribution" +
            " and architecture later or you can build more packages." +
            "</p></body></html>")
        self.importLabel = QLabel("Source<font color=\'red\'>*</font>")
        self.importEdit = QLineEdit()
        self.importEdit.setMinimumHeight(30)
        self.importLabel.setBuddy(self.importEdit)
        self.importLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.importLabel.setToolTip(
            "Pristine source package (e.g. tarballs) and patches")
        self.importEdit.textChanged.connect(self.checkPath)
        self.importEdit.setMinimumHeight(34)

        self.importButton = QPushButton("Import")
        self.importButton.setMinimumHeight(45)
        self.importButton.setMinimumWidth(115)
        self.importButton.clicked.connect(self.importPath)

        self.ArchLabel = QLabel("Architecture<font color=\'red\'>*</font>")
        self.ArchEdit = QComboBox()
        self.ArchEdit.setMinimumHeight(30)
        arch = platform.architecture()[0]
        if arch == "32bit":
            self.ArchEdit.addItem("i386")
            self.ArchEdit.addItem("x86_64")
        else:
            self.ArchEdit.addItem("x86_64")
            self.ArchEdit.addItem("i386")
        self.ArchLabel.setBuddy(self.ArchEdit)
        self.ArchLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.ArchLabel.setToolTip(
            "Choose target architecture (32 bit - i386 or 64 bit - x68_64)")

        self.DistroLabel = QLabel("Distribution<font color=\'red\'>*</font>")
        self.DistroEdit = QComboBox()
        self.DistroEdit.setMinimumHeight(30)
        self.DistroEdit.addItem("fedora-22")
        self.DistroEdit.addItem("fedora-21")
        self.DistroEdit.addItem("fedora-20")
        self.DistroEdit.addItem("fedora-19")
        self.DistroEdit.addItem("fedora-rawhide")
        self.DistroEdit.addItem("epel-7")
        self.DistroEdit.addItem("epel-6")
        self.DistroEdit.addItem("epel-5")
        self.DistroLabel.setBuddy(self.DistroEdit)
        self.DistroLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.DistroLabel.setToolTip("Choose target distribution")

        self.registerField("Source*", self.importEdit)

        mainLayout = QVBoxLayout()
        grid = QGridLayout()
        grid.addWidget(self.textLabel, 0, 0, 1, 6)
        grid.setVerticalSpacing(15)
        grid.addWidget(self.importLabel, 1, 0, 1, 1)
        grid.addWidget(self.importEdit, 1, 1, 1, 6)
        grid.addWidget(self.importButton, 1, 7, 1, 1)
        grid.addWidget(self.DistroLabel, 2, 0, 1, 0)
        grid.addWidget(self.DistroEdit, 2, 1, 1, 2)
        grid.addWidget(self.ArchLabel, 3, 0, 1, 0)
        grid.addWidget(self.ArchEdit, 3, 1, 1, 2)
        mainLayout.addSpacing(25)
        mainLayout.addLayout(grid)
        self.setLayout(mainLayout)

    def checkPath(self):
        ''' Checks, if path to import is correct while typing'''
        path = Path(self.importEdit.text())
        if(path.exists()):
            self.importEdit.setStyleSheet("")
        else:
            self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
                                          "border-width: 1px;" +
                                          "border-color: red;" +
                                          "border-radius: 3px;" +
                                          "background-color:" +
                                          "rgb(233,233,233);}")

    def importPath(self):
        ''' Returns path selected file or archive'''

        self.import_dialog = DialogImport()
        self.import_dialog.exec_()
        if (isinstance(self.import_dialog.filesSelected(), list)):
            path = self.import_dialog.filesSelected()
        else:
            path = self.import_dialog.selectedFiles()
        try:
            self.importEdit.setText(path[0])
        except IndexError:
            pass

    def validatePage(self):
        ''' [Bool] Function that invokes just after pressing the next button
            {True} - user moves to next page
            {False}- user blocked on current page
            ###### Setting up RPG class references ###### '''

        # Verifying path
        path = Path(self.importEdit.text())
        if(path.exists()):
            self.base.target_arch = self.ArchEdit.currentText()
            self.base.target_distro = self.DistroEdit.currentText()
            self.base.load_project_from_url(self.importEdit.text().strip())
            new_thread = Thread(
                target=self.base.fetch_repos, args=(self.base.target_distro,
                                                    self.base.target_arch))
            new_thread.start()
            self.importEdit.setStyleSheet("")
            return True
        else:
            self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
                                          "border-width: 1px;" +
                                          "border-color: red;" +
                                          "border-radius: 3px;" +
                                          "background-color:" +
                                          "rgb(233,233,233);}")
            return False

    def nextId(self):
        ''' [int] Function that determines the next page after the current one
            - returns integer value and then checks, which value is page"
            in NUM_PAGES'''

        return Wizard.PageMandatory
Exemple #4
0
class ImportPage(QtWidgets.QWizardPage):
    def __init__(self, Wizard, parent=None):
        super(ImportPage, self).__init__(parent)

        self.base = Wizard.base

        self.setTitle(self.tr("Beginning"))
        self.setSubTitle(
            self.tr("Fill in fields and import " +
                    "your SRPM or source folder"))
        ''' Creating widgets and setting them to layout'''
        self.nameLabel = QLabel("Name<font color=\'red\'>*</font>")
        self.nameEdit = QLineEdit()
        self.nameEdit.setMinimumHeight(30)
        self.nameLabel.setBuddy(self.nameEdit)
        self.nameLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.nameLabel.setToolTip("Text for name label")

        self.versionLabel = QLabel("Version<font color=\'red\'>*</font>")
        self.versionEdit = QLineEdit()
        self.versionEdit.setMinimumHeight(30)
        self.versionLabel.setBuddy(self.versionEdit)
        self.versionLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.versionLabel.setToolTip("Text for verion label")

        self.releaseLabel = QLabel("Release<font color=\'red\'>*</font>")
        self.releaseEdit = QLineEdit()
        self.releaseEdit.setMinimumHeight(30)
        self.releaseLabel.setBuddy(self.releaseEdit)
        self.releaseLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.releaseLabel.setToolTip("Text for release label")

        self.licenseLabel = QLabel("License<font color=\'red\'>*</font>")
        self.licenseEdit = QLineEdit()
        self.licenseEdit.setMinimumHeight(30)
        self.licenseLabel.setBuddy(self.licenseEdit)
        self.licenseLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.licenseLabel.setToolTip("Text for license label")

        self.summaryLabel = QLabel("Summary<font color=\'red\'>*</font>")
        self.summaryEdit = QLineEdit()
        self.summaryEdit.setMinimumHeight(30)
        self.summaryLabel.setBuddy(self.summaryEdit)
        self.summaryLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.summaryLabel.setToolTip("Text for summary label")

        self.URLLabel = QLabel("URL: ")
        self.URLEdit = QLineEdit()
        self.URLEdit.setMinimumHeight(30)
        self.URLLabel.setBuddy(self.URLEdit)
        self.URLLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.URLLabel.setToolTip("Text for URL label")

        self.descriptionLabel = QLabel("Description: ")
        self.descriptionEdit = QLineEdit()
        self.descriptionEdit.setMinimumHeight(30)
        self.descriptionLabel.setBuddy(self.descriptionEdit)
        self.descriptionLabel.setCursor(
            QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.descriptionLabel.setToolTip("Text for description label")

        self.vendorLabel = QLabel("Vendor: ")
        self.vendorEdit = QLineEdit()
        self.vendorEdit.setMinimumHeight(30)
        self.vendorLabel.setBuddy(self.vendorEdit)
        self.vendorLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.vendorLabel.setToolTip("Text for vendor label")

        self.packagerLabel = QLabel("Packager: ")
        self.packagerEdit = QLineEdit()
        self.packagerEdit.setMinimumHeight(30)
        self.packagerLabel.setBuddy(self.packagerEdit)
        self.packagerLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.packagerLabel.setToolTip("Text for packager label")

        self.importLabel = QLabel("Source<font color=\'red\'>*</font>")
        self.importEdit = QLineEdit()
        self.importEdit.setMinimumHeight(30)
        self.importLabel.setBuddy(self.importEdit)
        self.importLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.importLabel.setToolTip("Text for import label")
        self.importEdit.textChanged.connect(self.checkPath)
        self.importEdit.setMinimumHeight(34)

        self.importButton = QPushButton("Import")
        self.importButton.setMinimumHeight(45)
        self.importButton.setMinimumWidth(115)
        self.importButton.clicked.connect(self.importPath)

        # Making mandatory fields:
        self.registerField("Name*", self.nameEdit)
        self.registerField("Summary*", self.summaryEdit)
        self.registerField("Version*", self.versionEdit)
        self.registerField("Release*", self.releaseEdit)
        self.registerField("License*", self.licenseEdit)
        self.registerField("Source*", self.importEdit)

        mainLayout = QVBoxLayout()
        grid = QGridLayout()
        grid.addWidget(self.importLabel, 0, 0, 1, 1)
        grid.addWidget(self.importEdit, 0, 1, 1, 1)
        grid.addWidget(self.importButton, 0, 2, 1, 1)
        grid.addWidget(self.nameLabel, 1, 0, 1, 1)
        grid.addWidget(self.nameEdit, 1, 1, 1, 3)
        grid.addWidget(self.versionLabel, 2, 0, 1, 1)
        grid.addWidget(self.versionEdit, 2, 1, 1, 3)
        grid.addWidget(self.releaseLabel, 3, 0, 1, 1)
        grid.addWidget(self.releaseEdit, 3, 1, 1, 3)
        grid.addWidget(self.licenseLabel, 4, 0, 1, 1)
        grid.addWidget(self.licenseEdit, 4, 1, 1, 3)
        grid.addWidget(self.summaryLabel, 5, 0, 1, 1)
        grid.addWidget(self.summaryEdit, 5, 1, 1, 3)
        grid.addWidget(self.URLLabel, 6, 0, 1, 1)
        grid.addWidget(self.URLEdit, 6, 1, 1, 3)
        grid.addWidget(self.descriptionLabel, 7, 0, 1, 1)
        grid.addWidget(self.descriptionEdit, 7, 1, 1, 3)
        grid.addWidget(self.vendorLabel, 8, 0, 1, 1)
        grid.addWidget(self.vendorEdit, 8, 1, 1, 3)
        grid.addWidget(self.packagerLabel, 9, 0, 1, 1)
        grid.addWidget(self.packagerEdit, 9, 1, 1, 3)
        mainLayout.addSpacing(40)
        mainLayout.addLayout(grid)
        self.setLayout(mainLayout)

    def checkPath(self):
        ''' Checks, if path to import is correct while typing'''
        path = Path(self.importEdit.text())
        if (path.exists()):
            self.importEdit.setStyleSheet("")
        else:
            self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
                                          "border-width: 1px;" +
                                          "border-color: red;" +
                                          "border-radius: 3px;" +
                                          "background-color:" +
                                          "rgb(233,233,233);}")

    def importPath(self):
        ''' Returns path selected file or archive'''

        self.import_dialog = DialogImport()
        self.import_dialog.exec_()
        if (isinstance(self.import_dialog.filesSelected(), list)):
            path = self.import_dialog.filesSelected()
        else:
            path = self.import_dialog.selectedFiles()
        self.importEdit.setText(path[0])

    def validatePage(self):
        ''' [Bool] Function that invokes just after pressing the next button
            {True} - user moves to next page
            {False}- user blocked on current page
            ###### Setting up RPG class references ###### '''

        self.base.spec.tags['Name'] = self.nameEdit.text()
        self.base.spec.tags['Version'] = self.versionEdit.text()
        self.base.spec.tags['Release'] = self.releaseEdit.text()
        self.base.spec.tags['License'] = self.licenseEdit.text()
        self.base.spec.tags['URL'] = self.URLEdit.text()
        self.base.spec.tags['Summary'] = self.summaryEdit.text()
        self.base.spec.scripts['%description'] = self.descriptionEdit.text()
        self.base.spec.tags['Vendor'] = self.vendorEdit.text()
        self.base.spec.tags['Packager'] = self.packagerEdit.text()
        self.base.spec.tags['Path'] = self.importEdit.text()

        # Verifying path
        path = Path(self.base.spec.tags['Path'])
        if (path.exists()):
            self.base.process_archive_or_dir(self.base.spec.tags['Path'])
            self.base.run_raw_sources_analysis()
            self.importEdit.setStyleSheet("")
            return True
        else:
            self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
                                          "border-width: 1px;" +
                                          "border-color: red;" +
                                          "border-radius: 3px;" +
                                          "background-color:" +
                                          "rgb(233,233,233);}")
            return False

    def nextId(self):
        ''' [int] Function that determines the next page after the current one
            - returns integer value and then checks, which value is page"
            in NUM_PAGES'''

        return Wizard.PagePatches
Exemple #5
0
class ImportPage(QtWidgets.QWizardPage):
    def __init__(self, Wizard, parent=None):
        super(ImportPage, self).__init__(parent)

        self.base = Wizard.base

        self.setTitle(self.tr("Beginning"))
        self.setSubTitle(self.tr("Fill in fields and import " +
                                 "your SRPM or source folder"))
        ''' Creating widgets and setting them to layout'''
        self.nameLabel = QLabel("Name<font color=\'red\'>*</font>")
        self.nameEdit = QLineEdit()
        self.nameEdit.setMinimumHeight(30)
        self.nameLabel.setBuddy(self.nameEdit)
        self.nameLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.nameLabel.setToolTip("Text for name label")

        self.versionLabel = QLabel("Version<font color=\'red\'>*</font>")
        self.versionEdit = QLineEdit()
        self.versionEdit.setMinimumHeight(30)
        self.versionLabel.setBuddy(self.versionEdit)
        self.versionLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.versionLabel.setToolTip("Text for verion label")

        self.releaseLabel = QLabel("Release<font color=\'red\'>*</font>")
        self.releaseEdit = QLineEdit()
        self.releaseEdit.setMinimumHeight(30)
        self.releaseLabel.setBuddy(self.releaseEdit)
        self.releaseLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.releaseLabel.setToolTip("Text for release label")

        self.licenseLabel = QLabel("License<font color=\'red\'>*</font>")
        self.licenseEdit = QLineEdit()
        self.licenseEdit.setMinimumHeight(30)
        self.licenseLabel.setBuddy(self.licenseEdit)
        self.licenseLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.licenseLabel.setToolTip("Text for license label")

        self.summaryLabel = QLabel("Summary<font color=\'red\'>*</font>")
        self.summaryEdit = QLineEdit()
        self.summaryEdit.setMinimumHeight(30)
        self.summaryLabel.setBuddy(self.summaryEdit)
        self.summaryLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.summaryLabel.setToolTip("Text for summary label")

        self.URLLabel = QLabel("URL: ")
        self.URLEdit = QLineEdit()
        self.URLEdit.setMinimumHeight(30)
        self.URLLabel.setBuddy(self.URLEdit)
        self.URLLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.URLLabel.setToolTip("Text for URL label")

        self.descriptionLabel = QLabel("Description: ")
        self.descriptionEdit = QLineEdit()
        self.descriptionEdit.setMinimumHeight(30)
        self.descriptionLabel.setBuddy(self.descriptionEdit)
        self.descriptionLabel.setCursor(QtGui.
                                        QCursor(QtCore.Qt.WhatsThisCursor))
        self.descriptionLabel.setToolTip("Text for description label")

        self.vendorLabel = QLabel("Vendor: ")
        self.vendorEdit = QLineEdit()
        self.vendorEdit.setMinimumHeight(30)
        self.vendorLabel.setBuddy(self.vendorEdit)
        self.vendorLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.vendorLabel.setToolTip("Text for vendor label")

        self.packagerLabel = QLabel("Packager: ")
        self.packagerEdit = QLineEdit()
        self.packagerEdit.setMinimumHeight(30)
        self.packagerLabel.setBuddy(self.packagerEdit)
        self.packagerLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.packagerLabel.setToolTip("Text for packager label")

        self.importLabel = QLabel("Source<font color=\'red\'>*</font>")
        self.importEdit = QLineEdit()
        self.importEdit.setMinimumHeight(30)
        self.importLabel.setBuddy(self.importEdit)
        self.importLabel.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.importLabel.setToolTip("Text for import label")
        self.importEdit.textChanged.connect(self.checkPath)
        self.importEdit.setMinimumHeight(34)

        self.importButton = QPushButton("Import")
        self.importButton.setMinimumHeight(45)
        self.importButton.setMinimumWidth(115)
        self.importButton.clicked.connect(self.importPath)

        # Making mandatory fields:
        self.registerField("Name*", self.nameEdit)
        self.registerField("Summary*", self.summaryEdit)
        self.registerField("Version*", self.versionEdit)
        self.registerField("Release*", self.releaseEdit)
        self.registerField("License*", self.licenseEdit)
        self.registerField("Source*", self.importEdit)

        mainLayout = QVBoxLayout()
        grid = QGridLayout()
        grid.addWidget(self.importLabel, 0, 0, 1, 1)
        grid.addWidget(self.importEdit, 0, 1, 1, 1)
        grid.addWidget(self.importButton, 0, 2, 1, 1)
        grid.addWidget(self.nameLabel, 1, 0, 1, 1)
        grid.addWidget(self.nameEdit, 1, 1, 1, 3)
        grid.addWidget(self.versionLabel, 2, 0, 1, 1)
        grid.addWidget(self.versionEdit, 2, 1, 1, 3)
        grid.addWidget(self.releaseLabel, 3, 0, 1, 1)
        grid.addWidget(self.releaseEdit, 3, 1, 1, 3)
        grid.addWidget(self.licenseLabel, 4, 0, 1, 1)
        grid.addWidget(self.licenseEdit, 4, 1, 1, 3)
        grid.addWidget(self.summaryLabel, 5, 0, 1, 1)
        grid.addWidget(self.summaryEdit, 5, 1, 1, 3)
        grid.addWidget(self.URLLabel, 6, 0, 1, 1)
        grid.addWidget(self.URLEdit, 6, 1, 1, 3)
        grid.addWidget(self.descriptionLabel, 7, 0, 1, 1)
        grid.addWidget(self.descriptionEdit, 7, 1, 1, 3)
        grid.addWidget(self.vendorLabel, 8, 0, 1, 1)
        grid.addWidget(self.vendorEdit, 8, 1, 1, 3)
        grid.addWidget(self.packagerLabel, 9, 0, 1, 1)
        grid.addWidget(self.packagerEdit, 9, 1, 1, 3)
        mainLayout.addSpacing(40)
        mainLayout.addLayout(grid)
        self.setLayout(mainLayout)

    def checkPath(self):
        ''' Checks, if path to import is correct while typing'''
        path = Path(self.importEdit.text())
        if(path.exists()):
            self.importEdit.setStyleSheet("")
        else:
            self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
                                          "border-width: 1px;" +
                                          "border-color: red;" +
                                          "border-radius: 3px;" +
                                          "background-color:" +
                                          "rgb(233,233,233);}")

    def importPath(self):
        ''' Returns path selected file or archive'''

        self.import_dialog = DialogImport()
        self.import_dialog.exec_()
        if (isinstance(self.import_dialog.filesSelected(), list)):
            path = self.import_dialog.filesSelected()
        else:
            path = self.import_dialog.selectedFiles()
        self.importEdit.setText(path[0])

    def validatePage(self):
        ''' [Bool] Function that invokes just after pressing the next button
            {True} - user moves to next page
            {False}- user blocked on current page
            ###### Setting up RPG class references ###### '''

        self.base.spec.tags['Name'] = self.nameEdit.text()
        self.base.spec.tags['Version'] = self.versionEdit.text()
        self.base.spec.tags['Release'] = self.releaseEdit.text()
        self.base.spec.tags['License'] = self.licenseEdit.text()
        self.base.spec.tags['URL'] = self.URLEdit.text()
        self.base.spec.tags['Summary'] = self.summaryEdit.text()
        self.base.spec.scripts['%description'] = self.descriptionEdit.text()
        self.base.spec.tags['Vendor'] = self.vendorEdit.text()
        self.base.spec.tags['Packager'] = self.packagerEdit.text()
        self.base.spec.tags['Path'] = self.importEdit.text()

        # Verifying path
        path = Path(self.base.spec.tags['Path'])
        if(path.exists()):
            self.base.process_archive_or_dir(self.base.spec.tags['Path'])
            self.base.run_raw_sources_analysis()
            self.importEdit.setStyleSheet("")
            return True
        else:
            self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
                                          "border-width: 1px;" +
                                          "border-color: red;" +
                                          "border-radius: 3px;" +
                                          "background-color:" +
                                          "rgb(233,233,233);}")
            return False

    def nextId(self):
        ''' [int] Function that determines the next page after the current one
            - returns integer value and then checks, which value is page"
            in NUM_PAGES'''

        return Wizard.PagePatches