summaryrefslogtreecommitdiff
path: root/src/progressBar/progressBar.py
diff options
context:
space:
mode:
authorPranav P2023-05-15 19:53:05 +0530
committerPranav P2023-05-15 19:53:05 +0530
commit5ade06b5d3559b1d01dafdfabcb71f169bfd633c (patch)
tree3b88b86a6684eac2b9bfa2138be8c3f056e59700 /src/progressBar/progressBar.py
parent9c0b9b9d9caa18f552fb764bea1dc685e17807ee (diff)
downloadeSim-5ade06b5d3559b1d01dafdfabcb71f169bfd633c.tar.gz
eSim-5ade06b5d3559b1d01dafdfabcb71f169bfd633c.tar.bz2
eSim-5ade06b5d3559b1d01dafdfabcb71f169bfd633c.zip
Changed simulation status colour and dark mode icon path
Diffstat (limited to 'src/progressBar/progressBar.py')
-rw-r--r--src/progressBar/progressBar.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/progressBar/progressBar.py b/src/progressBar/progressBar.py
index f0aa964f..24edb865 100644
--- a/src/progressBar/progressBar.py
+++ b/src/progressBar/progressBar.py
@@ -9,6 +9,7 @@
from PyQt5 import QtCore, QtGui, QtWidgets
+import os
class Ui_Form(object):
@@ -17,6 +18,7 @@ class Ui_Form(object):
self.qTimer = simulationEssentials['timer']
self.enableButtons = simulationEssentials['enableButtons']
self.isSimulationSuccess = simulationEssentials['isSimulationSuccess']
+ self.iconDir = "../progressBar/icons"
# super().__init__()
def setupUi(self, Form):
Form.setObjectName("Form")
@@ -93,7 +95,7 @@ class Ui_Form(object):
self.simulationConsole.setText("")
self.dark_color = True
- self.light_dark_mode_button.setIcon(QtGui.QIcon("icons/light_mode.png"))
+ self.light_dark_mode_button.setIcon(QtGui.QIcon(os.path.join(self.iconDir, 'light_mode.png')))
self.light_dark_mode_button.clicked.connect(self.changeColor)
self.cancel_simulation_button.clicked.connect(self.cancelSimulation)
@@ -102,22 +104,31 @@ class Ui_Form(object):
self.simulationConsole.insertPlainText(consoleLog)
def writeSimulationStatusToConsole(self, isSuccess):
- failedFormat = '<span style="color:red;">{}</span>'
- successFormat = '<span style="color:green;">{}</span>'
+ failedFormat = '<span style="color:#ff3333;">{}</span>'
+ successFormat = '<span style="color:#00ff00;">{}</span>'
if isSuccess:
self.simulationConsole.append(successFormat.format("Simulation Completed Successfully!"))
else:
self.simulationConsole.append(failedFormat.format("Simulation Failed!"))
+
+ def scrollConsoleToBottom(self):
+ scrollLength = self.simulationConsole.verticalScrollBar().maximum()
+ self.simulationConsole.verticalScrollBar().setValue(scrollLength)
def showProgressCompleted(self):
self.progressBar.setMaximum(100)
self.progressBar.setProperty("value", 100)
def cancelSimulation(self):
+ if not self.qTimer.isActive():
+ return
+ cancelFormat = '<span style="color:#3385ff;">{}</span>'
self.qTimer.stop()
self.qProcess.kill()
self.showProgressCompleted()
+ self.simulationConsole.append(cancelFormat.format("Simulation Cancelled!"))
+ self.scrollConsoleToBottom()
def changeColor(self):
if self.dark_color is True:
@@ -125,14 +136,14 @@ class Ui_Form(object):
" background-color: white;\n"
" color: black;\n"
"}")
- self.light_dark_mode_button.setIcon(QtGui.QIcon("icons/dark_mode.png"))
+ self.light_dark_mode_button.setIcon(QtGui.QIcon(os.path.join(self.iconDir, "dark_mode.png")))
self.dark_color = False
else:
self.simulationConsole.setStyleSheet("QTextEdit {\n"
" background-color: rgb(36, 31, 49);\n"
" color: white;\n"
"}")
- self.light_dark_mode_button.setIcon(QtGui.QIcon("icons/light_mode.png"))
+ self.light_dark_mode_button.setIcon(QtGui.QIcon(os.path.join(self.iconDir, "light_mode.png")))
self.dark_color = True
if __name__ == "__main__":