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


Python Appconfig.print_info方法代码示例

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


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

示例1: OpenProjectInfo

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_info [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: ModelEditorclass

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

#.........这里部分代码省略.........
        else:
            pass
        
        
    def savemodelfile(self):
        if self.newflag== 1:
            self.createXML(self.model_name)
        else:
            self.savethefile(self.editfile)
        
     
    def createXML(self,model_name):
        '''
        This function creates .xml and .lib files from the model table
        '''
        root = ET.Element("library")
        ET.SubElement(root, "model_name").text = model_name
        ET.SubElement(root, "ref_model").text = self.modelname
        param = ET.SubElement(root, "param")
        for tags, text in self.modeldict.items():
            ET.SubElement(param, tags).text = text
        tree = ET.ElementTree(root)
        defaultcwd = os.getcwd()
        self.savepath = '../deviceModelLibrary'
        if self.diode.isChecked():
            savepath = os.path.join(self.savepath, 'Diode')  
            os.chdir(savepath)
            txtfile = open(self.modelname+'.lib', 'w')
            txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
            for tags, text in self.modeldict.items():
                txtfile.write('+ ' + tags + '=' + text +'\n')
            txtfile.write(')')
            tree.write(self.modelname +".xml")
            self.obj_appconfig.print_info('New ' + self.modelname + ' ' + self.model_name + ' library created at ' + os.getcwd())
        if self.mos.isChecked():
            savepath = os.path.join(self.savepath, 'MOS')  
            os.chdir(savepath)
            txtfile = open(self.modelname+'.lib', 'w')
            txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
            for tags, text in self.modeldict.items():
                txtfile.write('+ ' + tags + '=' + text +'\n')
            txtfile.write(')')
            tree.write(self.modelname +".xml")
            self.obj_appconfig.print_info('New ' + self.modelname + ' ' + self.model_name + ' library created at ' + os.getcwd())
        if self.jfet.isChecked():
            savepath = os.path.join(self.savepath, 'JFET')  
            os.chdir(savepath)
            txtfile = open(self.modelname+'.lib', 'w')
            txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
            for tags, text in self.modeldict.items():
                txtfile.write('+ ' + tags + '=' + text +'\n')
            txtfile.write(')')
            tree.write(self.modelname +".xml")
            self.obj_appconfig.print_info('New ' + self.modelname + ' ' + self.model_name + ' library created at ' + os.getcwd())
        if self.igbt.isChecked():
            savepath = os.path.join(self.savepath, 'IGBT')  
            os.chdir(savepath)
            txtfile = open(self.modelname+'.lib', 'w')
            txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
            for tags, text in self.modeldict.items():
                txtfile.write('+ ' + tags + '=' + text +'\n')
            txtfile.write(')')
            tree.write(self.modelname +".xml")
            self.obj_appconfig.print_info('New ' + self.modelname + ' ' + self.model_name + ' library created at ' + os.getcwd())
        if self.magnetic.isChecked():
            savepath = os.path.join(self.savepath, 'Misc')  
开发者ID:vu2swz,项目名称:eSim,代码行数:70,代码来源:ModelEditor.py

示例3: ProjectExplorer

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_info [as 别名]
class ProjectExplorer(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.obj_appconfig = Appconfig()
        self.treewidget = QtGui.QTreeWidget()
        self.window= QtGui.QVBoxLayout()
        header = QtGui.QTreeWidgetItem(["Projects","path"])
        self.treewidget.setHeaderItem(header)
        self.treewidget.setColumnHidden(1,True)
        
        #CSS
        self.treewidget.setStyleSheet(" \
        QTreeView { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px;  } \
        QTreeView::branch:has-siblings:!adjoins-item { border-image: url(../../images/vline.png) 0; } \
        QTreeView::branch:has-siblings:adjoins-item { border-image: url(../../images/branch-more.png) 0; } \
        QTreeView::branch:!has-children:!has-siblings:adjoins-item { border-image: url(../../images/branch-end.png) 0; } \
        QTreeView::branch:has-children:!has-siblings:closed, \
        QTreeView::branch:closed:has-children:has-siblings { border-image: none; image: url(../../images/branch-closed.png); } \
        QTreeView::branch:open:has-children:!has-siblings, \
        QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(../../images/branch-open.png); } \
        ")
        
        for parents, children in self.obj_appconfig.project_explorer.items():
            os.path.join(parents)
            if os.path.exists(parents):
                pathlist= parents.split(os.sep)
                parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1],parents])
                for files in children:
                    childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)])
        self.window.addWidget(self.treewidget)
        
        self.treewidget.doubleClicked.connect(self.openProject)
        self.treewidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.treewidget.customContextMenuRequested.connect(self.openMenu)
        self.setLayout(self.window)
        self.show()
        
    def addTreeNode(self, parents, children):
        os.path.join(parents)
        pathlist= parents.split(os.sep)
        parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1], parents])
        for files in children:
            childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)])
            
    def openMenu(self, position):
    
        indexes = self.treewidget.selectedIndexes()
        if len(indexes) > 0:
        
            level = 0
            index = indexes[0]
            while index.parent().isValid():
                index = index.parent()
                level += 1
        
        menu = QtGui.QMenu()
        if level == 0:
            deleteproject = menu.addAction(self.tr("Remove Project"))
            deleteproject.triggered.connect(self.removeProject)
            refreshproject= menu.addAction(self.tr("Refresh"))
            refreshproject.triggered.connect(self.refreshProject)
        elif level == 1:
            openfile = menu.addAction(self.tr("Open"))
            openfile.triggered.connect(self.openProject)
        
        menu.exec_(self.treewidget.viewport().mapToGlobal(position))  
        
    def openProject(self):
        self.indexItem =self.treewidget.currentIndex()
        filename= self.indexItem.data().toString()
        self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString()
        self.obj_appconfig.print_info('The current project is ' + self.filePath)
        
        self.textwindow = QtGui.QWidget()
        self.textwindow.setMinimumSize(600, 500)
        self.textwindow.setGeometry(QtCore.QRect(400,150,400,400))
        self.textwindow.setWindowTitle(filename)
        
        self.text = QtGui.QTextEdit()
        self.save = QtGui.QPushButton('Save and Exit')
        self.save.setDisabled(True)
        self.windowgrid = QtGui.QGridLayout()
        if (os.path.isfile(str(self.filePath)))== True:
            self.fopen = open(str(self.filePath), 'r')
            lines = self.fopen.read()
            self.text.setText(lines)
    
            QtCore.QObject.connect(self.text,QtCore.SIGNAL("textChanged()"), self.enable_save)        
            
            vbox_main = QtGui.QVBoxLayout(self.textwindow)
            vbox_main.addWidget(self.text)
            vbox_main.addWidget(self.save)
            self.save.clicked.connect(self.save_data)
            #self.connect(exit,QtCore.SIGNAL('close()'), self.onQuit)
            
            self.textwindow.show()
        else:
            self.obj_appconfig.current_project["ProjectName"]= str(self.filePath)
        
    def enable_save(self):
