docs update
This commit is contained in:
parent
d6b6327545
commit
5b9cce4155
5 changed files with 19 additions and 13 deletions
|
@ -3,7 +3,7 @@
|
|||
In Toxygen plugin is single python (supported Python 3.0 - 3.4) module (.py file) and directory with data associated with it.
|
||||
Every module must contain one class derived from PluginSuperClass defined in [plugin_super_class.py](/src/plugins/plugin_super_class.py). Instance of this class will be created by PluginLoader class (defined in [plugin_support.py](/src/plugin_support.py) ). This class can enable/disable plugins and send data to it.
|
||||
|
||||
Every plugin has it's own full name and unique short name (1-5 symbols). Main app can get it using special methods.
|
||||
Every plugin has its own full name and unique short name (1-5 symbols). Main app can get it using special methods.
|
||||
|
||||
All plugin's data should be stored in following structure:
|
||||
|
||||
|
@ -16,36 +16,39 @@ All plugin's data should be stored in following structure:
|
|||
|---other_files
|
||||
```
|
||||
|
||||
Plugin MUST override:
|
||||
- __init__ with params: tox (Tox instance), profile (Profile instance), settings (Settings instance), encrypt_save (ToxEncryptSave instance). Call super().__init__ with params plugin_full_name, plugin_short_name, tox, profile, settings, encrypt_save.
|
||||
|
||||
Plugin can override following methods:
|
||||
- get_description - this method should return plugin description.
|
||||
- get_menu - plugins allowed to add items in friend menu. You can open this menu making right click on friend in friends list. This method should return list of QAction's. Plugin must connect to QAction's triggered() signal.
|
||||
- get_menu - plugins allowed to add items in friend menu. User can open this menu making right click on friend in friends list. This method should return list of QAction's. Plugin must connect to QAction's triggered() signal.
|
||||
- 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 <plugin_short_name> <command>'. Command 'help' should show user list of supported commands.
|
||||
- command - new command to plugin. Command can be entered in message field in format '/plugin <plugin_short_name> <command>'. Command 'help' should show list of supported commands.
|
||||
- lossless_packet - callback - incoming lossless packet from friend.
|
||||
- lossy_packet - callback - incoming lossy packet from friend.
|
||||
- friend_connected - callback - friend became online.
|
||||
- friend_connected - callback - friend became online. Note that it called from friend_connection_status callback so friend is not really connected and ready for sending packets.
|
||||
|
||||
Other methods:
|
||||
- send_lossless - this method send custom lossless packet. Plugins MUST send lossless packets using this method.
|
||||
- send_lossy - this method send custom lossy packet. Plugins MUST send lossy packets using this method.
|
||||
- send_lossless - this method sends custom lossless packet. Plugins MUST send lossless packets using this method.
|
||||
- send_lossy - this method sends custom lossy packet. Plugins MUST send lossy packets using this method.
|
||||
- load_settings - loads settings stored in default location.
|
||||
- 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.
|
||||
- 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 (example: ru_RU.qm).
|
||||
|
||||
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 dynamic import instead.
|
||||
Import statement will not work in case you import module that wasn't previously imported by main program and user uses precompiled binary. It's recommended to use importlib module instead: importlib.import_module(module_name)
|
||||
|
||||
About GUI:
|
||||
|
||||
It's strictly recommended to support both PySide and PyQt4 in GUI. Plugin can not have GUI at all.
|
||||
It's strictly recommended to support both PySide and PyQt4 in GUI. Plugin can have no GUI at all.
|
||||
|
||||
Exceptions:
|
||||
|
||||
Plugin's methods should not raise exceptions.
|
||||
Plugin's methods MUST NOT raise exceptions.
|
||||
|
||||
#Examples
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ Check [Plugin API](/docs/plugin_api.md) for more info
|
|||
|
||||
Toxygen comes without preinstalled plugins.
|
||||
|
||||
1. Put plugin and directory with its data into /src/plugins/
|
||||
1. Put plugin and directory with its data into /src/plugins/ or import it via GUI (In menu: Plugins -> Import plugin)
|
||||
2. Restart Toxygen
|
||||
|
||||
##Note: /src/plugins/ should contain plugin_super_class.py and __init__.py
|
||||
|
|
|
@ -9,3 +9,5 @@ Animated smileys (.gif) are supported too.
|
|||
#Stickers
|
||||
|
||||
Sticker is inline image. If you want to create your own smiley pack, create directory in src/stickers/ and place your stickers there.
|
||||
|
||||
Users can import plugins and stickers packs using menu: Settings -> Interface
|
|
@ -63,7 +63,7 @@ class AddContact(CenteredWidget):
|
|||
return
|
||||
self._adding = True
|
||||
profile = Profile.get_instance()
|
||||
send = profile.send_friend_request(self.tox_id.text(), self.message_edit.toPlainText())
|
||||
send = profile.send_friend_request(self.tox_id.text().strip(), self.message_edit.toPlainText())
|
||||
self._adding = False
|
||||
if send is True:
|
||||
# request was successful
|
||||
|
|
|
@ -37,6 +37,7 @@ class PluginSuperClass:
|
|||
|
||||
def __init__(self, name, short_name, tox=None, profile=None, settings=None, encrypt_save=None):
|
||||
"""
|
||||
Constructor. In plugin __init__ should take only 4 last arguments
|
||||
:param name: plugin full name
|
||||
:param short_name: plugin unique short name (length of short name should not exceed MAX_SHORT_NAME_LENGTH)
|
||||
:param tox: tox instance
|
||||
|
|
Loading…
Reference in a new issue