diff --git a/src/list_items.py b/src/list_items.py
index c2210f4..34bbdb1 100644
--- a/src/list_items.py
+++ b/src/list_items.py
@@ -25,6 +25,7 @@ class MessageEdit(QtGui.QTextBrowser):
self.setAcceptRichText(True)
self.setOpenLinks(False)
self.setSearchPaths([smileys.SmileyLoader.get_instance().get_smileys_path()])
+ self.document().setDefaultStyleSheet('a { color: #306EFF; }')
self.setDecoratedText(text)
font = QtGui.QFont()
font.setFamily("Times New Roman")
@@ -87,7 +88,7 @@ class MessageEdit(QtGui.QTextBrowser):
arr = text.split('\n')
for i in range(len(arr)): # quotes
if arr[i].startswith('>'):
- arr[i] = '' + arr[i][4:] + ''
+ arr[i] = '' + arr[i][4:] + ''
text = '
'.join(arr)
text = smileys.SmileyLoader.get_instance().add_smileys_to_text(text, self) # smileys
self.setHtml(text)
@@ -125,17 +126,17 @@ class MessageItem(QtGui.QWidget):
self.setFixedHeight(self.message.height())
if message_type != TOX_MESSAGE_TYPE['NORMAL']:
- self.name.setStyleSheet("QLabel { color: #4169E1; }")
- self.name.setAlignment(QtCore.Qt.AlignCenter)
- self.message.setStyleSheet("QTextEdit { color: #4169E1; }")
+ self.name.setStyleSheet("QLabel { color: #5CB3FF; }")
+ self.message.setStyleSheet("QTextEdit { color: #5CB3FF; font: italic; font-size: 20px; }")
self.message.setAlignment(QtCore.Qt.AlignCenter)
- self.time.setStyleSheet("QLabel { color: #4169E1; }")
+ self.time.setStyleSheet("QLabel { color: #5CB3FF; }")
class ContactItem(QtGui.QWidget):
"""
Contact in friends list
"""
+
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setBaseSize(QtCore.QSize(250, 70))
@@ -143,7 +144,7 @@ class ContactItem(QtGui.QWidget):
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))
+ self.name.setGeometry(QtCore.QRect(75, 10, 160, 25))
font = QtGui.QFont()
font.setFamily("Times New Roman")
font.setPointSize(12)
@@ -151,7 +152,7 @@ class ContactItem(QtGui.QWidget):
self.name.setFont(font)
self.name.setObjectName("name")
self.status_message = DataLabel(self)
- self.status_message.setGeometry(QtCore.QRect(70, 30, 180, 20))
+ self.status_message.setGeometry(QtCore.QRect(75, 30, 180, 20))
font.setPointSize(10)
font.setBold(False)
self.status_message.setFont(font)
@@ -165,6 +166,7 @@ class StatusCircle(QtGui.QWidget):
"""
Connection status
"""
+ # TODO: rewrite
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(0, 0, 32, 32)
diff --git a/src/mainscreen_widgets.py b/src/mainscreen_widgets.py
index a590487..915de5e 100644
--- a/src/mainscreen_widgets.py
+++ b/src/mainscreen_widgets.py
@@ -9,7 +9,7 @@ import util
class MessageArea(QtGui.QPlainTextEdit):
- """User enters messages here"""
+ """User types messages here"""
def __init__(self, parent, form):
super(MessageArea, self).__init__(parent)
@@ -122,6 +122,9 @@ class ScreenShotWindow(QtGui.QWidget):
class SmileyWindow(QtGui.QWidget):
+ """
+ Smiley selection window
+ """
def __init__(self, parent):
super(SmileyWindow, self).__init__()
@@ -129,7 +132,7 @@ class SmileyWindow(QtGui.QWidget):
inst = smileys.SmileyLoader.get_instance()
self.data = inst.get_smileys()
count = len(self.data)
- self.page_size = int(pow(count / 8, 0.5) + 1) * 8
+ self.page_size = int(pow(count / 8, 0.5) + 1) * 8 # smileys per page
if count % self.page_size == 0:
self.page_count = count / self.page_size
else:
@@ -137,7 +140,7 @@ class SmileyWindow(QtGui.QWidget):
self.page = 0
self.radio = []
self.parent = parent
- for i in range(self.page_count):
+ for i in range(self.page_count): # buttons with smileys
elem = QtGui.QRadioButton(self)
elem.setGeometry(QtCore.QRect(i * 20 + 5, 180, 20, 20))
elem.clicked.connect(lambda i=i: self.checked(i))
@@ -146,14 +149,14 @@ class SmileyWindow(QtGui.QWidget):
self.setMaximumSize(width, 200)
self.setMinimumSize(width, 200)
self.buttons = []
- for i in range(self.page_size):
+ for i in range(self.page_size): # pages - radio buttons
b = QtGui.QPushButton(self)
b.setGeometry(QtCore.QRect((i / 8) * 20 + 5, (i % 8) * 20, 20, 20))
b.clicked.connect(lambda i=i: self.clicked(i))
self.buttons.append(b)
self.checked(0)
- def checked(self, pos):
+ def checked(self, pos): # new page opened
self.radio[self.page].setChecked(False)
self.radio[pos].setChecked(True)
self.page = pos
@@ -167,12 +170,15 @@ class SmileyWindow(QtGui.QWidget):
except:
self.buttons[i].setVisible(False)
- def clicked(self, pos):
+ def clicked(self, pos): # smiley selected
pos += self.page * self.page_size
smiley = self.data[pos][0]
self.parent.messageEdit.insertPlainText(smiley)
self.close()
+ def leaveEvent(self, event):
+ self.close()
+
class MenuButton(QtGui.QPushButton):
@@ -268,11 +274,14 @@ class StickerItem(QtGui.QWidget):
self.path = fl
self.pixmap = QtGui.QPixmap()
self.pixmap.load(fl)
+ if self.pixmap.width() > 150:
+ self.pixmap = self.pixmap.scaled(150, 200, QtCore.Qt.KeepAspectRatio)
self.setFixedSize(150, self.pixmap.height())
self._image_label.setPixmap(self.pixmap)
class StickerWindow(QtGui.QWidget):
+ """Sticker selection window"""
def __init__(self, parent):
super(StickerWindow, self).__init__()
@@ -296,4 +305,7 @@ class StickerWindow(QtGui.QWidget):
self.parent.profile.send_sticker(self.arr[num])
self.close()
+ def leaveEvent(self, event):
+ self.close()
+
diff --git a/src/profile.py b/src/profile.py
index 2695c3b..4c069b6 100644
--- a/src/profile.py
+++ b/src/profile.py
@@ -444,6 +444,9 @@ class Profile(contact.Contact, Singleton):
data[3],
False)
elif message.get_type() == MESSAGE_TYPE['FILE_TRANSFER']:
+ if message.get_status() is None:
+ self.create_unsent_file_item(message)
+ continue
item = self.create_file_transfer_item(message, False)
if message.get_status() >= 2: # active file transfer
ft = self._file_transfers[(message.get_friend_number(), message.get_file_number())]
@@ -973,8 +976,7 @@ class Profile(contact.Contact, Singleton):
self.get_friend_by_number(friend_number).update_transfer_data(file_number,
FILE_TRANSFER_MESSAGE_STATUS['FINISHED'],
inline)
- #self.update()
- # TODO: fix
+ self.update()
else:
self.get_friend_by_number(friend_number).update_transfer_data(file_number,
FILE_TRANSFER_MESSAGE_STATUS['FINISHED'])