Example #1
0
    def callOMEdit(self):

        if self.obj_validation.validateTool("OMEdit"):
            self.cmd2 = "OMEdit " + self.modelicaNetlist
            self.obj_workThread2 = Worker.WorkerThread(self.cmd2)
            self.obj_workThread2.start()
            print("OMEdit called")
            self.obj_appconfig.print_info("OMEdit called")

        else:
            self.msg = QtGui.QMessageBox()
            self.msgContent = (
                "There was an error while opening OMEdit.<br/>"
                "Please make sure OpenModelica is installed in your"
                " system.<br/>"
                "To install it on Linux : Go to <a href="
                "https://www.openmodelica.org/download/download-linux"
                ">OpenModelica Linux</a> and install nightly build"
                " release.<br/>"
                "To install it on Windows : Go to <a href="
                "https://www.openmodelica.org/download/download-windows"
                ">OpenModelica Windows</a> and install latest version.<br/>")
            self.msg.setTextFormat(QtCore.Qt.RichText)
            self.msg.setText(self.msgContent)
            self.msg.setWindowTitle("Missing OpenModelica")
            self.obj_appconfig.print_info(self.msgContent)
            self.msg.exec_()
Example #2
0
    def open_OMoptim(self):
        """
        This function uses validateTool() method from Validation.py:

            - If 'OMOptim' is present in executables list then
              it passes command 'OMOptim' to WorkerThread class of Worker.py
            - If 'OMOptim' is not present, then it shows error message with
              link to download it on Linux and Windows.
        """
        print("Function : OMOptim")
        self.obj_appconfig.print_info('OMOptim is called')
        # Check if OMOptim is installed
        if self.obj_validation.validateTool("OMOptim"):
            # Creating a command to run
            self.cmd = "OMOptim"
            self.obj_workThread = Worker.WorkerThread(self.cmd)
            self.obj_workThread.start()
        else:
            self.msg = QtGui.QMessageBox()
            self.msgContent = (
                "There was an error while opening OMOptim.<br/>"
                "Please make sure OpenModelica is installed in your"
                " system.<br/>"
                "To install it on Linux : Go to <a href="
                "https://www.openmodelica.org/download/download-linux"
                ">OpenModelica Linux</a> and install nightly build"
                " release.<br/>"
                "To install it on Windows : Go to <a href="
                "https://www.openmodelica.org/download/download-windows"
                ">OpenModelica Windows</a> and install latest version.<br/>")
            self.msg.setTextFormat(QtCore.Qt.RichText)
            self.msg.setText(self.msgContent)
            self.msg.setWindowTitle("Error Message")
            self.obj_appconfig.print_info(self.msgContent)
            self.msg.exec_()
Example #3
0
    def open_nghdl(self):
        """
        This function calls NGHDL option in left-tool-bar.
        It uses validateTool() method from Validation.py:

            - If 'nghdl' is present in executables list then
              it passes command 'nghdl -e' to WorkerThread class of
              Worker.py.
            - If 'nghdl' is not present, then it shows error message.
        """
        print("Function : NGHDL")
        self.obj_appconfig.print_info('NGHDL is called')

        if self.obj_validation.validateTool('nghdl'):
            self.cmd = 'nghdl -e'
            self.obj_workThread = Worker.WorkerThread(self.cmd)
            self.obj_workThread.start()
        else:
            self.msg = QtGui.QErrorMessage()
            self.msg.setModal(True)
            self.msg.setWindowTitle('NGHDL Error')
            self.msg.showMessage('Error while opening NGHDL. ' +
                                 'Please make sure it is installed')
            self.obj_appconfig.print_error('Error while opening NGHDL. ' +
                                           'Please make sure it is installed')
            self.msg.exec_()
Example #4
0
    def callOMEdit(self):

        try:
            modelFiles = glob.glob(self.modelicaNetlist)
            modelFiles = ' '.join(file for file in modelFiles)
            self.cmd2 = self.OMPath + "/OMEdit " + modelFiles
            print(self.cmd2)
            self.obj_workThread2 = Worker.WorkerThread(self.cmd2)
            self.obj_workThread2.start()
            print("OMEdit called")
            self.obj_appconfig.print_info("OMEdit called")

        except BaseException:
            self.msg = QtWidgets.QMessageBox()
            self.msgContent = (
                "There was an error while opening OMEdit.<br/>"
                "Please make sure OpenModelica is installed in your"
                " system.<br/>"
                "To install it on Linux : Go to <a href="
                "https://www.openmodelica.org/download/download-linux"
                ">OpenModelica Linux</a> and install nightly build"
                " release.<br/>"
                "To install it on Windows : Go to <a href="
                "https://www.openmodelica.org/download/download-windows"
                ">OpenModelica Windows</a> and install latest version.<br/>")
            self.msg.setTextFormat(QtCore.Qt.RichText)
            self.msg.setText(self.msgContent)
            self.msg.setWindowTitle("Missing OpenModelica")
            self.obj_appconfig.print_info(self.msgContent)
            self.msg.exec_()
