Skip to content

Commit

Permalink
Merge pull request #2 from bladen-martin/master
Browse files Browse the repository at this point in the history
launch ngspice via mintty
  • Loading branch information
rahulp13 authored Jul 18, 2020
2 parents 175208c + f7f9536 commit 4a7aade
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/ngspiceSimulation/NgspiceWidget.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from PyQt4 import QtGui, QtCore
from configuration.Appconfig import Appconfig
from configparser import SafeConfigParser
import platform
import os


# This Class creates NgSpice Window


class NgspiceWidget(QtGui.QWidget):

def __init__(self, command, projPath):
Expand All @@ -20,6 +22,17 @@ def __init__(self, command, projPath):
self.layout = QtGui.QVBoxLayout(self)
self.layout.addWidget(self.terminal)

if os.name == 'nt':
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':
Expand All @@ -40,6 +53,7 @@ def __init__(self, command, projPath):
tempdir = os.getcwd()
projPath = self.obj_appconfig.current_project["ProjectName"]
os.chdir(projPath)
self.command = "ngspice " + command
self.command = 'cmd /c '+'"start /min ' + \
msys_bin + "/mintty.exe ngspice " + command + '"'
self.process.start(self.command)
os.chdir(tempdir)

0 comments on commit 4a7aade

Please sign in to comment.