class ContactItem(QtGui.QWidget): """ Contact in friends list """ def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setBaseSize(QtCore.QSize(250, 70)) self.avatar_label = QtGui.QLabel(self) self.avatar_label.setGeometry(QtCore.QRect(3, 3, 64, 64)) self.avatar_label.setScaledContents(True) self.name = DataLabel(self) self.name.setGeometry(QtCore.QRect(70, 10, 160, 25)) font = QtGui.QFont() font.setFamily("Times New Roman") font.setPointSize(12) font.setBold(True) self.name.setFont(font) self.name.setObjectName("name") self.status_message = DataLabel(self) self.status_message.setGeometry(QtCore.QRect(70, 30, 180, 20)) font.setPointSize(10) font.setBold(False) self.status_message.setFont(font) self.status_message.setObjectName("status_message") self.connection_status = StatusCircle(self) self.connection_status.setGeometry(QtCore.QRect(220, 5, 32, 32)) self.connection_status.setObjectName("connection_status")
class ContactItem(QtGui.QWidget): """ Contact in friends list """ def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setBaseSize(QtCore.QSize(250, 70)) self.avatar_label = QtGui.QLabel(self) self.avatar_label.setGeometry(QtCore.QRect(3, 3, 64, 64)) self.avatar_label.setScaledContents(True) self.name = DataLabel(self) self.name.setGeometry(QtCore.QRect(70, 10, 160, 25)) font = QtGui.QFont() font.setFamily("Times New Roman") font.setPointSize(12) font.setBold(True) self.name.setFont(font) self.name.setObjectName("name") self.status_message = DataLabel(self) self.status_message.setGeometry(QtCore.QRect(70, 30, 180, 20)) font.setPointSize(10) font.setBold(False) self.status_message.setFont(font) self.status_message.setObjectName("status_message") self.connection_status = StatusCircle(self) self.connection_status.setGeometry(QtCore.QRect(220, 5, 32, 32)) self.connection_status.setObjectName("connection_status")
class MessageItem(QtGui.QWidget): """ Message in messages list """ def __init__(self, text, time, user='', message_type=TOX_MESSAGE_TYPE['NORMAL'], parent=None): QtGui.QWidget.__init__(self, parent) self.name = DataLabel(self) self.name.setGeometry(QtCore.QRect(0, 2, 95, 20)) self.name.setTextFormat(QtCore.Qt.PlainText) font = QtGui.QFont() font.setFamily("Times New Roman") font.setPointSize(11) font.setBold(True) self.name.setFont(font) self.name.setObjectName("name") self.name.setText(user) self.time = QtGui.QLabel(self) self.time.setGeometry(QtCore.QRect(parent.width() - 50, 0, 50, 25)) font = QtGui.QFont() font.setFamily("Times New Roman") font.setPointSize(10) font.setBold(False) self.time.setFont(font) self.time.setObjectName("time") self.time.setText(time) self.message = MessageEdit(text, parent.width() - 150, self) self.message.setGeometry( QtCore.QRect(100, 0, parent.width() - 150, self.message.height())) self.setFixedHeight(self.message.height()) if message_type == TOX_MESSAGE_TYPE['ACTION']: self.name.setStyleSheet("QLabel { color: #4169E1; }") self.message.setStyleSheet("QTextEdit { color: #4169E1; }") else: if text[0] == '>': self.message.setStyleSheet("QTextEdit { color: green; }") if text[-1] == '<': self.message.setStyleSheet("QTextEdit { color: red; }")
class MessageItem(QtGui.QWidget): """ Message in messages list """ def __init__(self, text, time, user='', message_type=TOX_MESSAGE_TYPE['NORMAL'], parent=None): QtGui.QWidget.__init__(self, parent) self.name = DataLabel(self) self.name.setGeometry(QtCore.QRect(0, 2, 95, 20)) self.name.setTextFormat(QtCore.Qt.PlainText) font = QtGui.QFont() font.setFamily("Times New Roman") font.setPointSize(11) font.setBold(True) self.name.setFont(font) self.name.setObjectName("name") self.name.setText(user) self.time = QtGui.QLabel(self) self.time.setGeometry(QtCore.QRect(parent.width() - 50, 0, 50, 25)) font = QtGui.QFont() font.setFamily("Times New Roman") font.setPointSize(10) font.setBold(False) self.time.setFont(font) self.time.setObjectName("time") self.time.setText(time) self.message = MessageEdit(text, parent.width() - 150, self) self.message.setGeometry(QtCore.QRect(100, 0, parent.width() - 150, self.message.height())) self.setFixedHeight(self.message.height()) if message_type == TOX_MESSAGE_TYPE['ACTION']: self.name.setStyleSheet("QLabel { color: #4169E1; }") self.message.setStyleSheet("QTextEdit { color: #4169E1; }") else: if text[0] == '>': self.message.setStyleSheet("QTextEdit { color: green; }") if text[-1] == '<': self.message.setStyleSheet("QTextEdit { color: red; }")