summaryrefslogtreecommitdiff
path: root/src/ngspiceSimulation/NgspiceWidget.py
blob: 2dcb4f89d93cd0656d2f1bdd7db4c48664871e6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from PyQt4 import QtGui,QtCore
from configuration.Appconfig import Appconfig
import platform
import os

class NgspiceWidget(QtGui.QWidget):
    """
    This Class creates NgSpice Window
    """
    def __init__(self,command,projPath):
        QtGui.QWidget.__init__(self)
        self.obj_appconfig = Appconfig()
        self.process = QtCore.QProcess(self)
        self.terminal = QtGui.QWidget(self)
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.terminal)
        print"command-------->", command
        if platform.system() == 'Linux':
            self.command = "cd "+projPath+";ngspice "+command
            #Creating argument for process
            self.args = ['-geometry','200x200','-into', str(self.terminal.winId()),'-hold','-e', self.command]
            self.process.start('xterm', self.args)
                     
        elif platform.system() == 'Windows':
            tempdir= os.getcwd()
            projPath = self.obj_appconfig.current_project["ProjectName"]
            os.chdir(projPath)
            self.command = "ngspice "+command
            self.process.start(self.command)
            os.chdir(tempdir)