docs for new classes structure
This commit is contained in:
parent
3a90865fd0
commit
e5a228906d
@ -10,7 +10,8 @@ class BaseContact:
|
|||||||
"""
|
"""
|
||||||
Class encapsulating TOX contact
|
Class encapsulating TOX contact
|
||||||
Properties: name (alias of contact or name), status_message, status (connection status)
|
Properties: name (alias of contact or name), status_message, status (connection status)
|
||||||
widget - widget for update
|
widget - widget for update, tox id (or public key)
|
||||||
|
Base class for all contacts.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name, status_message, widget, tox_id):
|
def __init__(self, name, status_message, widget, tox_id):
|
||||||
|
@ -12,8 +12,7 @@ import file_transfers as ft
|
|||||||
class Contact(basecontact.BaseContact):
|
class Contact(basecontact.BaseContact):
|
||||||
"""
|
"""
|
||||||
Class encapsulating TOX contact
|
Class encapsulating TOX contact
|
||||||
Properties: name (alias of contact or name), status_message, status (connection status)
|
Properties: number, message getter, history etc. Base class for friend and gc classes
|
||||||
widget - widget for update
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, message_getter, number, name, status_message, widget, tox_id):
|
def __init__(self, message_getter, number, name, status_message, widget, tox_id):
|
||||||
@ -59,6 +58,9 @@ class Contact(basecontact.BaseContact):
|
|||||||
self._history_loaded = True
|
self._history_loaded = True
|
||||||
|
|
||||||
def load_all_corr(self):
|
def load_all_corr(self):
|
||||||
|
"""
|
||||||
|
Get all chat history from db for current friend
|
||||||
|
"""
|
||||||
data = list(self._message_getter.get_all())
|
data = list(self._message_getter.get_all())
|
||||||
if data is not None and len(data):
|
if data is not None and len(data):
|
||||||
data.reverse()
|
data.reverse()
|
||||||
@ -115,6 +117,9 @@ class Contact(basecontact.BaseContact):
|
|||||||
self._message_getter.delete_one()
|
self._message_getter.delete_one()
|
||||||
|
|
||||||
def delete_old_messages(self):
|
def delete_old_messages(self):
|
||||||
|
"""
|
||||||
|
Delete old messages (reduces RAM if messages saving is not enabled)
|
||||||
|
"""
|
||||||
old = filter(lambda x: x.get_type() in (2, 3) and (x.get_status() >= 2 or x.get_status() is None),
|
old = filter(lambda x: x.get_type() in (2, 3) and (x.get_status() >= 2 or x.get_status() is None),
|
||||||
self._corr[:-SAVE_MESSAGES])
|
self._corr[:-SAVE_MESSAGES])
|
||||||
old = list(old)
|
old = list(old)
|
||||||
@ -182,7 +187,7 @@ class Contact(basecontact.BaseContact):
|
|||||||
visibility = property(get_visibility, set_visibility)
|
visibility = property(get_visibility, set_visibility)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
# Unread messages from friend
|
# Unread messages and other actions from friend
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def get_actions(self):
|
def get_actions(self):
|
||||||
|
@ -4,14 +4,10 @@ from messages import *
|
|||||||
|
|
||||||
class Friend(contact.Contact):
|
class Friend(contact.Contact):
|
||||||
"""
|
"""
|
||||||
Friend in list of friends. Can be hidden, properties 'has unread messages' and 'has alias' added
|
Friend in list of friends.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, message_getter, number, name, status_message, widget, tox_id):
|
def __init__(self, message_getter, number, name, status_message, widget, tox_id):
|
||||||
"""
|
|
||||||
:param message_getter: gets messages from db
|
|
||||||
:param number: number of friend.
|
|
||||||
"""
|
|
||||||
super().__init__(message_getter, number, name, status_message, widget, tox_id)
|
super().__init__(message_getter, number, name, status_message, widget, tox_id)
|
||||||
self._receipts = 0
|
self._receipts = 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user