#.........这里部分代码省略.........
开发者ID:ambikeshwar1991,项目名称:eSim,代码行数:103,代码来源:ProjectExplorer.py

示例4: Workspace

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_info [as 别名]
class Workspace(QtGui.QWidget):
    """
    This class creates Workspace GUI.
    """
    def __init__(self,parent=None):
        super(Workspace, self).__init__()
        self.obj_appconfig = Appconfig()
        
        #Initializing Workspace directory for project
        self.initWorkspace()
        
            
    def initWorkspace(self):
        #print "Calling workspace"
        
        self.mainwindow = QtGui.QVBoxLayout()
        self.split = QtGui.QSplitter()
        self.split.setOrientation(QtCore.Qt.Vertical)
        
        self.grid = QtGui.QGridLayout()
        self.note = QtGui.QTextEdit(self)
        self.workspace_label = QtGui.QLabel(self)
        self.workspace_loc = QtGui.QLineEdit(self)
    
        self.note.append(self.obj_appconfig.workspace_text)
        self.workspace_label.setText("Workspace:")
        self.workspace_loc.setText(self.obj_appconfig.home)
        
        #Buttons
        self.browsebtn = QtGui.QPushButton('Browse')
        self.browsebtn.clicked.connect(self.browseLocation)
        self.okbtn = QtGui.QPushButton('OK')
        self.okbtn.clicked.connect(self.createWorkspace)
        self.cancelbtn = QtGui.QPushButton('Cancel')
        self.cancelbtn.clicked.connect(self.defaultWorkspace)
        #Layout
        self.grid.addWidget(self.note, 0,0,1,15)
        self.grid.addWidget(self.workspace_label, 2,1)
        self.grid.addWidget(self.workspace_loc,2,2,2,12)
        self.grid.addWidget(self.browsebtn, 2,14)
        self.grid.addWidget(self.okbtn, 4,13)
        self.grid.addWidget(self.cancelbtn, 4,14)
    
        self.setGeometry(QtCore.QRect(500,250,400,400))
        self.setMaximumSize(4000, 200)
        self.setWindowTitle("eSim")
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.note.setReadOnly(True)
        self.setWindowIcon(QtGui.QIcon('../../images/logo.png'))
        self.setLayout(self.grid)
        self.show()
        
           
    def defaultWorkspace(self):
        print "Default location selected"
        self.imp_var=1
        self.obj_appconfig.print_info('Default workspace selected : ' + self.obj_appconfig.default_workspace["workspace"]) 
        self.close()
        var_appView.show()
        time.sleep(1)
        var_appView.splash.close()
 


        
    def close(self, *args, **kwargs):
        self.window_open_close=1
        self.close_var=1
        #with var_cond:
         #   var_cond.notify()
        return QtGui.QWidget.close(self, *args, **kwargs)


    def returnWhetherClickedOrNot(self,appView):
        global var_appView
        var_appView=appView

        
               
    def createWorkspace(self):
        print "Create workspace is called"
        self.create_workspace = str(self.workspace_loc.text())
        self.obj_appconfig.print_info('Workspace : ' + self.create_workspace)
        #Checking if Workspace already exist or not       
        if  os.path.isdir(self.create_workspace):
            print "Already present"
            self.obj_appconfig.default_workspace["workspace"] = self.create_workspace
        
        else:
            os.mkdir(self.create_workspace)
            self.obj_appconfig.default_workspace["workspace"] = self.create_workspace
        self.imp_var=1
        self.close()  
        var_appView.show()
        time.sleep(1)
        var_appView.splash.close()
        
            
    def browseLocation(self):
        print "Browse Location called"
