diff options
Diffstat (limited to 'src/frontEnd')
-rw-r--r-- | src/frontEnd/Application.py | 28 | ||||
-rwxr-xr-x | src/frontEnd/DockArea.py | 4 | ||||
-rw-r--r-- | src/frontEnd/TerminalUi.py | 18 |
3 files changed, 46 insertions, 4 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 5d76bf9d..ea286651 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -58,6 +58,9 @@ class Application(QtWidgets.QMainWindow): # Set slot for simulation end signal to plot simulation data self.simulationEndSignal.connect(self.plotSimulationData) + #the plotFlag + self.plotFlag = False + # Creating require Object self.obj_workspace = Workspace.Workspace() self.obj_Mainview = MainView() @@ -188,7 +191,7 @@ class Application(QtWidgets.QMainWindow): QtGui.QIcon(init_path + 'images/ngspice.png'), '<b>Simulate</b>', self ) - self.ngspice.triggered.connect(self.open_ngspice) + self.ngspice.triggered.connect(self.plotFlagPopBox) self.model = QtWidgets.QAction( QtGui.QIcon(init_path + 'images/model.png'), @@ -247,6 +250,27 @@ class Application(QtWidgets.QMainWindow): self.lefttoolbar.setOrientation(QtCore.Qt.Vertical) self.lefttoolbar.setIconSize(QSize(40, 40)) + def plotFlagPopBox(self): + """This function displays a pop-up box with message- Do you want Ngspice plots? and oprions Yes and NO. + + If the user clicks on Yes, both the NgSpice and python plots are displayed and if No is clicked then only the python plots.""" + + msg_box = QtWidgets.QMessageBox(self) + msg_box.setWindowTitle("Ngspice Plots") + msg_box.setText("Do you want Ngspice plots?") + + yes_button = msg_box.addButton("Yes", QtWidgets.QMessageBox.YesRole) + no_button = msg_box.addButton("No", QtWidgets.QMessageBox.NoRole) + + msg_box.exec_() + + if msg_box.clickedButton() == yes_button: + self.plotFlag = True + else: + self.plotFlag = False + + self.open_ngspice() + def closeEvent(self, event): ''' This function closes the ongoing program (process). @@ -438,7 +462,7 @@ class Application(QtWidgets.QMainWindow): return self.obj_Mainview.obj_dockarea.ngspiceEditor( - projName, ngspiceNetlist, self.simulationEndSignal) + projName, ngspiceNetlist, self.simulationEndSignal, self.plotFlag) self.ngspice.setEnabled(False) self.conversion.setEnabled(False) diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py index 01e0d715..d73e556b 100755 --- a/src/frontEnd/DockArea.py +++ b/src/frontEnd/DockArea.py @@ -127,14 +127,14 @@ class DockArea(QtWidgets.QMainWindow): ) count = count + 1 - def ngspiceEditor(self, projName, netlist, simEndSignal): + def ngspiceEditor(self, projName, netlist, simEndSignal, plotFlag): """ This function creates widget for Ngspice window.""" global count self.ngspiceWidget = QtWidgets.QWidget() self.ngspiceLayout = QtWidgets.QVBoxLayout() self.ngspiceLayout.addWidget( - NgspiceWidget(netlist, simEndSignal) + NgspiceWidget(netlist, simEndSignal, plotFlag) ) # Adding to main Layout diff --git a/src/frontEnd/TerminalUi.py b/src/frontEnd/TerminalUi.py index 4c53548f..f838ae07 100644 --- a/src/frontEnd/TerminalUi.py +++ b/src/frontEnd/TerminalUi.py @@ -94,6 +94,7 @@ class TerminalUi(QtWidgets.QMainWindow): def redoSimulation(self): """This function reruns the ngspice simulation """ + self.Flag = "Flase" self.cancelSimulationButton.setEnabled(True) self.redoSimulationButton.setEnabled(False) @@ -107,6 +108,23 @@ class TerminalUi(QtWidgets.QMainWindow): self.simulationConsole.setText("") self.simulationCancelled = False + msg_box = QtWidgets.QMessageBox(self) + msg_box.setWindowTitle("Ngspice Plots") + msg_box.setText("Do you want Ngspice plots?") + + yes_button = msg_box.addButton("Yes", QtWidgets.QMessageBox.YesRole) + no_button = msg_box.addButton("No", QtWidgets.QMessageBox.NoRole) + + msg_box.exec_() + + if msg_box.clickedButton() == yes_button: + self.Flag = True + else: + self.Flag = False + + # Emit a custom signal with name plotFlag2 depending upon the Flag + self.qProcess.setProperty("plotFlag2", self.Flag) + self.qProcess.start('ngspice', self.args) def changeColor(self): |