-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsignals_window.py
executable file
·65 lines (50 loc) · 1.9 KB
/
signals_window.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
import sys
from PyQt4 import QtGui
from PyQt4.QtCore import Qt
from PyQt4.QtCore import pyqtSlot
class SignalsWindow(QtGui.QWidget, object):
def __init__(self, parent=None):
super(SignalsWindow, self).__init__(parent)
self.resize(600, 800)
# plain text edit
self.output_text = QtGui.QPlainTextEdit()
self.output_text.setReadOnly(True) # read-only
self.output_text.setStyleSheet('QPlainTextEdit { background-color: #0a0c00; color: white; }')
# instructions label
self.instructions_label = QtGui.QLabel()
self.instructions_label.setTextFormat(Qt.PlainText)
self.instructions_label.setWordWrap(True)
self.instructions_label.setEnabled(False)
# icons
clean_icon = QtGui.QIcon(os.path.join('images', 'clean_icon.png'))
# clean button
clean_button = QtGui.QToolButton()
clean_button.setIcon(clean_icon)
# clean_button.setToolTip('Clean all')
# clean_button.clicked.connect(self.clean_button_clicked) # clicked signal
# horizontal box layout
hlayout = QtGui.QHBoxLayout()
hlayout.addStretch()
# hlayout.addWidget(clean_button)
# vertical box layout
self.vlayout = QtGui.QVBoxLayout()
self.vlayout.setDirection(QtGui.QBoxLayout.BottomToTop)
self.vlayout.addLayout(hlayout)
self.vlayout.addWidget(self.output_text)
self.setLayout(self.vlayout)
def scroll_to_end(self):
self.output_text.moveCursor(QtGui.QTextCursor.End)
# *** SLOTS ***
# clicked slot
@pyqtSlot()
def clean_button_clicked(self):
self.output_text.clear()
#if __name__ == '__main__':
# application = QtGui.QApplication(sys.argv)
# window
# window = SignalsWindow()
# window.setWindowTitle('Signals window')
# window.resize(320, 800)
# window.show()
# sys.exit(application.exec_())