#.........这里部分代码省略.........
开发者ID:FOSSEE-Manipal,项目名称:eSim,代码行数:103,代码来源:Workspace.py

示例5: plotWindow

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_info [as 别名]
class plotWindow(QtGui.QMainWindow):
    def __init__(self,fpath,projectName):
        QtGui.QMainWindow.__init__(self)
        self.fpath = fpath#+".cir.out"
        self.projectName = projectName
        self.obj_appconfig = Appconfig()
        print "Path : ",self.fpath
        print "Project Name : ",self.projectName
        self.obj_appconfig.print_info('Ngspice simulation is called : ' + self.fpath)
        self.obj_appconfig.print_info('PythonPlotting is called : ' + self.fpath)
        self.combo = []
        self.combo1 = []
        self.combo1_rev = []
        #Creating Frame
        self.createMainFrame()        
        
    def createMainFrame(self):
        self.mainFrame = QtGui.QWidget()
        self.dpi = 100
        self.fig = Figure((7.0, 7.0), dpi=self.dpi)
        #Creating Canvas which will figure
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(self.mainFrame)
        self.axes = self.fig.add_subplot(111)
        self.navToolBar = NavigationToolbar(self.canvas, self.mainFrame)
        
        #LeftVbox hold navigation tool bar and canvas
        self.left_vbox = QtGui.QVBoxLayout()
        self.left_vbox.addWidget(self.navToolBar)
        self.left_vbox.addWidget(self.canvas)

        #right VBOX is main Layout which hold right grid(bottom part) and top grid(top part)
        self.right_vbox = QtGui.QVBoxLayout()
        self.right_grid = QtGui.QGridLayout()
        self.top_grid = QtGui.QGridLayout()
        
        #Get DataExtraction Details
        self.obj_dataext = DataExtraction()
        self.plotType = self.obj_dataext.openFile(self.fpath)
        
        self.obj_dataext.computeAxes()
        self.a = self.obj_dataext.numVals()
                        
        self.chkbox=[]
        
        ########### Generating list of colors :
        self.full_colors = ['r','b','g','y','c','m','k']#,(0.4,0.5,0.2),(0.1,0.4,0.9),(0.4,0.9,0.2),(0.9,0.4,0.9)]
        self.color = []
        for i in range(0,self.a[0]-1):
            if i%7 == 0:
                self.color.append(self.full_colors[0])
            elif (i-1)%7 == 0:
                self.color.append(self.full_colors[1])
            elif (i-2)%7 == 0:
                self.color.append(self.full_colors[2])
            elif (i-3)%7 == 0:
                self.color.append(self.full_colors[3])
            elif (i-4)%7 == 0:
                self.color.append(self.full_colors[4])
            elif (i-5)%7 == 0:
                self.color.append(self.full_colors[5])
            elif (i-6)%7 == 0:
                self.color.append(self.full_colors[6])

        ###########Color generation ends here
        
        
        #Total number of voltage source
        self.volts_length = self.a[1]
        self.analysisType = QtGui.QLabel()
        self.top_grid.addWidget(self.analysisType,0,0)
        self.listNode = QtGui.QLabel()
        self.top_grid.addWidget(self.listNode,1,0)
        self.listBranch = QtGui.QLabel()
        self.top_grid.addWidget(self.listBranch,self.a[1]+2,0)
        for i in range(0,self.a[1]):#a[0]-1
            self.chkbox.append(QtGui.QCheckBox(self.obj_dataext.NBList[i]))
            self.chkbox[i].setStyleSheet('color')
            self.chkbox[i].setToolTip('<b>Check To Plot</b>' )
            self.top_grid.addWidget(self.chkbox[i],i+2,0)
            self.colorLab = QtGui.QLabel()
            self.colorLab.setText('____')
            self.colorLab.setStyleSheet(self.colorName(self.color[i])+'; font-weight = bold;')
            self.top_grid.addWidget(self.colorLab,i+2,1)

        for i in range(self.a[1],self.a[0]-1):#a[0]-1
            self.chkbox.append(QtGui.QCheckBox(self.obj_dataext.NBList[i]))
            self.chkbox[i].setToolTip('<b>Check To Plot</b>' )
            self.top_grid.addWidget(self.chkbox[i],i+3,0)
            self.colorLab = QtGui.QLabel()
            self.colorLab.setText('____')
            self.colorLab.setStyleSheet(self.colorName(self.color[i])+'; font-weight = bold;')
            self.top_grid.addWidget(self.colorLab,i+3,1)
    
        self.clear = QtGui.QPushButton("Clear")
        self.warnning = QtGui.QLabel()
        self.funcName = QtGui.QLabel()
        self.funcExample = QtGui.QLabel()
    
        self.plotbtn = QtGui.QPushButton("Plot")
