Ejemplo n.º 1
0
 def tearDown(self):
     """
     Perform operation on test end.
     """
     # SHUTDOWN EDDY
     self.eddy.quit()
     # REMOVE TEST DIRECTORY
     rmdir('@tests/.tests/')
Ejemplo n.º 2
0
 def doDeleteProject(self, path):
     """
     Delete the given project.
     :type path: str
     """
     msgbox = QtWidgets.QMessageBox(self)
     msgbox.setFont(Font('Roboto', 11))
     msgbox.setIconPixmap(
         QtGui.QIcon(':/icons/48/ic_question_outline_black').pixmap(48))
     msgbox.setInformativeText(
         '<b>NOTE: This action is not reversible!</b>')
     msgbox.setStandardButtons(QtWidgets.QMessageBox.No
                               | QtWidgets.QMessageBox.Yes)
     msgbox.setTextFormat(QtCore.Qt.RichText)
     msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy'))
     msgbox.setWindowTitle('Remove project: {0}?'.format(
         os.path.basename(path)))
     msgbox.setText(
         'Are you sure you want to remove project: <b>{0}</b>'.format(
             os.path.basename(path)))
     msgbox.exec_()
     if msgbox.result() == QtWidgets.QMessageBox.Yes:
         try:
             # REMOVE THE PROJECT FROM DISK
             rmdir(path)
         except Exception as e:
             msgbox = QtWidgets.QMessageBox(self)
             msgbox.setDetailedText(format_exception(e))
             msgbox.setIconPixmap(
                 QtGui.QIcon(':/icons/48/ic_error_outline_black').pixmap(
                     48))
             msgbox.setStandardButtons(QtWidgets.QMessageBox.Close)
             msgbox.setTextFormat(QtCore.Qt.RichText)
             msgbox.setText(
                 'Eddy could not remove the specified project: <b>{0}</b>!'.
                 format(os.path.basename(path)))
             msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy'))
             msgbox.setWindowTitle('ERROR!')
             msgbox.exec_()
         else:
             # UPDATE THE RECENT PROJECT LIST
             recentList = []
             settings = QtCore.QSettings(ORGANIZATION, APPNAME)
             for path in map(expandPath, settings.value('project/recent')):
                 if isdir(path):
                     recentList.append(path)
             settings.setValue('project/recent', recentList)
             settings.sync()
             # CLEAR CURRENT LAYOUT
             for i in reversed(range(self.innerLayoutL.count())):
                 item = self.innerLayoutL.itemAt(i)
                 self.innerLayoutL.removeItem(item)
             # DISPOSE NEW PROJECT BLOCK
             for path in recentList:
                 project = ProjectBlock(path, self.innerWidgetL)
                 connect(project.sgnDeleteProject, self.doDeleteProject)
                 connect(project.sgnOpenProject, self.doOpenProject)
                 self.innerLayoutL.addWidget(project, 0, QtCore.Qt.AlignTop)
Ejemplo n.º 3
0
 def uninstall(self, plugin):
     """
     Uninstall the given plugin.
     :type plugin: AbstractPlugin
     """
     if self.dispose(plugin):
         self.session.removePlugin(plugin)
         path = plugin.path()
         if isdir(path):
             rmdir(path)
         elif fexists(path):
             fremove(path)
Ejemplo n.º 4
0
 def tearDown(self):
     """
     Perform operation on test end.
     """
     # SHUTDOWN EDDY
     self.eddy.quit()
     # REMOVE TEST DIRECTORY
     rmdir('@tests/.tests/')
     # RELEASE LOCK AND FLUSH STREAMS
     sys.stderr.flush()
     sys.stdout.flush()
     testcase_lock.release()
Ejemplo n.º 5
0
 def uninstall(self, reasoner):
     """
     Uninstall the given reasoner.
     :type reasoner: AbstractReasoner
     """
     if self.dispose(reasoner):
         self.session.removeReasoner(reasoner)
         path = reasoner.path()
         if isdir(path):
             rmdir(path)
         elif fexists(path):
             fremove(path)
Ejemplo n.º 6
0
 def uninstall(self, plugin):
     """
     Uninstall the given plugin.
     :type plugin: AbstractPlugin
     """
     if self.dispose(plugin):
         self.session.removePlugin(plugin)
         path = plugin.path()
         if isdir(path):
             rmdir(path)
         elif fexists(path):
             fremove(path)
