From 9b0c6e63ce63e422d9d0667561f475c8052ebc63 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sat, 2 Jul 2016 18:01:11 +0300 Subject: [PATCH] bug fixes --- src/groupchat.py | 6 +++--- toxygen/contact.py | 5 ++--- toxygen/messages.py | 12 ++++++++++++ toxygen/profile.py | 10 +++++----- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/groupchat.py b/src/groupchat.py index 89c2eb5..2064de7 100644 --- a/src/groupchat.py +++ b/src/groupchat.py @@ -4,8 +4,8 @@ import contact class Groupchat(contact.Contact): def __init__(self, group_id, *args): - super().__init__(args) + super().__init__(*args) self._id = group_id - def load_avatar(self): - super().load_avatar('group.png') + def load_avatar(self, default_path='group.png'): + super().load_avatar(default_path) diff --git a/toxygen/contact.py b/toxygen/contact.py index 2df8c1c..451ea5f 100644 --- a/toxygen/contact.py +++ b/toxygen/contact.py @@ -1,11 +1,10 @@ -import os -from settings import * try: from PySide import QtCore, QtGui except ImportError: from PyQt4 import QtCore, QtGui -from toxcore_enums_and_consts import TOX_PUBLIC_KEY_SIZE import basecontact +from messages import * +from history import * class Contact(basecontact.BaseContact): diff --git a/toxygen/messages.py b/toxygen/messages.py index 87a1cc2..e4fe693 100644 --- a/toxygen/messages.py +++ b/toxygen/messages.py @@ -39,6 +39,18 @@ class TextMessage(Message): return self._message, self._owner, self._time, self._type +class GroupChatTextMessage(TextMessage): + + def __init__(self, friend_name, *args): + super().__init__(*args) + self._name = friend_name + + def get_data(self): + data = list(super().get_data()) + data.append(self._name) + return tuple(data) + + class TransferMessage(Message): """ Message with info about file transfer diff --git a/toxygen/profile.py b/toxygen/profile.py index 816f78d..ede3979 100644 --- a/toxygen/profile.py +++ b/toxygen/profile.py @@ -27,11 +27,11 @@ class Profile(basecontact.BaseContact, Singleton): :param tox: tox instance :param screen: ref to main screen """ - contact.Contact.__init__(self, - tox.self_get_name(), - tox.self_get_status_message(), - screen.user_info, - tox.self_get_address()) + basecontact.BaseContact.__init__(self, + tox.self_get_name(), + tox.self_get_status_message(), + screen.user_info, + tox.self_get_address()) Singleton.__init__(self) self._screen = screen self._messages = screen.messages