mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-15 16:50:34 +03:00
Tidy up
This commit is contained in:
parent
1ca13a85e1
commit
123ecd922e
21
PLUGINS.md
21
PLUGINS.md
@ -63,7 +63,7 @@ def plugin_app(parent):
|
|||||||
"""
|
"""
|
||||||
label = tk.Label(parent, text="Status:")
|
label = tk.Label(parent, text="Status:")
|
||||||
this.status = tk.Label(parent, anchor=tk.W, text="")
|
this.status = tk.Label(parent, anchor=tk.W, text="")
|
||||||
return (label, plugin_app.status)
|
return (label, this.status)
|
||||||
|
|
||||||
# later on your event functions can directly update this.status["text"]
|
# later on your event functions can directly update this.status["text"]
|
||||||
this.status["text"] = "Happy!"
|
this.status["text"] = "Happy!"
|
||||||
@ -124,22 +124,17 @@ To package your plugin for distribution simply create a `.zip` archive of your p
|
|||||||
* Windows: In Explorer right click on your plugin's folder and choose Send to → Compressed (zipped) folder.
|
* Windows: In Explorer right click on your plugin's folder and choose Send to → Compressed (zipped) folder.
|
||||||
* Mac: In Finder right click on your plugin's folder and choose Compress.
|
* Mac: In Finder right click on your plugin's folder and choose Compress.
|
||||||
|
|
||||||
If there are any external dependecies, for example paho.mqtt, you have to bundle
|
If there are any external dependencies then bundle them within the plugin's folder and add the plugin's folder to Python's load path.
|
||||||
any within the plugin folder and make sure it can be included from there.
|
|
||||||
|
|
||||||
Example in top of load.py add
|
|
||||||
```python
|
```python
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
try:
|
|
||||||
import paho.mqtt.client as mqtt
|
# Add plugin's folder to Python's load path.
|
||||||
except:
|
sys.path.append(os.path.join(os.path.dirname(__file__)))
|
||||||
print 'failed to load'
|
|
||||||
#add current folder to path
|
# Assumes the dependency has been bundled in the plugin's folder.
|
||||||
#dependencies should be included within
|
import paho.mqtt.client as mqtt
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__)))
|
|
||||||
#import again
|
|
||||||
import paho.mqtt.client as mqtt
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user