minor bug fixes

This commit is contained in:
ingvar1995 2018-07-15 17:04:51 +03:00
parent 7aac248bf9
commit 2a97beb5af
4 changed files with 8 additions and 8 deletions

View file

@ -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

View file

@ -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
# -----------------------------------------------------------------------------------------------------------------

View file

@ -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"))

View file

@ -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