From b0389537a166faa55ca42d19502853d9e443dc11 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sat, 29 Oct 2016 17:39:48 +0300 Subject: [PATCH] plugins updates --- toxygen/plugins/plugin_super_class.py | 5 +++-- toxygen/profile.py | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/toxygen/plugins/plugin_super_class.py b/toxygen/plugins/plugin_super_class.py index 84c4a3e..f0cf1b4 100644 --- a/toxygen/plugins/plugin_super_class.py +++ b/toxygen/plugins/plugin_super_class.py @@ -26,7 +26,7 @@ def log(name, data): :param data: data for saving in log """ with open(path_to_data(name) + 'logs.txt', 'a') as fl: - fl.write(bytes(data, 'utf-8') + b'\n') + fl.write(str(data) + '\n') class PluginSuperClass: @@ -129,7 +129,7 @@ class PluginSuperClass: """ App is closing """ - pass + self.stop() def command(self, command): """ @@ -169,6 +169,7 @@ class PluginSuperClass: def load_settings(self): """ This method loads settings of plugin and returns raw data + If file doesn't this method raises exception """ with open(path_to_data(self._short_name) + 'settings.json', 'rb') as fl: data = fl.read() diff --git a/toxygen/profile.py b/toxygen/profile.py index 06ffcdb..fc52a75 100644 --- a/toxygen/profile.py +++ b/toxygen/profile.py @@ -249,7 +249,10 @@ class Profile(basecontact.BaseContact, Singleton): active_friend = property(get_active, set_active) def get_last_message(self): - return self._contacts[self._active_friend].get_last_message_text() + if self._active_friend + 1: + return self._contacts[self._active_friend].get_last_message_text() + else: + return '' def get_active_number(self): return self._contacts[self._active_friend].number if self._active_friend + 1 else -1 @@ -1200,7 +1203,8 @@ class Profile(basecontact.BaseContact, Singleton): """ self._call.accept_call(friend_number, audio, video) self._screen.active_call() - self._incoming_calls.remove(friend_number) + if friend_number in self._incoming_calls: + self._incoming_calls.remove(friend_number) if hasattr(self, '_call_widget'): del self._call_widget