Package mcbase :: Package widgets :: Module mctextedit
[hide private]
[frames] | no frames]

Source Code for Module mcbase.widgets.mctextedit

 1  # -*- coding: utf-8 -*- 
 2   
 3  ############################################################################ 
 4  # mctextedit.py 
 5  # 
 6  # MOCOP line edit widget 
 7  # 
 8  # (C) 2008 Likya Software Ltd. 
 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 # We do not want tabs to be accepted as tabs, we want them 28 # to change focus 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
48 - def get(self):
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