Example #5
0
    def createSubcircuit(self, subName):
        """
        This function create Subcircuit related directories and files
        """
        self.create_schematic = subName
        #Checking if Workspace already exist or not
        self.schematic_path = (os.path.join(os.path.abspath('..'),
                                            'SubcircuitLibrary',
                                            self.create_schematic))

        #Validation for new subcircuit
        if self.schematic_path == "":
            self.reply = "NONE"
        else:
            self.reply = self.obj_validation.validateNewproj(
                str(self.schematic_path))

        #Checking Validations Response
        if self.reply == "VALID":
            print "Validated : Creating subcircuit directory"
            try:
                os.mkdir(self.schematic_path)
                self.schematic = os.path.join(self.schematic_path,
                                              self.create_schematic)
                self.cmd = "eeschema " + self.schematic + ".sch"
                self.obj_workThread = Worker.WorkerThread(self.cmd)
                self.obj_workThread.start()
                self.close()
            except:
                #print "Some Thing Went Wrong"
                self.msg = QtGui.QErrorMessage(self)
                self.msg.showMessage(
                    'Unable to create subcircuit. Please make sure you have write permission on '
                    + self.schematic_path)
                self.msg.setWindowTitle("Error Message")

            self.obj_appconfig.current_subcircuit[
                'SubcircuitName'] = self.schematic_path

        elif self.reply == "CHECKEXIST":
            #print "Project already exist"
            self.msg = QtGui.QErrorMessage(self)
            self.msg.showMessage(
                'The subcircuit "' + self.create_schematic +
                '" already exist.Please select the different name or delete existing subcircuit'
            )
            self.msg.setWindowTitle("Error Message")

        elif self.reply == "CHECKNAME":
            #print "Name is not proper"
            self.msg = QtGui.QErrorMessage(self)
            self.msg.showMessage(
                'The subcircuit name should not contain space between them')
            self.msg.setWindowTitle("Error Message")

        elif self.reply == "NONE":
            self.msg = QtGui.QErrorMessage(self)
            self.msg.showMessage('The subcircuit name cannot be empty')
            self.msg.setWindowTitle("Error Message")
Example #6
0
    def open_nghdl(self):
        print "Function : Nghdl"
        self.obj_appconfig.print_info('Nghdl is called')

        if self.obj_validation.validateTool('nghdl'):
            self.cmd = 'nghdl -e'
            self.obj_workThread = Worker.WorkerThread(self.cmd)
            self.obj_workThread.start()

        else:
            self.msg = QtGui.QErrorMessage(None)
            self.msg.showMessage('Error while opening nghdl. Please make sure nghdl is installed')
            self.obj_appconfig.print_error('Error while opening nghdl. Please make sure nghdl is installed')
            self.msg.setWindowTitle('nghdl Error Message')
Example #7
0
 def open_OMoptim(self):
     print "Function : OM Optim"    
     self.obj_appconfig.print_info('OM Optim is called')
     #Check if OMOptim is installed 
     if self.obj_validation.validateTool("OMOptim"):
         #Creating a command to run
         self.cmd = "OMOptim"
         self.obj_workThread = Worker.WorkerThread(self.cmd)
         self.obj_workThread.start()
     else:
         self.msg = QtGui.QMessageBox()
         self.msgContent = "There was an error while opening OMOptim.<br/>\
         Please make sure OpenModelica is installed in your system. <br/>\
         To install it on Linux : Go to <a href=https://www.openmodelica.org/download/download-linux>OpenModelica Linux</a> and install nigthly build release.<br/>\
         To install it on Windows : Go to <a href=https://www.openmodelica.org/download/download-windows>OpenModelica Windows</a> and install latest version.<br/>"
         self.msg.setTextFormat(QtCore.Qt.RichText)
         self.msg.setText(self.msgContent)
         self.msg.setWindowTitle("Error Message")
         self.obj_appconfig.print_info(self.msgContent)
         self.msg.exec_()
Example #8
0
    def createSubcircuit(self, subName):
        """
        - This function create workspace for subcircuit.
        - It also validate file names for Subcircuits:
            - File name should not contain space.
            - Name can not be empty.
            - File name already exists.
        """
        self.create_schematic = subName
        # Checking if Workspace already exist or not
        self.schematic_path = (os.path.join(os.path.abspath('library'),
                                            'SubcircuitLibrary',
                                            self.create_schematic))

        # Validation for new subcircuit
        if self.schematic_path == "":
            self.reply = "NONE"
        else:
            self.reply = self.obj_validation.validateNewproj(
                str(self.schematic_path))

        # Checking Validations Response
        if self.reply == "VALID":
            print("Validated : Creating subcircuit directory")
            try:
                os.mkdir(self.schematic_path)
                self.schematic = os.path.join(self.schematic_path,
                                              self.create_schematic)
                self.cmd = "eeschema " + self.schematic + ".sch"
                self.obj_workThread = Worker.WorkerThread(self.cmd)
                self.obj_workThread.start()
                self.close()
            except BaseException:
                self.msg = QtGui.QErrorMessage(self)
                self.msg.setModal(True)
                self.msg.setWindowTitle("Error Message")
                self.msg.showMessage(
                    'Unable to create subcircuit. Please make sure ' +
                    'you have write permission on ' + self.schematic_path)
                self.msg.exec_()

            self.obj_appconfig.current_subcircuit['SubcircuitName'] \
                = self.schematic_path

        elif self.reply == "CHECKEXIST":
            self.msg = QtGui.QErrorMessage(self)
            self.msg.setModal(True)
            self.msg.setWindowTitle("Error Message")
            self.msg.showMessage(
                'The subcircuit "' + self.create_schematic +
                '" already exist.Please select the different name or delete' +
                'existing subcircuit')
            self.msg.exec_()

        elif self.reply == "CHECKNAME":
            self.msg = QtGui.QErrorMessage(self)
            self.msg.setModal(True)
            self.msg.setWindowTitle("Error Message")
            self.msg.showMessage(
                'The subcircuit name should not contain space between them')
            self.msg.exec_()

        elif self.reply == "NONE":
            self.msg = QtGui.QErrorMessage(self)
            self.msg.setModal(True)
            self.msg.setWindowTitle("Error Message")
            self.msg.showMessage('The subcircuit name cannot be empty')
            self.msg.exec_()