#.........这里部分代码省略.........
开发者ID:FOSSEE-Manipal,项目名称:eSim,代码行数:103,代码来源:pythonPlotting.py

示例6: Application

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

#.........这里部分代码省略.........
        elif reply == QtGui.QMessageBox.No:
            event.ignore()
    
     
    def close_project(self):
        print "Function : Close Project"
        current_project = self.obj_appconfig.current_project['ProjectName']
        if current_project==None:
            pass
        else:
            for pid in self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']]:
                try:
                    os.kill(pid, 9)
                except:
                    pass
            self.obj_Mainview.obj_dockarea.closeDock()
            self.obj_appconfig.current_project['ProjectName'] = None
            self.systemTrayIcon.showMessage('Close', 'Current project '+os.path.basename(current_project)+' is Closed.')
    
    def new_project(self):
        """
        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 new 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 function call Open Project Info class
        """
        print "Function : Open Project"
        self.project = OpenProjectInfo()
        
        try:
            directory, filelist = self.project.body()
            self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist)
        except:
            pass
    
               
    def wrkspc_change(self):
        """
        This function calls Change workspace dialog
        """
        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')
开发者ID:rowhit,项目名称:eSim,代码行数:70,代码来源:Application.py

示例7: NewProjectInfo

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_info [as 别名]
class NewProjectInfo(QtGui.QWidget):
    """
    This class is called when User create new Project.
    """
    
    def __init__(self):
        super(NewProjectInfo, self).__init__()
        self.obj_validation = Validation()
        self.obj_appconfig = Appconfig()

        
    def createProject(self,projName):
        """
        This function create Project related directories and files
        """
        #print "Create Project Called"
        self.projName= projName
        self.workspace = self.obj_appconfig.default_workspace['workspace']
        #self.projName = self.projEdit.text()
        self.projName = str(self.projName).rstrip().lstrip()  #Remove leading and trailing space
        
        self.projDir = os.path.join(self.workspace,str(self.projName))
        
               
        #Validation for newProject
        if self.projName == "":
            self.reply = "NONE"
        else:
            self.reply = self.obj_validation.validateNewproj(str(self.projDir))
        
        #Checking Validations Response
        if self.reply == "VALID":
            print "Validated : Creating project directory"
            #create project directory
            try:
                os.mkdir(self.projDir)
                self.close()
                self.projFile = os.path.join(self.projDir,self.projName+".proj")
                f = open(self.projFile,"w")
            except:
                #print "Some Thing Went Wrong"
                self.msg = QtGui.QErrorMessage(self)
                self.msg.showMessage('Unable to create project. Please make sure you have write permission on '+self.workspace)
                self.msg.setWindowTitle("Error Message")
            f.write("schematicFile " + self.projName+".sch\n")
            f.close()
            
            #Now Change the current working project
            newprojlist = []
            #self.obj_appconfig = Appconfig()
            self.obj_appconfig.current_project['ProjectName'] = self.projDir 
            newprojlist.append(self.projName+'.proj')
            self.obj_appconfig.project_explorer[self.projDir] = newprojlist
            
            self.obj_appconfig.print_info('New project created : ' + self.projName)
            self.obj_appconfig.print_info('Current project is : ' + self.projDir)
            
            json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
            return self.projDir, newprojlist
            
        elif self.reply == "CHECKEXIST":
            #print "Project already exist"
            self.msg = QtGui.QErrorMessage(self)
            self.msg.showMessage('The project "'+self.projName+'" already exist.Please select the different name or delete existing project')
            self.msg.setWindowTitle("Error Message")
            
            
        elif self.reply == "CHECKNAME":
            #print "Name is not proper"
            self.msg = QtGui.QErrorMessage(self)
            self.msg.showMessage('The project name should not contain space between them')
            self.msg.setWindowTitle("Error Message")
        
        elif self.reply == "NONE":
            #print "Empty Project Name"
            self.msg = QtGui.QErrorMessage(self)
            self.msg.showMessage('The project name cannot be empty')
            self.msg.setWindowTitle("Error Message")
        
    def cancelProject(self):
        self.close()
