diff options
author | rahulp13 | 2020-08-03 12:03:41 +0530 |
---|---|---|
committer | rahulp13 | 2020-08-03 12:03:41 +0530 |
commit | 2eb6697de529a643127599070771a0278e9817b3 (patch) | |
tree | a024da46ce7e9712291ba6f7b3572ba37479c01a /src/ngspiceSimulation/NgspiceWidget.py | |
parent | d7e14cecfe0abdd9aeea5e589ddaeb5c302f5877 (diff) | |
download | eSim-2eb6697de529a643127599070771a0278e9817b3.tar.gz eSim-2eb6697de529a643127599070771a0278e9817b3.tar.bz2 eSim-2eb6697de529a643127599070771a0278e9817b3.zip |
ported GUI to PyQt5
Diffstat (limited to 'src/ngspiceSimulation/NgspiceWidget.py')
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index 136510e1..32991884 100644 --- a/src/ngspiceSimulation/NgspiceWidget.py +++ b/src/ngspiceSimulation/NgspiceWidget.py @@ -1,41 +1,45 @@ -from PyQt4 import QtGui, QtCore +from PyQt5 import QtWidgets, QtCore from configuration.Appconfig import Appconfig from configparser import SafeConfigParser -import platform import os -# This Class creates NgSpice Window - -class NgspiceWidget(QtGui.QWidget): +# This Class creates NgSpice Window +class NgspiceWidget(QtWidgets.QWidget): def __init__(self, command, projPath): """ - Creates constructor for NgspiceWidget class. - - Checks whether OS is linux or windows - and creates NgSpice window accordingly. + - Checks whether OS is Linux or Windows and + creates Ngspice window accordingly. """ - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self.obj_appconfig = Appconfig() self.process = QtCore.QProcess(self) - self.terminal = QtGui.QWidget(self) - self.layout = QtGui.QVBoxLayout(self) + self.terminal = QtWidgets.QWidget(self) + self.layout = QtWidgets.QVBoxLayout(self) self.layout.addWidget(self.terminal) - if os.name == 'nt': + print("Argument to ngspice command : ", command) + + if os.name == 'nt': # For Windows OS home = os.path.expanduser("~") parser_nghdl = SafeConfigParser() parser_nghdl.read(os.path.join( home, os.path.join('.nghdl', 'config.ini'))) - try: - msys_bin = parser_nghdl.get('COMPILER', 'MSYS_HOME') - except BaseException: - pass - print("Argument to ngspice command : ", command) - # For Linux OS - if platform.system() == 'Linux': + msys_bin = parser_nghdl.get('COMPILER', 'MSYS_HOME') + + tempdir = os.getcwd() + projPath = self.obj_appconfig.current_project["ProjectName"] + os.chdir(projPath) + self.command = 'cmd /c '+'"start /min ' + \ + msys_bin + "/mintty.exe ngspice " + command + '"' + self.process.start(self.command) + os.chdir(tempdir) + + else: # For Linux OS self.command = "cd " + projPath + ";ngspice " + command # Creating argument for process self.args = ['-hold', '-e', self.command] @@ -47,13 +51,3 @@ class NgspiceWidget(QtGui.QWidget): [self.obj_appconfig.current_project['ProjectName']].append( self.process.pid()) ) - - # For Windows OS - elif platform.system() == 'Windows': - tempdir = os.getcwd() - projPath = self.obj_appconfig.current_project["ProjectName"] - os.chdir(projPath) - self.command = 'cmd /c '+'"start /min ' + \ - msys_bin + "/mintty.exe ngspice " + command + '"' - self.process.start(self.command) - os.chdir(tempdir) |