diff --git a/docs/plugin_api.md b/docs/plugin_api.md index 93b3683..b4c81db 100644 --- a/docs/plugin_api.md +++ b/docs/plugin_api.md @@ -12,6 +12,7 @@ All plugin's data should be stored in following structure: |---plugin_short_name.py |---/plugin_short_name/ |---settings.json + |---logs.txt |---other_files ``` @@ -21,6 +22,7 @@ Plugin can override following methods: - get_window - plugins can have GUI, this method should return window instance or None for plugins without GUI. - start - plugin was started. - stop - plugin was stopped. +- close - app is closing, stop plugin. - command - new command to plugin. Command can be entered in message field in format '/plugin '. Command 'help' should show user list of supported commands. - lossless_packet - callback - incoming lossless packet from friend. - lossy_packet - callback - incoming lossy packet from friend. @@ -33,4 +35,19 @@ Other methods: - save_settings - saves settings to default location. - load_translator - loads translations. Translations must be stored in directory with plugin's data. Files with translations must have the same name as in main app. +About import: + +import statement will not work in case you import module that wasn't previously imported by main program and user use precompiled binary. It's recommended to use imp module and dynamic import instead. + +About GUI: + +It's strictly recommended to support both PySide and PyQt4 in GUI. + +Exceptions: + +Plugin's methods should not raise exceptions. + +#Examples + +You can find example of a plugin in [official repo](https://github.com/ingvar1995/toxygen_plugins) diff --git a/docs/plugins.md b/docs/plugins.md index ca32b51..3fb13b7 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -8,6 +8,8 @@ Check [Plugin API](/docs/plugin_api.md) for more info #How to install plugin +Toxygen comes without preinstalled plugins. + 1. Put plugin and directory with it's data into /src/plugins/ 2. Restart Toxygen @@ -15,3 +17,4 @@ Check [Plugin API](/docs/plugin_api.md) for more info WARNING: It is unsecure to install plugin not from this list! +[Main repo](https://github.com/ingvar1995/toxygen_plugins) \ No newline at end of file diff --git a/src/mainscreen.py b/src/mainscreen.py index 2d34e3a..4ed5b3b 100644 --- a/src/mainscreen.py +++ b/src/mainscreen.py @@ -128,6 +128,7 @@ class MainWindow(QtGui.QMainWindow): self.online_contacts.clear() self.online_contacts.addItem(QtGui.QApplication.translate("MainWindow", "All", None, QtGui.QApplication.UnicodeUTF8)) self.online_contacts.addItem(QtGui.QApplication.translate("MainWindow", "Online", None, QtGui.QApplication.UnicodeUTF8)) + self.online_contacts.setCurrentIndex(int(Settings.get_instance()['show_online_friends'])) def setup_right_bottom(self, Form): Form.setObjectName("right_bottom") diff --git a/src/menu.py b/src/menu.py index c2165b3..1fa5e68 100644 --- a/src/menu.py +++ b/src/menu.py @@ -275,7 +275,7 @@ class NetworkSettings(CenteredWidget): self.proxyport.setText(unicode(settings['proxy_port'])) self.http.setChecked(settings['proxy_type'] == 1) self.warning = QtGui.QLabel(self) - self.warning.setGeometry(QtCore.QRect(40, 270, 200, 60)) + self.warning.setGeometry(QtCore.QRect(5, 270, 290, 60)) self.warning.setStyleSheet('QLabel { color: #F70D1A; }') self.retranslateUi() self.proxy.stateChanged.connect(lambda x: self.activate()) diff --git a/src/plugins/plugin_super_class.py b/src/plugins/plugin_super_class.py index 17089db..190c113 100644 --- a/src/plugins/plugin_super_class.py +++ b/src/plugins/plugin_super_class.py @@ -20,6 +20,15 @@ def path_to_data(name): return os.path.dirname(os.path.realpath(__file__)) + '/' + name + '/' +def log(name, data): + """ + :param name: plugin unique name + :param data: data for saving in log + """ + with open(path_to_data(name) + 'logs.txt', 'a') as fl: + fl.write(str(data) + '\n') + + class PluginSuperClass(object): """ Superclass for all plugins. Plugin is python module with at least one class derived from PluginSuperClass. diff --git a/src/profile.py b/src/profile.py index ebda428..97baaf1 100644 --- a/src/profile.py +++ b/src/profile.py @@ -881,8 +881,9 @@ class Profile(Contact, Singleton): friend.status = None def close(self): - self._call.stop() - del self._call + if hasattr(self, '_stop'): + self._call.stop() + del self._call # ----------------------------------------------------------------------------------------------------------------- # File transfers support diff --git a/src/translations/ru_RU.qm b/src/translations/ru_RU.qm index 02cd9be..dffe08c 100644 Binary files a/src/translations/ru_RU.qm and b/src/translations/ru_RU.qm differ diff --git a/src/translations/ru_RU.ts b/src/translations/ru_RU.ts index 9c4b0a5..83723b0 100644 --- a/src/translations/ru_RU.ts +++ b/src/translations/ru_RU.ts @@ -66,8 +66,8 @@ WARNING: using proxy with enabled UDP can produce IP leak - Предупреждение: -использование прокси со включенным UDP + Предупреждение: +использование прокси с UDP может привести к утечке IP diff --git a/src/util.py b/src/util.py index 0737bcf..d02a88b 100644 --- a/src/util.py +++ b/src/util.py @@ -3,7 +3,7 @@ import time from platform import system -program_version = '0.1.2' +program_version = '0.1.3' def log(data):