Ejemplo n.º 7
0
Archivo: setup.py Proyecto: jonntd/eddy
        def buildDMG(self):
            """
            Build the DMG image.
            """
            if not isdir('@support/createdmg') or not fexists('@support/createdmg/create-dmg'):
                raise OSError('unable to find create-dmg utility: please clone Eddy with all its submodules' )

            if fexists(self.dmgName):
                os.unlink(self.dmgName)

            stagingDir = os.path.join(self.buildDir, 'tmp')
            if isdir(stagingDir):
                rmdir(stagingDir)

            self.mkpath(stagingDir)

            # Move the app bundle into a separate folder that will be used as source folder for the DMG image
            if subprocess.call(['cp', '-R', self.bundleDir, stagingDir]) != 0:
                raise OSError('could not move app bundle in staging directory')

            # We create the DMG disk image using the create-dmg submodule.
            params = [expandPath('@support/createdmg/create-dmg')]
            params.extend(['--volname', self.volume_label])
            params.extend(['--text-size', '12'])
            params.extend(['--icon-size', '48'])
            params.extend(['--icon', '{0}.app'.format(self.bundleName), '60', '50'])
            params.extend(['--hide-extension', '{0}.app'.format(self.bundleName)])

            if self.applications_shortcut:
                params.extend(['--app-drop-link', '60', '130'])

            if self.volume_background:
                if not fexists(self.volume_background):
                    raise OSError('DMG volume background image not found at {0}'.format(self.volume_background))
                print('Using DMG volume background: {0}'.format(self.volume_background))
                from PIL import Image
                w, h = Image.open(self.volume_background).size
                params.extend(['--background', self.volume_background, '--window-size', str(w), str(h)])

            if self.volume_icon:
                if not fexists(self.volume_icon):
                    raise OSError('DMG volume icon not found at {0}'.format(self.volume_icon))
                print('Using DMG volume icon: {0}'.format(self.volume_icon))
                params.extend(['--volicon', self.volume_icon])

            params.extend([self.dmgName, stagingDir])

            subprocess.call(params)
            rmdir(stagingDir)
Ejemplo n.º 8
0
 def doDeleteProject(self, path):
     """
     Delete the given project.
     :type path: str
     """
     msgbox = QtWidgets.QMessageBox(self)
     msgbox.setFont(Font('Roboto', 11))
     msgbox.setIconPixmap(QtGui.QIcon(':/icons/48/ic_question_outline_black').pixmap(48))
     msgbox.setInformativeText('<b>NOTE: This action is not reversible!</b>')
     msgbox.setStandardButtons(QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes)
     msgbox.setTextFormat(QtCore.Qt.RichText)
     msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy'))
     msgbox.setWindowTitle('Remove project: {0}?'.format(os.path.basename(path)))
     msgbox.setText('Are you sure you want to remove project: <b>{0}</b>'.format(os.path.basename(path)))
     msgbox.exec_()
     if msgbox.result() == QtWidgets.QMessageBox.Yes:
         try:
             # REMOVE THE PROJECT FROM DISK
             rmdir(path)
         except Exception as e:
             msgbox = QtWidgets.QMessageBox(self)
             msgbox.setDetailedText(format_exception(e))
             msgbox.setIconPixmap(QtGui.QIcon(':/icons/48/ic_error_outline_black').pixmap(48))
             msgbox.setStandardButtons(QtWidgets.QMessageBox.Close)
             msgbox.setTextFormat(QtCore.Qt.RichText)
             msgbox.setText('Eddy could not remove the specified project: <b>{0}</b>!'.format(os.path.basename(path)))
             msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy'))
             msgbox.setWindowTitle('ERROR!')
             msgbox.exec_()
         else:
             # UPDATE THE RECENT PROJECT LIST
             recentList = []
             settings = QtCore.QSettings(ORGANIZATION, APPNAME)
             for path in map(expandPath, settings.value('project/recent')):
                 if isdir(path):
                     recentList.append(path)
             settings.setValue('project/recent', recentList)
             settings.sync()
             # CLEAR CURRENT LAYOUT
             for i in reversed(range(self.innerLayoutL.count())):
                 item = self.innerLayoutL.itemAt(i)
                 self.innerLayoutL.removeItem(item)
             # DISPOSE NEW PROJECT BLOCK
             for path in recentList:
                 project = ProjectBlock(path, self.innerWidgetL)
                 connect(project.sgnDeleteProject, self.doDeleteProject)
                 connect(project.sgnOpenProject, self.doOpenRecentProject)
                 self.innerLayoutL.addWidget(project, 0, QtCore.Qt.AlignTop)
