mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 08:17:13 +03:00
Document allowed imports for PLUGINS
* List added in 'Available imports' section of PLUGINS.md * Various *.py files now have comments about things being allowed for plugin import.
This commit is contained in:
parent
63f5db3785
commit
71bb14a737
28
PLUGINS.md
28
PLUGINS.md
@ -21,6 +21,32 @@ Plugins are python files. The plugin folder must have a file named `load.py`
|
|||||||
that must provide one module level function and optionally provide a few
|
that must provide one module level function and optionally provide a few
|
||||||
others.
|
others.
|
||||||
|
|
||||||
|
---
|
||||||
|
### Available imports
|
||||||
|
|
||||||
|
**`import`ing anything from the core EDMarketConnector code that is not
|
||||||
|
explicitly mentioned here is unsupported and may lead to your plugin
|
||||||
|
breaking with future code changes.**
|
||||||
|
|
||||||
|
`from config import appname, applongname, appcmdname, appversion
|
||||||
|
, copyright, config` - to access config.
|
||||||
|
|
||||||
|
`from prefs import prefsVersion` - to allow for versioned preferences.
|
||||||
|
|
||||||
|
`from companion import category_map` - Or any of the other static date
|
||||||
|
contained therein. NB: There's a plan to move such to a `data` module.
|
||||||
|
|
||||||
|
`import plug` - Mostly for using `plug.show_error()`. Relying on anything
|
||||||
|
else isn't supported.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from ttkHyperlinkLabel import HyperlinkLabel
|
||||||
|
import myNotebook as nb
|
||||||
|
```
|
||||||
|
For creating UI elements.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
### Startup
|
### Startup
|
||||||
EDMC will import the `load.py` file as a module and then call the
|
EDMC will import the `load.py` file as a module and then call the
|
||||||
`plugin_start3()` function.
|
`plugin_start3()` function.
|
||||||
@ -282,7 +308,7 @@ Frontier's servers.
|
|||||||
docked and the station has the shipyard service.
|
docked and the station has the shipyard service.
|
||||||
- `is_beta` is a `bool` denoting if data came from a beta version of the game.
|
- `is_beta` is a `bool` denoting if data came from a beta version of the game.
|
||||||
|
|
||||||
#### Plugin-specific events.
|
#### Plugin-specific events
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def edsm_notify_system(reply):
|
def edsm_notify_system(reply):
|
||||||
|
@ -48,7 +48,7 @@ URL_SHIPYARD= '/shipyard'
|
|||||||
|
|
||||||
|
|
||||||
# Map values reported by the Companion interface to names displayed in-game
|
# Map values reported by the Companion interface to names displayed in-game
|
||||||
|
# May be imported by plugins
|
||||||
category_map = {
|
category_map = {
|
||||||
'Narcotics' : 'Legal Drugs',
|
'Narcotics' : 'Legal Drugs',
|
||||||
'Slaves' : 'Slavery',
|
'Slaves' : 'Slavery',
|
||||||
|
@ -4,7 +4,7 @@ from os import getenv, makedirs, mkdir, pardir
|
|||||||
from os.path import expanduser, dirname, exists, isdir, join, normpath
|
from os.path import expanduser, dirname, exists, isdir, join, normpath
|
||||||
from sys import platform
|
from sys import platform
|
||||||
|
|
||||||
|
# Any of these may be imported by plugins
|
||||||
appname = 'EDMarketConnector'
|
appname = 'EDMarketConnector'
|
||||||
applongname = 'E:D Market Connector'
|
applongname = 'E:D Market Connector'
|
||||||
appcmdname = 'EDMC'
|
appcmdname = 'EDMC'
|
||||||
|
@ -10,6 +10,7 @@ from sys import platform
|
|||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
|
|
||||||
|
# Entire file may be imported by plugins
|
||||||
|
|
||||||
# Can't do this with styles on OSX - http://www.tkdocs.com/tutorial/styles.html#whydifficult
|
# Can't do this with styles on OSX - http://www.tkdocs.com/tutorial/styles.html#whydifficult
|
||||||
if platform == 'darwin':
|
if platform == 'darwin':
|
||||||
|
2
prefs.py
2
prefs.py
@ -23,7 +23,7 @@ import plug
|
|||||||
# 'new' preferences, or not.
|
# 'new' preferences, or not.
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
# May be imported by plugins
|
||||||
class PrefsVersion(object):
|
class PrefsVersion(object):
|
||||||
versions = {
|
versions = {
|
||||||
'0.0.0.0': 1,
|
'0.0.0.0': 1,
|
||||||
|
@ -18,6 +18,7 @@ if platform == 'win32':
|
|||||||
# underline: If True/False the text is always/never underlined. If None (the default) the text is underlined only on hover.
|
# underline: If True/False the text is always/never underlined. If None (the default) the text is underlined only on hover.
|
||||||
# popup_copy: Whether right-click on non-empty label text pops up a context menu with a 'Copy' option. Defaults to no context menu. If popup_copy is a function it will be called with the current label text and should return a boolean.
|
# popup_copy: Whether right-click on non-empty label text pops up a context menu with a 'Copy' option. Defaults to no context menu. If popup_copy is a function it will be called with the current label text and should return a boolean.
|
||||||
#
|
#
|
||||||
|
# May be imported by plugins
|
||||||
class HyperlinkLabel(platform == 'darwin' and tk.Label or ttk.Label, object):
|
class HyperlinkLabel(platform == 'darwin' and tk.Label or ttk.Label, object):
|
||||||
|
|
||||||
def __init__(self, master=None, **kw):
|
def __init__(self, master=None, **kw):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user