当前位置: 首页>>代码示例>>Python>>正文


Python Appconfig.print_error方法代码示例

本文整理汇总了Python中configuration.Appconfig.Appconfig.print_error方法的典型用法代码示例。如果您正苦于以下问题:Python Appconfig.print_error方法的具体用法?Python Appconfig.print_error怎么用?Python Appconfig.print_error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在configuration.Appconfig.Appconfig的用法示例。


在下文中一共展示了Appconfig.print_error方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OpenProjectInfo

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_error [as 别名]
class OpenProjectInfo(QtGui.QWidget):
    """
    This class is called when User click on Open Project Button
    """
    def __init__(self):
        super(OpenProjectInfo, self).__init__()
        self.obj_validation = Validation()
              
    def body(self):
        self.obj_Appconfig = Appconfig()
        self.openDir = self.obj_Appconfig.default_workspace["workspace"]
        #print "default workspace is now 1", self.openDir
        self.projDir=QtGui.QFileDialog.getExistingDirectory(self,"open",self.openDir)
        if self.obj_validation.validateOpenproj(self.projDir) == True:
            #print "Pass open project test"
            #self.obj_Appconfig = Appconfig()
            self.obj_Appconfig.current_project['ProjectName'] = str(self.projDir)
            if os.path.isdir(self.projDir):
                print "true"
        
            for dirs, subdirs, filelist in os.walk(self.obj_Appconfig.current_project["ProjectName"]):
                directory = dirs
                files = filelist
            self.obj_Appconfig.project_explorer[dirs] = filelist
            json.dump(self.obj_Appconfig.project_explorer, open(self.obj_Appconfig.dictPath,'w'))
            self.obj_Appconfig.print_info('Open Project called')
            self.obj_Appconfig.print_info('Current Project is ' + self.projDir)
            return dirs, filelist
            
        else:
            #print "Failed open project test"
            self.obj_Appconfig.print_error("The project doesn't contain .proj file. Please select the proper directory else you won't be able to perform any operation")
            reply = QtGui.QMessageBox.critical(None, "Error Message",'''<b> Error: The project doesn't contain .proj file.</b><br/>
                    <b>Please select the proper project directory else you won't be able to perform any operation</b>''',QtGui.QMessageBox.Ok|QtGui.QMessageBox.Cancel)
            
            if reply == QtGui.QMessageBox.Ok:
                self.body()
                self.obj_Appconfig.print_info('Open Project called')
                self.obj_Appconfig.print_info('Current Project is ' + self.projDir)
            elif reply == QtGui.QMessageBox.Cancel:
                self.obj_Appconfig.print_info('No Project opened')
            else:
                pass
开发者ID:FOSSEE-Manipal,项目名称:eSim,代码行数:45,代码来源:openProject.py

示例2: __init__

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_error [as 别名]

#.........这里部分代码省略.........
                if "DC" in i:    #DC for dc files and AC for ac ones
                    break
        


             
        #print "VoltNumber",vnumber
        #print "CurrentNumber",inumber
        vnumber = vnumber//l        #vnumber gives the no of voltage nodes
        inumber  = inumber//l        #inumber gives the no of branches
        
        #print "VoltNumber",vnumber
        #print "CurrentNumber",inumber
        
        p=[p,vnumber,self.analysisType,self.dec,inumber]
        
        return p
    
    def openFile(self,fpath):
        #print "Calling Open File"
        
        try:
            with open (os.path.join(fpath,"plot_data_i.txt")) as f2:
                alli = f2.read()
                
            alli = alli.split("\n")
            self.NBIList = []

            with open (os.path.join(fpath,"plot_data_v.txt")) as f1:
                allv = f1.read()

        except Exception as e:
            print "Exception Message : ",str(e)
            self.obj_appconfig.print_error('Exception Message :' + str(e))
            self.msg = QtGui.QErrorMessage(None)
            self.msg.showMessage('Unable to open plot data files.')
            self.msg.setWindowTitle("Error Message:openFile")
            
        try:
            for l in alli[3].split(" "):
                if len(l)>0:
                    self.NBIList.append(l)
            self.NBIList = self.NBIList[2:]
            len_NBIList = len(self.NBIList)
            #print "NBILIST : ",self.NBIList
        except Exception as e:
            print "Exception Message : ",str(e)
            self.obj_appconfig.print_error('Exception Message :' + str(e))
            self.msg = QtGui.QErrorMessage(None)
            self.msg.showMessage('Error in Analysis File.')
            self.msg.setWindowTitle("Error Message:openFile")
            
            
        d = self.numberFinder(fpath)
        d1 = int(d[0] + 1)
        d2 = int(d[1])
        d3 = d[2]
        d4 = d[4]
        
        dec = [d3,d[3]]
        #print "No. of Nodes:", d2
        self.NBList = []
        allv=allv.split("\n")
        for l in allv[3].split(" "):
            if len(l)>0:
                self.NBList.append(l)
