diff options
-rw-r--r-- | src/frontEnd/Application.py | 4 | ||||
-rw-r--r-- | src/frontEnd/TerminalUi.py (renamed from src/progressBar/progressBar.py) | 38 | ||||
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py | 20 |
3 files changed, 26 insertions, 36 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 2eabcb12..e768d6b8 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -599,7 +599,7 @@ class Application(QtWidgets.QMainWindow): self.isFileChanged = False self.simulationCompleted = False - self.simulationEssentials = { + simulationEssentials = { "enableButtons": self.enableButtons, "checkChangeInPlotFile": self.checkChangeInPlotFile, } @@ -609,7 +609,7 @@ class Application(QtWidgets.QMainWindow): # Edited by Sumanto Kar 25/08/2021 if self.obj_Mainview.obj_dockarea.ngspiceEditor( - self.projDir, self.simulationEssentials) is False: + self.projDir, simulationEssentials) is False: print( "Netlist file (*.cir.out) not found." ) diff --git a/src/progressBar/progressBar.py b/src/frontEnd/TerminalUi.py index f3b1695d..b5f7a836 100644 --- a/src/progressBar/progressBar.py +++ b/src/frontEnd/TerminalUi.py @@ -1,13 +1,3 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'progressBar.ui' -# -# Created by: PyQt5 UI code generator 5.15.6 -# -# WARNING: Any manual changes made to this file will be lost when pyuic5 is -# run again. Do not edit this file unless you know what you are doing. - - from PyQt5 import QtCore, QtGui, QtWidgets import os @@ -31,21 +21,21 @@ class Ui_Form(object): self.horizontalLayout.setContentsMargins(-1, -1, -1, 0) self.horizontalLayout.setSpacing(6) self.horizontalLayout.setObjectName("horizontalLayout") - self.progressBar = QtWidgets.QProgressBar(self.verticalLayoutWidget) + self.terminalUi = QtWidgets.QProgressBar(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.progressBar.sizePolicy().hasHeightForWidth()) - self.progressBar.setSizePolicy(sizePolicy) - self.progressBar.setMaximumSize(QtCore.QSize(16777215, 35)) - self.progressBar.setStyleSheet("QProgressBar::chunk {\n" + sizePolicy.setHeightForWidth(self.terminalUi.sizePolicy().hasHeightForWidth()) + self.terminalUi.setSizePolicy(sizePolicy) + self.terminalUi.setMaximumSize(QtCore.QSize(16777215, 35)) + self.terminalUi.setStyleSheet("QProgressBar::chunk {\n" " background-color: rgb(54,158,225);\n" "}") - self.progressBar.setMaximum(0) - self.progressBar.setProperty("value", -1) - self.progressBar.setFormat("") - self.progressBar.setObjectName("progressBar") - self.horizontalLayout.addWidget(self.progressBar) + self.terminalUi.setMaximum(0) + self.terminalUi.setProperty("value", -1) + self.terminalUi.setFormat("") + self.terminalUi.setObjectName("progressBar") + self.horizontalLayout.addWidget(self.terminalUi) self.redo_simulation_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.redo_simulation_button.setMaximumSize(QtCore.QSize(16777215, 35)) self.redo_simulation_button.setObjectName("redo_simulation_button") @@ -121,12 +111,12 @@ class Ui_Form(object): self.simulationConsole.verticalScrollBar().setValue(scrollLength) def showProgressRunning(self): - self.progressBar.setMaximum(0) - self.progressBar.setProperty("value", -1) + self.terminalUi.setMaximum(0) + self.terminalUi.setProperty("value", -1) def showProgressCompleted(self): - self.progressBar.setMaximum(100) - self.progressBar.setProperty("value", 100) + self.terminalUi.setMaximum(100) + self.terminalUi.setProperty("value", 100) def cancelSimulation(self): if (self.qProcess.state() == QtCore.QProcess.NotRunning): diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index 928956d5..1e6aca6f 100644 --- a/src/ngspiceSimulation/NgspiceWidget.py +++ b/src/ngspiceSimulation/NgspiceWidget.py @@ -1,7 +1,7 @@ from PyQt5 import QtWidgets, QtCore from configuration.Appconfig import Appconfig from configparser import ConfigParser -from progressBar import progressBar +from frontEnd import TerminalUi import os import time @@ -22,8 +22,8 @@ class NgspiceWidget(QtWidgets.QWidget): self.projDir = self.obj_appconfig.current_project["ProjectName"] self.checkChangeInPlotFile = simulationEssentials['checkChangeInPlotFile'] self.enableButtons = simulationEssentials['enableButtons'] - self.progressBarUi = progressBar.Ui_Form(self.process) - self.progressBarUi.setupUi(self.terminal) + self.terminalUi = TerminalUi.Ui_Form(self.process) + self.terminalUi.setupUi(self.terminal) self.layout = QtWidgets.QVBoxLayout(self) self.layout.addWidget(self.terminal) self.errorFlag = False @@ -51,7 +51,7 @@ class NgspiceWidget(QtWidgets.QWidget): self.currTime = time.time() self.args = ['-b', '-r', command.replace(".cir.out", ".raw"), command] self.process.setWorkingDirectory(self.projDir) - self.progressBarUi.setNgspiceArgs(self.args) + self.terminalUi.setNgspiceArgs(self.args) self.process.start('ngspice', self.args) self.process.started.connect(lambda: self.enableButtons(state=False)) self.process.readyReadStandardOutput.connect(lambda: self.readyReadAll()) @@ -72,7 +72,7 @@ class NgspiceWidget(QtWidgets.QWidget): self.checkChangeInPlotFile(self.currTime, exitStatus) self.readyToPrintSimulationStatus = True - self.progressBarUi.showProgressCompleted() + self.terminalUi.showProgressCompleted() self.writeSimulationStatus() @@ -85,19 +85,19 @@ class NgspiceWidget(QtWidgets.QWidget): st = os.stat(os.path.join(self.projDir, "plot_data_i.txt")) if st.st_mtime >= self.currTime: - self.progressBarUi.writeSimulationStatusToConsole(isSuccess=True) + self.terminalUi.writeSimulationStatusToConsole(isSuccess=True) else: - self.progressBarUi.writeSimulationStatusToConsole(isSuccess=False) + self.terminalUi.writeSimulationStatusToConsole(isSuccess=False) - self.progressBarUi.scrollConsoleToBottom() + self.terminalUi.scrollConsoleToBottom() self.readyToPrintSimulationStatus = False @QtCore.pyqtSlot() def readyReadAll(self): - self.progressBarUi.writeIntoConsole( + self.terminalUi.writeIntoConsole( str(self.process.readAllStandardOutput().data(), encoding='utf-8') ) stderror = self.process.readAllStandardError() if stderror.toUpper().contains(b"ERROR"): self.errorFlag = True - self.progressBarUi.writeIntoConsole(str(stderror.data(), encoding='utf-8'))
\ No newline at end of file + self.terminalUi.writeIntoConsole(str(stderror.data(), encoding='utf-8'))
\ No newline at end of file |