Ejemplo n.º 9
0
 def setUp(self):
     """
     Initialize test case environment.
     """
     # MAKE SURE TO USE CORRECT SETTINGS
     settings = QtCore.QSettings(ORGANIZATION, APPNAME)
     settings.setValue('workspace/home', WORKSPACE)
     settings.setValue('update/check_on_startup', False)
     settings.sync()
     # MAKE SURE THE WORKSPACE DIRECTORY EXISTS
     mkdir(expandPath(WORKSPACE))
     # MAKE SURE TO HAVE A CLEAN TEST ENVIRONMENT
     rmdir('@tests/.tests/')
     mkdir('@tests/.tests/')
     # INITIALIZED VARIABLES
     self.eddy = None
     self.project = None
     self.session = None
Ejemplo n.º 10
0
 def doDeleteProject(self, path):
     """
     Delete the given project.
     :type path: str
     """
     msgbox = QtWidgets.QMessageBox(self)
     msgbox.setIconPixmap(
         QtGui.QIcon(':/icons/48/ic_question_outline_black').pixmap(48))
     msgbox.setInformativeText(
         '<b>NOTE: This action is not reversible!</b>')
     msgbox.setStandardButtons(QtWidgets.QMessageBox.No
                               | QtWidgets.QMessageBox.Yes)
     msgbox.setTextFormat(QtCore.Qt.RichText)
     msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy'))
     msgbox.setWindowTitle('Remove project: {0}?'.format(
         os.path.basename(path)))
     msgbox.setText(
         'Are you sure you want to remove project: <b>{0}</b>'.format(
             os.path.basename(path)))
     msgbox.exec_()
     if msgbox.result() == QtWidgets.QMessageBox.Yes:
         try:
             # REMOVE THE PROJECT FROM DISK
             rmdir(path)
         except Exception as e:
             msgbox = QtWidgets.QMessageBox(self)
             msgbox.setDetailedText(format_exception(e))
             msgbox.setIconPixmap(
                 QtGui.QIcon(':/icons/48/ic_error_outline_black').pixmap(
                     48))
             msgbox.setStandardButtons(QtWidgets.QMessageBox.Close)
             msgbox.setTextFormat(QtCore.Qt.RichText)
             msgbox.setText(
                 'Eddy could not remove the specified project: <b>{0}</b>!'.
                 format(os.path.basename(path)))
             msgbox.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy'))
             msgbox.setWindowTitle('ERROR!')
             msgbox.exec_()
         else:
             self.sgnUpdateRecentProjects.emit()
Ejemplo n.º 11
0
 def setUp(self):
     """
     Initialize test case environment.
     """
     # ACQUIRE LOCK AND FLUSH STREAMS
     testcase_lock.acquire()
     sys.stderr.flush()
     sys.stdout.flush()
     # MAKE SURE TO USE CORRECT SETTINGS
     settings = QtCore.QSettings(ORGANIZATION, APPNAME)
     settings.setValue('workspace/home', WORKSPACE)
     settings.setValue('update/check_on_startup', False)
     settings.sync()
     # MAKE SURE THE WORKSPACE DIRECTORY EXISTS
     mkdir(expandPath(WORKSPACE))
     # MAKE SURE TO HAVE A CLEAN TEST ENVIRONMENT
     rmdir('@tests/.tests/')
     mkdir('@tests/.tests/')
     # INITIALIZED VARIABLES
     self.eddy = None
     self.project = None
     self.session = None
Ejemplo n.º 12
0
Archivo: setup.py Proyecto: jonntd/eddy
 def run(self):
     """
     Command execution.
     """
     rmdir(BUILD_DIR)
     rmdir(DIST_DIR)