开发者ID:FOSSEE-Manipal,项目名称:eSim,代码行数:70,代码来源:pythonPlotting.py

示例3: Application

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_error [as 别名]

#.........这里部分代码省略.........
        """
        print "Function : Change Workspace"
        self.obj_workspace.returnWhetherClickedOrNot(self)
        self.hide()
        self.obj_workspace.show()


    def help_project(self):
        print "Function : Help"
        self.obj_appconfig.print_info('Help is called')
        print "Current Project is : ",self.obj_appconfig.current_project
        self.obj_Mainview.obj_dockarea.usermanual()    
    
    
    def open_ngspice(self):
        """
        This Function execute ngspice on current project
        """
        
        self.projDir = self.obj_appconfig.current_project["ProjectName"]
        
        if self.projDir != None:
            self.obj_Mainview.obj_dockarea.ngspiceEditor(self.projDir)
            
            #Calling Python Plotting
                
            try:
                self.obj_Mainview.obj_dockarea.plottingEditor()
            except Exception as e:
                self.msg = QtGui.QErrorMessage(None)
                self.msg.showMessage('Error while opening python plotting Editor.\
                Please look at console for more details ')
                print "Exception Message:",str(e)
                self.obj_appconfig.print_error('Exception Message : ' + str(e))
                self.msg.setWindowTitle("Error Message")
                        
        else:
            self.msg = QtGui.QErrorMessage()
            self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
            self.msg.setWindowTitle("Error Message")
            
    def open_subcircuit(self):
        print "Function : Subcircuit editor"
        self.obj_appconfig.print_info('Subcircuit editor is called')
        self.obj_Mainview.obj_dockarea.subcircuiteditor()

    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')
            
      
    def open_modelEditor(self):
        print "Function : Model editor"
        self.obj_appconfig.print_info('Model editor is called')
        self.obj_Mainview.obj_dockarea.modelEditor()
开发者ID:rowhit,项目名称:eSim,代码行数:70,代码来源:Application.py

示例4: Application

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_error [as 别名]

#.........这里部分代码省略.........
        """
        This function call New Project Info class.
        """
        text, ok = QtGui.QInputDialog.getText(self, 'New Project Info','Enter Project Name:')
        if ok:
            self.projname = (str(text))
            self.project = NewProjectInfo()
            directory, filelist =self.project.createProject(self.projname)
    
            self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist)
            
        else:
            print "No project created"
            self.obj_appconfig.print_info('No new project created')
            try:
                self.obj_appconfig.print_info('Current project is : ' + self.obj_appconfig.current_project["ProjectName"])
            except:
                pass
    def open_project(self):
        """
        This project call Open Project Info class
        """
        print "Open Project called"
        self.project = OpenProjectInfo()
        
        try:
            directory, filelist = self.project.body()
            self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist)
        except:
            pass
    
    def open_ngspice(self):
        """
        This Function execute ngspice on current project
        """
        
        self.projDir = self.obj_appconfig.current_project["ProjectName"]
        
        if self.projDir != None:
            self.obj_Mainview.obj_dockarea.ngspiceEditor(self.projDir)
            time.sleep(2)  #Need permanent solution 
            #Calling Python Plotting
                
            try:
                self.obj_Mainview.obj_dockarea.plottingEditor()
            except Exception as e:
                self.msg = QtGui.QErrorMessage(None)
                self.msg.showMessage('Error while opening python plotting Editor.')
                print "Exception:",str(e)
                self.obj_appconfig.print_error('Exception generated : ' + str(e))
                self.msg.setWindowTitle("Error Message")
                        
        else:
            self.msg = QtGui.QErrorMessage()
            self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
            self.msg.setWindowTitle("Error Message")
            
    def open_subcircuit(self):
        print "Subcircuit editor is called"
        self.obj_appconfig.print_info('Subcircuit editor is called')
        self.obj_Mainview.obj_dockarea.subcircuiteditor()
                    
        
    def exit_project(self):
        print "Exit Project called"
        for proc in self.obj_appconfig.procThread_list:
                try:
                        proc.terminate()
                except:
                        pass
        ##Just checking if open and New window is open. If yes just close it when application is closed
        try:
            self.project.close()
        except:
            pass
        
        self.close()
        
    def help_project(self):
        print "Help is called"
        self.obj_appconfig.print_info('Help is called')
        print "Current Project : ",self.obj_appconfig.current_project
        #self.obj_appconfig.print_info('Current Project : ' + self.obj_appconfig.current_project['ProjectName'])  
        #self.obj_Mainview.obj_dockarea.plottingEditor()
    
        
    def open_modelEditor(self):
        print "model editor is called"
        self.obj_appconfig.print_info('model editor is called')
        self.obj_Mainview.obj_dockarea.modelEditor()
    """    
    def open_kicadToNgspice(self):
        print "kicadToNgspice is called"
        self.obj_appconfig.print_info('kicadToNgspice is called')
        self.obj_Mainview.obj_dockarea.kicadToNgspiceEditor()"""
        
        
        
    def testing(self):
        print "Success hit kicad button"
开发者ID:FOSSEE-Manipal,项目名称:eSim,代码行数:104,代码来源:Application.py

示例5: __init__

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_error [as 别名]

#.........这里部分代码省略.........
    #Commenting as it is no longer needed as PBC and Layout will open from eeschema 
    def openFootprint(self):
        """
        This function create command to open Footprint editor 
        """
        print "Kicad Foot print Editor called"
        self.projDir = self.obj_appconfig.current_project["ProjectName"]
        try: 
            self.obj_appconfig.print_info('Kicad Footprint Editor is called for project : ' + self.projDir)      
        except:
            pass
        #Validating if current project is available or not
        
        if self.obj_validation.validateKicad(self.projDir):
            #print "calling Kicad FootPrint Editor ",self.projDir
            self.projName = os.path.basename(self.projDir)
            self.project = os.path.join(self.projDir,self.projName)
            
            #Creating a command to run
            self.cmd = "cvpcb "+self.project+".net "
            self.obj_workThread = Worker.WorkerThread(self.cmd)
            self.obj_workThread.start()
            
        else:
            self.msg = QtGui.QErrorMessage(None)
            self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
            self.obj_appconfig.print_warning('Please select the project first. You can either create new project or open existing project')
            self.msg.setWindowTitle("Error Message")
        
    def openLayout(self):
        """
        This function create command to open Layout editor
        """
        print "Kicad Layout is called"
        self.projDir = self.obj_appconfig.current_project["ProjectName"]
        try:
            self.obj_appconfig.print_info('PCB Layout is called for project : ' + self.projDir)
        except:
            pass       
        #Validating if current project is available or not
        if self.obj_validation.validateKicad(self.projDir):
            print "calling Kicad schematic ",self.projDir
            self.projName = os.path.basename(self.projDir)
            self.project = os.path.join(self.projDir,self.projName)
            
            #Creating a command to run
            self.cmd = "pcbnew "+self.project+".net "
            self.obj_workThread = Worker.WorkerThread(self.cmd)
            self.obj_workThread.start()
            
        else:
            self.msg = QtGui.QErrorMessage(None)   
            self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
            self.obj_appconfig.print_warning('Please select the project first. You can either create new project or open existing project')
            self.msg.setWindowTitle("Error Message")     
    
    '''
            
    def openKicadToNgspice(self):
        """
        This function create command to call kicad to Ngspice converter.
        """
        print "Function: Open Kicad to Ngspice Converter"
        
        self.projDir = self.obj_appconfig.current_project["ProjectName"]
        try:
            self.obj_appconfig.print_info('Kicad to Ngspice Conversion is called')
            self.obj_appconfig.print_info('Current Project is ' + self.projDir)
        except:
            pass
        #Validating if current project is available or not
        if self.obj_validation.validateKicad(self.projDir):
            #Cheking if project has .cir file or not
            if self.obj_validation.validateCir(self.projDir):
                self.projName = os.path.basename(self.projDir)
                self.project = os.path.join(self.projDir,self.projName)
                
                ## TODO
                #Creating a command to run
                """
                self.cmd = "python  ../kicadtoNgspice/KicadtoNgspice.py " +self.project+".cir "
                self.obj_workThread = Worker.WorkerThread(self.cmd)
                self.obj_workThread.start()
                """
                var=self.project+".cir"
                self.obj_dockarea.kicadToNgspiceEditor(var)
                
         
                
            else:
                self.msg = QtGui.QErrorMessage(None)
                self.msg.showMessage('The project does not contain any Kicad netlist file for conversion.')
                self.obj_appconfig.print_error('The project does not contain any Kicad netlist file for conversion.')
                self.msg.setWindowTitle("Error Message")  
           
        else:
            self.msg = QtGui.QErrorMessage(None)
            self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
            self.obj_appconfig.print_warning('Please select the project first. You can either create new project or open existing project')
            self.msg.setWindowTitle("Error Message")  
开发者ID:rowhit,项目名称:eSim,代码行数:104,代码来源:Kicad.py

示例6: OpenModelicaEditor

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_error [as 别名]
class OpenModelicaEditor(QtGui.QWidget):

    def __init__(self, dir=None):
        QtGui.QWidget.__init__(self)
        self.obj_validation = Validation()
        self.obj_appconfig = Appconfig()
        self.projDir = dir
        self.projName = os.path.basename(self.projDir)
        self.ngspiceNetlist = os.path.join(self.projDir,self.projName+".cir.out")
        self.modelicaNetlist = os.path.join(self.projDir,self.projName+".mo")
        self.map_json = Appconfig.modelica_map_json

        self.grid = QtGui.QGridLayout()
        self.FileEdit = QtGui.QLineEdit()
        self.FileEdit.setText(self.ngspiceNetlist)
        self.grid.addWidget(self.FileEdit, 0, 0)

        self.browsebtn = QtGui.QPushButton("Browse")
        self.browsebtn.clicked.connect(self.browseFile)
        self.grid.addWidget(self.browsebtn, 0, 1)

        self.convertbtn = QtGui.QPushButton("Convert")
        self.convertbtn.clicked.connect(self.callConverter)
        self.grid.addWidget(self.convertbtn, 2, 1)

        self.loadOMbtn = QtGui.QPushButton("Load OMEdit")
        self.loadOMbtn.clicked.connect(self.callOMEdit)
        self.grid.addWidget(self.loadOMbtn, 3, 1)

        #self.setGeometry(300, 300, 350, 300)
        self.setLayout(self.grid)
        self.show()

    def browseFile(self):

        self.ngspiceNetlist = QtGui.QFileDialog.getOpenFileName(self, 'Open Ngspice file', BROWSE_LOCATION)
        self.FileEdit.setText(self.ngspiceNetlist)

    def callConverter(self):

        try:
            ### TODO
            self.cmd1 = "python ../ngspicetoModelica/NgspicetoModelica.py " + self.ngspiceNetlist + ' ' + self.map_json
            #self.obj_workThread1 = Worker.WorkerThread(self.cmd1)
            #self.obj_workThread1.start()
            convert_process = Popen(self.cmd1, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
            error_code = convert_process.stdout.read()
            if not error_code:
                self.msg = QtGui.QMessageBox()
                self.msg.setText("Ngspice netlist successfully converted to OpenModelica netlist")
                self.obj_appconfig.print_info("Ngspice netlist successfully converted to OpenModelica netlist")
                self.msg.exec_()

            else:
                self.err_msg = QtGui.QErrorMessage()
                self.err_msg.showMessage('Unable to convert NgSpice netlist to Modelica netlist. Check the netlist :'+ error_code)
                self.err_msg.setWindowTitle("Ngspice to Modelica conversion error")
                self.obj_appconfig.print_error(error_code)

        except Exception as e:
            self.msg = QtGui.QErrorMessage()
            self.msg.showMessage('Unable to convert NgSpice netlist to Modelica netlist. Check the netlist :'+str(e))
            self.msg.setWindowTitle("Ngspice to Modelica conversion error")


    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 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("Missing OpenModelica")
            self.obj_appconfig.print_info(self.msgContent)
            self.msg.exec_()
开发者ID:rowhit,项目名称:eSim,代码行数:87,代码来源:ModelicaUI.py


注:本文中的configuration.Appconfig.Appconfig.print_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。