1
2
3
4
5
6
7
8
9
10
11 from PyQt4.Qt import *
12
13 from mc import MC
14 from mcwidget import MCWidget
15
16
17 -class MCTextEdit(QTextEdit, MCWidget):
18 '''
19 Line edit widget, which is used in MC views
20 '''
21 - def __init__(self, parent=None):
22 '''
23 Initializes the line edit from MCTextEdit.
24 '''
25 QTextEdit.__init__(self, parent)
26 MCWidget.__init__(self)
27
28
29 self.setTabChangesFocus(True)
30
31 self.setStyleSheet('''
32 QTextEdit:focus{
33 background-color: #ffde56;
34 selection-background-color: #ffaa00;
35 selection-color: #001b2c;
36 }
37 ''')
38
39 - def set(self, text):
40 '''
41 Common set method for MCTextEdit
42
43 @param text: Line text
44 @type text: str, unicode, QString
45 '''
46 self.setText(text)
47
49 '''
50 Returns current line edit text in unicode.
51
52 @return: Current text
53 @rtype: C{string}
54 '''
55 return unicode(self.toPlainText())
56