开发者ID:FOSSEE-Manipal,项目名称:eSim,代码行数:83,代码来源:newProject.py

示例8: Application

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

#.........这里部分代码省略.........
        self.model.triggered.connect(self.open_modelEditor) 
        
        self.subcircuit=QtGui.QAction(QtGui.QIcon('../../images/subckt.png'),'<b>Subcircuit</b>',self)
        self.subcircuit.triggered.connect(self.open_subcircuit)
        
        #Adding Action Widget to tool bar   
        self.lefttoolbar = QtGui.QToolBar('Left ToolBar')
        self.addToolBar(QtCore.Qt.LeftToolBarArea, self.lefttoolbar)
        self.lefttoolbar.addAction(self.kicad)
        self.lefttoolbar.addAction(self.conversion)
        self.lefttoolbar.addAction(self.ngspice)
        self.lefttoolbar.addAction(self.footprint)
        self.lefttoolbar.addAction(self.pcb)
        self.lefttoolbar.addAction(self.model)
        self.lefttoolbar.addAction(self.subcircuit)
        self.lefttoolbar.setOrientation(QtCore.Qt.Vertical)
        self.lefttoolbar.setIconSize(QSize(40,40))
     
     
    def new_project(self):
        """
        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:
开发者ID:FOSSEE-Manipal,项目名称:eSim,代码行数:70,代码来源:Application.py

示例9: __init__

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_info [as 别名]
class Kicad:
    """
    This class called the Kicad Schematic,KicadtoNgspice Converter,Layout editor and Footprint Editor
    """
    def __init__(self,dockarea):
        self.obj_validation = Validation.Validation()
        self.obj_appconfig = Appconfig()
        self.obj_dockarea= dockarea
    
    def openSchematic(self):
        """
        This function create command to open Kicad schematic
        """
        print "Function : Open Kicad Schematic"
        self.projDir = self.obj_appconfig.current_project["ProjectName"]
        try:
            self.obj_appconfig.print_info('Kicad Schematic 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 = "eeschema "+self.project+".sch "
            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")
        
        
    '''
    #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.
#.........这里部分代码省略.........
开发者ID:rowhit,项目名称:eSim,代码行数:103,代码来源:Kicad.py

示例10: OpenModelicaEditor

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_info [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

示例11: Workspace

# 需要导入模块: from configuration.Appconfig import Appconfig [as 别名]
# 或者: from configuration.Appconfig.Appconfig import print_info [as 别名]
class Workspace(QtGui.QWidget):
    """
    This class creates Workspace GUI.
    """
    def __init__(self,parent=None):
        super(Workspace, self).__init__()
        self.obj_appconfig = Appconfig()

        #Initializing Workspace directory for project
        self.initWorkspace()
        
            
    def initWorkspace(self):
        #print "Calling workspace"

        self.mainwindow = QtGui.QVBoxLayout()
        self.split = QtGui.QSplitter()
        self.split.setOrientation(QtCore.Qt.Vertical)
        
        self.grid = QtGui.QGridLayout()
        self.note = QtGui.QTextEdit(self)
        self.workspace_label = QtGui.QLabel(self)
        self.workspace_loc = QtGui.QLineEdit(self)
    
        self.note.append(self.obj_appconfig.workspace_text)
        self.workspace_label.setText("Workspace:")  
        self.workspace_loc.setText(self.obj_appconfig.home)

        #Buttons
        self.browsebtn = QtGui.QPushButton('Browse')
        self.browsebtn.clicked.connect(self.browseLocation)
        self.okbtn = QtGui.QPushButton('OK')
        self.okbtn.clicked.connect(self.createWorkspace)
        self.cancelbtn = QtGui.QPushButton('Cancel')
        self.cancelbtn.clicked.connect(self.defaultWorkspace)
        #checkbox
        self.chkbox = QtGui.QCheckBox('Set Default', self)
        self.chkbox.setCheckState( int(self.obj_appconfig.workspace_check) )
        #Layout
        self.grid.addWidget(self.note, 0,0,1,15)
        self.grid.addWidget(self.workspace_label, 2,1)
        self.grid.addWidget(self.workspace_loc,2,2,2,12)
        self.grid.addWidget(self.browsebtn, 2,14)
        self.grid.addWidget(self.chkbox, 4, 2)
        self.grid.addWidget(self.okbtn, 5, 13)
        self.grid.addWidget(self.cancelbtn, 5, 14)
        
        self.setGeometry(QtCore.QRect(500,250,400,400))
        self.setMaximumSize(4000, 200)
        self.setWindowTitle("eSim")
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.note.setReadOnly(True)
        self.setWindowIcon(QtGui.QIcon('res/images/logo.png'))
        self.setLayout(self.grid)

   
    def defaultWorkspace(self):
        print "Default workspace selected : "+self.obj_appconfig.default_workspace["workspace"]
        self.imp_var=1
        self.obj_appconfig.print_info('Default workspace selected : ' + self.obj_appconfig.default_workspace["workspace"]) 
        self.close()
        var_appView.show()
        time.sleep(1)
        var_appView.splash.close()
    



    def close(self, *args, **kwargs):
        self.window_open_close=1
        self.close_var=1
        return QtGui.QWidget.close(self, *args, **kwargs)


    def returnWhetherClickedOrNot(self,appView):
        global var_appView
        var_appView=appView


    def createWorkspace(self):
        print "Function : Create workspace"

        self.obj_appconfig.workspace_check = self.chkbox.checkState()
        print self.workspace_loc.text()
        file = open (os.path.join(os.path.expanduser("~"),".esim/workspace.txt"), 'w')
        
        file.writelines(str(self.obj_appconfig.workspace_check) + " " + self.workspace_loc.text())
        file.close()

        self.create_workspace = str(self.workspace_loc.text())
        self.obj_appconfig.print_info('Workspace : ' + self.create_workspace)
        #Checking if Workspace already exist or not       
        if  os.path.isdir(self.create_workspace):
            self.obj_appconfig.default_workspace["workspace"] = self.create_workspace
        else:
            os.mkdir(self.create_workspace)
            self.obj_appconfig.default_workspace["workspace"] = self.create_workspace
        self.imp_var=1
        self.close()  

#.........这里部分代码省略.........
开发者ID:rowhit,项目名称:eSim,代码行数:103,代码来源:Workspace.py


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