Esempio n. 1
0
    def __viewProperties(self):
        """Handles the 'view properties' context menu item"""
        if self.__projectContextItem is None:
            return
        if not self.__projectContextItem.isValid():
            return

        if self.__projectContextItem.isCurrent():
            # This is the current project - it can be edited
            project = GlobalData().project
            dlg = ProjectPropertiesDialog(project, self)
            if dlg.exec_() == QDialog.Accepted:
                importDirs = []
                for index in range(dlg.importDirList.count()):
                    importDirs.append(dlg.importDirList.item(index).text())

                scriptName = dlg.scriptEdit.text().strip()
                relativePath = os.path.relpath(scriptName,
                                               project.getProjectDir())
                if not relativePath.startswith('..'):
                    scriptName = relativePath

                mdDocFile = dlg.mdDocEdit.text().strip()
                relativePath = os.path.relpath(mdDocFile,
                                               project.getProjectDir())
                if not relativePath.startswith('..'):
                    mdDocFile = relativePath

                project.updateProperties({
                    'scriptname':
                    scriptName,
                    'mddocfile':
                    mdDocFile,
                    'creationdate':
                    dlg.creationDateEdit.text().strip(),
                    'author':
                    dlg.authorEdit.text().strip(),
                    'license':
                    dlg.licenseEdit.text().strip(),
                    'copyright':
                    dlg.copyrightEdit.text().strip(),
                    'version':
                    dlg.versionEdit.text().strip(),
                    'email':
                    dlg.emailEdit.text().strip(),
                    'description':
                    dlg.descriptionEdit.toPlainText().strip(),
                    'uuid':
                    dlg.uuidEdit.text().strip(),
                    'importdirs':
                    importDirs,
                    'encoding':
                    dlg.encodingCombo.currentText().strip()
                })
        else:
            # This is not the current project - it can be viewed
            fName = self.__projectContextItem.getFilename()
            dlg = ProjectPropertiesDialog(fName, self)
            dlg.exec_()
    def __viewProperties( self ):
        " Handles the 'view properties' context menu item "
        if self.__projectContextItem is None:
            return
        if not self.__projectContextItem.isValid():
            return

        if self.__projectContextItem.isCurrent():
            # This is the current project - it can be edited
            project = GlobalData().project
            dialog = ProjectPropertiesDialog( project )
            if dialog.exec_() == QDialog.Accepted:
                importDirs = []
                for index in xrange( dialog.importDirList.count() ):
                    importDirs.append( dialog.importDirList.item( index ).text() )

                scriptName = dialog.scriptEdit.text().strip()
                relativePath = relpath( scriptName, project.getProjectDir() )
                if not relativePath.startswith( '..' ):
                    scriptName = relativePath

                project.updateProperties(
                    scriptName, importDirs,
                    dialog.creationDateEdit.text().strip(),
                    dialog.authorEdit.text().strip(),
                    dialog.licenseEdit.text().strip(),
                    dialog.copyrightEdit.text().strip(),
                    dialog.versionEdit.text().strip(),
                    dialog.emailEdit.text().strip(),
                    dialog.descriptionEdit.toPlainText().strip() )
        else:
            # This is not the current project - it can be viewed
            fName = self.__projectContextItem.getFilename()
            dialog = ProjectPropertiesDialog( fName )
            dialog.exec_()
        return
Esempio n. 3
0
    def __viewProperties(self):
        " Handles the 'view properties' context menu item "
        if self.__projectContextItem is None:
            return
        if not self.__projectContextItem.isValid():
            return

        if self.__projectContextItem.isCurrent():
            # This is the current project - it can be edited
            project = GlobalData().project
            dialog = ProjectPropertiesDialog(project, self)
            if dialog.exec_() == QDialog.Accepted:
                importDirs = []
                for index in xrange(dialog.importDirList.count()):
                    importDirs.append(dialog.importDirList.item(index).text())

                scriptName = dialog.scriptEdit.text().strip()
                relativePath = relpath(scriptName, project.getProjectDir())
                if not relativePath.startswith('..'):
                    scriptName = relativePath

                project.updateProperties(
                    scriptName, importDirs,
                    dialog.creationDateEdit.text().strip(),
                    dialog.authorEdit.text().strip(),
                    dialog.licenseEdit.text().strip(),
                    dialog.copyrightEdit.text().strip(),
                    dialog.versionEdit.text().strip(),
                    dialog.emailEdit.text().strip(),
                    dialog.descriptionEdit.toPlainText().strip())
        else:
            # This is not the current project - it can be viewed
            fName = self.__projectContextItem.getFilename()
            dialog = ProjectPropertiesDialog(fName, self)
            dialog.exec_()
        return