Skip to content
This repository was archived by the owner on Aug 28, 2020. It is now read-only.

Commit 40865be

Browse files
committed
draw a rect in the statusbar with the status colour
1 parent 822a333 commit 40865be

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pugdebug/gui/statusbar.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
__author__ = "robertbasic"
1111

12+
from PyQt5.QtGui import QPainter, QColor, QPixmap
1213
from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout
1314

1415

@@ -17,20 +18,33 @@ class PugdebugStatusBar(QWidget):
1718
def __init__(self):
1819
super(PugdebugStatusBar, self).__init__()
1920
self.label = QLabel(self)
21+
self.light = QLabel(self)
2022

2123
layout = QHBoxLayout()
24+
layout.addWidget(self.light)
2225
layout.addWidget(self.label)
2326

2427
self.setLayout(layout)
2528

2629
def set_debugging_status(self, status):
2730
if status == 0:
2831
text = "Idle ..."
32+
color = "gray"
2933
elif status == 1:
3034
text = 'Waiting for connection ...'
35+
color = "orange"
3136
elif status == 2:
3237
text = 'Debugging stopped ...'
38+
color = "red"
3339
elif status == 3:
3440
text = 'Debugging in progress ...'
41+
color = "green"
3542

3643
self.label.setText(text)
44+
45+
self.pixmap = QPixmap(10, 10)
46+
color = QColor(color)
47+
self.pixmap.fill(color)
48+
painter = QPainter(self.pixmap)
49+
painter.drawRect(0, 0, 10, 10)
50+
self.light.setPixmap(self.pixmap)

0 commit comments

Comments
 (0)