From 2a97beb5afa29cb14b511dca1c292294e0d1470d Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sun, 15 Jul 2018 17:04:51 +0300 Subject: [PATCH] minor bug fixes --- toxygen/contacts/contacts_manager.py | 6 ------ toxygen/messenger/messenger.py | 7 +++++++ toxygen/ui/main_screen.py | 2 +- toxygen/ui/main_screen_widgets.py | 1 - 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/toxygen/contacts/contacts_manager.py b/toxygen/contacts/contacts_manager.py index 6812391..5d07bd2 100644 --- a/toxygen/contacts/contacts_manager.py +++ b/toxygen/contacts/contacts_manager.py @@ -226,12 +226,6 @@ class ContactsManager(ToxSave): def get_contact_by_tox_id(self, tox_id): return list(filter(lambda c: c.tox_id == tox_id, self._contacts))[0] - def get_last_message(self): - if self._active_contact + 1: - return self.get_curr_contact().get_last_message_text() - else: - return '' - def get_active_number(self): return self.get_curr_contact().number if self._active_contact + 1 else -1 diff --git a/toxygen/messenger/messenger.py b/toxygen/messenger/messenger.py index af66f0b..dbd2d1e 100644 --- a/toxygen/messenger/messenger.py +++ b/toxygen/messenger/messenger.py @@ -19,6 +19,13 @@ class Messenger(tox_save.ToxSave): calls_manager.call_started_event.add_callback(self._on_call_started) calls_manager.call_finished_event.add_callback(self._on_call_finished) + def get_last_message(self): + contact = self._contacts_manager.get_curr_contact() + if contact is None: + return str() + + return contact.get_last_message_text() + # ----------------------------------------------------------------------------------------------------------------- # Messaging - friends # ----------------------------------------------------------------------------------------------------------------- diff --git a/toxygen/ui/main_screen.py b/toxygen/ui/main_screen.py index 5bcd15a..1bc3612 100644 --- a/toxygen/ui/main_screen.py +++ b/toxygen/ui/main_screen.py @@ -170,7 +170,7 @@ class MainWindow(QtWidgets.QMainWindow): self.online_contacts.addItem(util_ui.tr("Online and by name")) self.online_contacts.addItem(util_ui.tr("Online first and by name")) ind = self._settings['sorting'] - d = {0: 0, 1: 1, 2: 2, 3: 4, 1 | 4: 4, 2 | 4: 5} + d = {0: 0, 1: 1, 2: 2, 3: 4, 4: 3, 1 | 4: 4, 2 | 4: 5} self.online_contacts.setCurrentIndex(d[ind]) self.importPlugin.setText(util_ui.tr("Import plugin")) self.reloadPlugins.setText(util_ui.tr("Reload plugins")) diff --git a/toxygen/ui/main_screen_widgets.py b/toxygen/ui/main_screen_widgets.py index 479575e..0945b0c 100644 --- a/toxygen/ui/main_screen_widgets.py +++ b/toxygen/ui/main_screen_widgets.py @@ -1,6 +1,5 @@ from PyQt5 import QtCore, QtGui, QtWidgets from ui.widgets import RubberBandWindow, create_menu, QRightClickButton, CenteredWidget, LineEdit -from contacts.profile import Profile import urllib import utils.util as util import utils.ui as util_ui