Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement more modern plugin system #1228

Draft
wants to merge 152 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
b1741e2
Added start of new plugin system
A-UNDERSCORE-D Mar 4, 2021
e2e8810
Added plugin logger to Plugin
A-UNDERSCORE-D Mar 4, 2021
97dbf27
Updated architechtre file with constraint on plugin.py
A-UNDERSCORE-D Mar 4, 2021
cf28f04
renamed file
A-UNDERSCORE-D Mar 4, 2021
e4d329e
Added plugin tests
A-UNDERSCORE-D Mar 4, 2021
5588970
Made use of exceptions during plugin loading
A-UNDERSCORE-D Mar 5, 2021
d682348
Added more plugin tests
A-UNDERSCORE-D Mar 5, 2021
2ebd47d
Updated arch file with exceptions
A-UNDERSCORE-D Mar 5, 2021
d6e12e3
reorganised test files
A-UNDERSCORE-D Mar 5, 2021
65e49c3
Added migtation plans
A-UNDERSCORE-D Mar 5, 2021
4e15a91
fixed broken init
A-UNDERSCORE-D Mar 5, 2021
4397188
Switched plugin storage to a dict
A-UNDERSCORE-D Mar 10, 2021
3fecc05
Made abstract method explode when called
A-UNDERSCORE-D Mar 10, 2021
77a9135
Added check for null PluginInfo
A-UNDERSCORE-D Mar 10, 2021
87c6fd6
added additional tests
A-UNDERSCORE-D Mar 10, 2021
27b8226
First stab at plugin unloading
A-UNDERSCORE-D Mar 11, 2021
8805357
Various test changes
A-UNDERSCORE-D Mar 12, 2021
8f963ab
Started work on legacy loading
A-UNDERSCORE-D Mar 15, 2021
97e7c90
Updated event classes
A-UNDERSCORE-D Mar 15, 2021
40c6e4c
Added todo
A-UNDERSCORE-D Mar 16, 2021
779bad2
Continued MigratedPlugin implementation
A-UNDERSCORE-D Mar 16, 2021
8e618a4
continued work on legacy plugin loading
A-UNDERSCORE-D Mar 16, 2021
546294f
First stab at actual plugin loading
A-UNDERSCORE-D Mar 16, 2021
cc61c7f
Updated arch file with legacy loading changes
A-UNDERSCORE-D Mar 16, 2021
facc04e
Fixed log wording
A-UNDERSCORE-D Mar 17, 2021
4b97e1a
Refactored load_plugin to be plugin type agnostic
A-UNDERSCORE-D Mar 17, 2021
856c563
Added string and find_callback methods to plugin
A-UNDERSCORE-D Mar 20, 2021
3eb8cf5
Getattr explodes if you dont pass a default
A-UNDERSCORE-D Mar 22, 2021
3dfcce6
Removed unused code
A-UNDERSCORE-D Mar 22, 2021
a614f48
Fixed some missed loading errors
A-UNDERSCORE-D Mar 22, 2021
0201acc
Updated tests, added legacy plugin test
A-UNDERSCORE-D Mar 22, 2021
3f9a93d
Apparently I hadnt added this
A-UNDERSCORE-D Mar 22, 2021
8ac2bd8
Added legacy loading tests
A-UNDERSCORE-D Mar 22, 2021
de88307
made quoting consistent
A-UNDERSCORE-D Mar 22, 2021
b507174
Fixed a bug, added tests
A-UNDERSCORE-D Mar 24, 2021
bf1d6ed
added test legacy plugin with all callbacks
A-UNDERSCORE-D Mar 24, 2021
0fe76ff
Made legacy plugin callback support work
A-UNDERSCORE-D Mar 26, 2021
a70c1f2
added callback test
A-UNDERSCORE-D Mar 29, 2021
46cf510
Fixed plugins not loading callbacks
A-UNDERSCORE-D Apr 18, 2021
c8cc1c6
Added test to check hooks are found
A-UNDERSCORE-D Apr 18, 2021
c89946f
Added util method to load multiple plugin paths
A-UNDERSCORE-D Apr 20, 2021
100ef7c
Added event system
A-UNDERSCORE-D Apr 20, 2021
d4d74b0
Tidied some imports
A-UNDERSCORE-D Apr 20, 2021
fe1f743
Made exception add some nice wrapping wording
A-UNDERSCORE-D Apr 20, 2021
2b61bab
Added targeted event firing
A-UNDERSCORE-D Apr 20, 2021
cfae1fa
Made list based decorators more generic
A-UNDERSCORE-D Apr 20, 2021
771473c
fixed finding pycache for tests
A-UNDERSCORE-D Apr 20, 2021
7492bbd
added test for method with multiple callbacks
A-UNDERSCORE-D Apr 20, 2021
73dfc22
Updated arch file
A-UNDERSCORE-D Apr 21, 2021
c4bfc7d
added repr and docstrings for it and str
A-UNDERSCORE-D Apr 21, 2021
ea61ca1
added start of provider test
A-UNDERSCORE-D Apr 21, 2021
c42eb48
Removed import
A-UNDERSCORE-D Apr 21, 2021
9e5d43f
added provider decorator
A-UNDERSCORE-D Apr 21, 2021
a26212e
Reorganised files, passed flake8
A-UNDERSCORE-D Apr 24, 2021
6a2fefd
Started removing needed plugin imports
A-UNDERSCORE-D Apr 30, 2021
e34931b
Added ease of use getitem and get methods to DictDataEvent
A-UNDERSCORE-D May 9, 2021
6c806f5
Ensured callbacks are only ever called once for a given event
A-UNDERSCORE-D May 9, 2021
bf265d0
Allowed string versions on PluginInfo
A-UNDERSCORE-D May 9, 2021
0f11113
Added access to killswitch to EDMCPlugin
A-UNDERSCORE-D May 9, 2021
c077257
Began description of core events
A-UNDERSCORE-D May 9, 2021
68eb4cd
Rewrote coriolis and eddn to new plugin format
A-UNDERSCORE-D May 10, 2021
7c31d53
Added TODO
A-UNDERSCORE-D May 17, 2021
7617b98
Began integration of new plugin system
A-UNDERSCORE-D Jun 4, 2021
68e10da
Updated arch info
A-UNDERSCORE-D Jun 4, 2021
4a0dd18
removed None checks that arent needed
A-UNDERSCORE-D Jun 4, 2021
7f8078a
plugin lists in prefs
A-UNDERSCORE-D Jun 5, 2021
65c263e
added legacy plugins getter
A-UNDERSCORE-D Jun 5, 2021
98b4c77
typed decorator more tightly when types are known
A-UNDERSCORE-D Aug 19, 2021
0f473c7
streamlined plugin UI loading
A-UNDERSCORE-D Aug 19, 2021
b4761df
added legacy plugin wrapper UI wrapper
A-UNDERSCORE-D Aug 19, 2021
3176964
fixed type on test
A-UNDERSCORE-D Aug 19, 2021
e73ed5f
even better decorators typing, renamed events
A-UNDERSCORE-D Aug 21, 2021
2c1ae2a
missing newline
A-UNDERSCORE-D Aug 21, 2021
00c6f78
import cleanup
A-UNDERSCORE-D Aug 21, 2021
a284f76
revised how loaded (and/or errored) plugins are shown
A-UNDERSCORE-D Aug 21, 2021
04044a0
start on moving prefs events to new system
A-UNDERSCORE-D Aug 21, 2021
789b7e8
reorder config window tabs
A-UNDERSCORE-D Aug 22, 2021
097d3f5
added util method for simple notification events
A-UNDERSCORE-D Aug 23, 2021
f4b4051
fixed unresolved import
A-UNDERSCORE-D Aug 23, 2021
7586e45
Include exceptions in results when firing event functions
A-UNDERSCORE-D Sep 30, 2021
4cb1eef
missed import during rebase
A-UNDERSCORE-D Sep 30, 2021
edfd44f
Add monitor access to EDMCPlugin
A-UNDERSCORE-D Sep 30, 2021
e6a3a27
make BaseDataEvent a generic
A-UNDERSCORE-D Sep 30, 2021
860c970
Integrate normal event handlers
A-UNDERSCORE-D Sep 30, 2021
688010c
unstubbed as much of old plug as needed
A-UNDERSCORE-D Sep 30, 2021
d5ef2d1
fixed bad import / DictDataEvent usage
A-UNDERSCORE-D Sep 30, 2021
35388f0
fixed typing on decorator
A-UNDERSCORE-D Sep 30, 2021
1a2b097
added commander getter
A-UNDERSCORE-D Sep 30, 2021
df94b62
updated breakout LUTs to access `self` as well
A-UNDERSCORE-D Sep 30, 2021
585239f
added option to keep exceptions on fired events
A-UNDERSCORE-D Sep 30, 2021
0b9c009
Added preferences closed support
A-UNDERSCORE-D Sep 30, 2021
f175cfa
updated arch
A-UNDERSCORE-D Sep 30, 2021
d6146c4
Added load_all_plugins util method
A-UNDERSCORE-D Oct 4, 2021
912eabf
fixed PluginManager.legacy_plugins returning []
A-UNDERSCORE-D Oct 4, 2021
c60ec2c
fixed path autoresolution being one level too low
A-UNDERSCORE-D Oct 4, 2021
33bd326
added disabled plugins to prefs plugins tab
A-UNDERSCORE-D Oct 4, 2021
1a470c7
Made use of load_plugins_in, loaded third party plugins
A-UNDERSCORE-D Oct 4, 2021
74f97ea
long winded comment about self.monitor and co
A-UNDERSCORE-D Oct 4, 2021
53c909e
added util method for provider access
A-UNDERSCORE-D Oct 5, 2021
fb2e1b5
added aliases to provider names
A-UNDERSCORE-D Oct 5, 2021
39e82dd
make use of providers for get(shipyard|station|system)_url
A-UNDERSCORE-D Oct 5, 2021
6927d3e
add wrappers for known providers
A-UNDERSCORE-D Oct 5, 2021
0aa89a8
cleanup imports
A-UNDERSCORE-D Oct 5, 2021
b878f6c
added info to shimmed providers
A-UNDERSCORE-D Oct 5, 2021
3318285
added some logging during plugin load
A-UNDERSCORE-D Oct 5, 2021
387c725
update ARCHITECTURE.md with currently known providers
A-UNDERSCORE-D Oct 5, 2021
28ce76c
fix line too long
A-UNDERSCORE-D Oct 5, 2021
58d70c6
be smarter about detecting plugins in logs
A-UNDERSCORE-D Oct 5, 2021
a9e2732
un-gut plug a bit
A-UNDERSCORE-D Oct 5, 2021
13bee55
use constants
A-UNDERSCORE-D Oct 5, 2021
6105bc4
fix legacy capidata
A-UNDERSCORE-D Oct 5, 2021
c3c5ac7
add provides wrapper
A-UNDERSCORE-D Oct 6, 2021
2a94d5b
dont add two callbacks for plugin_app wrappers
A-UNDERSCORE-D Oct 6, 2021
b4f4130
create plugin loggers for legacy plugins before importing them
A-UNDERSCORE-D Oct 6, 2021
a0503be
provide plug access to the running plugin_manager
A-UNDERSCORE-D Oct 6, 2021
713caad
Made plugins UIs frames within frames
A-UNDERSCORE-D Oct 6, 2021
78e961a
as all plugins now get the frame-within-frame treatment, dont do it a…
A-UNDERSCORE-D Oct 6, 2021
b00df08
fixed tuple legacy plugins not showing UI
A-UNDERSCORE-D Oct 6, 2021
879a9d0
fixed tests
A-UNDERSCORE-D Oct 6, 2021
6c27df3
pass autoresolve to lower loading machinery
A-UNDERSCORE-D Oct 6, 2021
44581a4
make linters happy
A-UNDERSCORE-D Oct 6, 2021
f0ec22d
Fix various linter errors
A-UNDERSCORE-D Oct 7, 2021
b9ab008
fix dashboard_entry not being correctly called
A-UNDERSCORE-D Oct 7, 2021
9e19fd4
cannot use TYPE_CHECKING guarded imports in non-annotations
A-UNDERSCORE-D Oct 7, 2021
f419ce4
added the rest of the overloads to `hook`
A-UNDERSCORE-D Oct 7, 2021
0632ca4
fix import location
A-UNDERSCORE-D Oct 10, 2021
6192d95
fixed plugin frame not being sticky
A-UNDERSCORE-D Oct 10, 2021
06edf5d
reimplemented plug methods
A-UNDERSCORE-D Oct 12, 2021
a721fe0
made unload/load raise NotImplementedError
A-UNDERSCORE-D Oct 12, 2021
29255af
added repr method
A-UNDERSCORE-D Oct 12, 2021
e50a197
added is_legacy utility property
A-UNDERSCORE-D Oct 12, 2021
f3802e7
beginning of replacement of plug.show_error featuree
A-UNDERSCORE-D Oct 12, 2021
fe3a29f
getattr != hasattr
A-UNDERSCORE-D Oct 14, 2021
8ee2a23
fixed nameerror, cleaned up imports
A-UNDERSCORE-D Oct 14, 2021
65b44be
reimplement status line message system
A-UNDERSCORE-D Oct 15, 2021
3b5d603
remove names from URL providers
A-UNDERSCORE-D Oct 16, 2021
6c98082
add type overloads to @provider
A-UNDERSCORE-D Oct 16, 2021
a18895e
fix legacy providers
A-UNDERSCORE-D Oct 16, 2021
e1d5f59
respect .disabled
A-UNDERSCORE-D Oct 16, 2021
ac8699b
add system_address, system_population, and station_marketid properties
A-UNDERSCORE-D Oct 16, 2021
29c5607
rename constants for providers
A-UNDERSCORE-D Oct 16, 2021
43c8607
update location text on every journal event
A-UNDERSCORE-D Oct 16, 2021
b119771
more deprecation warnings
A-UNDERSCORE-D Oct 16, 2021
74f8561
remove unused code
A-UNDERSCORE-D Oct 16, 2021
5b1e1aa
fix overlapping plugin directory text box
A-UNDERSCORE-D Oct 16, 2021
9fa7c47
didnt properly fix that
A-UNDERSCORE-D Oct 16, 2021
f97185c
Use a StringVar for statusbar messages
A-UNDERSCORE-D Oct 17, 2021
fb33d36
remove protocolhandler
A-UNDERSCORE-D Oct 18, 2021
9f99a28
add system and station text providers to arch file
A-UNDERSCORE-D Oct 18, 2021
ec44815
import cleanup
A-UNDERSCORE-D Oct 18, 2021
1547abc
added todo
A-UNDERSCORE-D Oct 28, 2021
cb3ebba
Added access to config
A-UNDERSCORE-D Oct 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ venv
htmlcov/
.ignored
.coverage
venv.old
35 changes: 5 additions & 30 deletions EDMCLogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,37 +484,12 @@ def munge_module_name(cls, frame_info: inspect.Traceback, module_name: str) -> s
file_name = pathlib.Path(frame_info.filename).expanduser()
plugin_dir = pathlib.Path(config.plugin_dir_path).expanduser()
internal_plugin_dir = pathlib.Path(config.internal_plugin_dir_path).expanduser()
# Find the first parent called 'plugins'
plugin_top = file_name
while plugin_top and plugin_top.name != '':
if plugin_top.parent.name == 'plugins':
break
if internal_plugin_dir in file_name.parents:
# its an internal plugin
return f'plugins.{".".join(file_name.relative_to(internal_plugin_dir).parent.parts)}'

plugin_top = plugin_top.parent

# Check we didn't walk up to the root/anchor
if plugin_top.name != '':
# Check we're still inside config.plugin_dir
if plugin_top.parent == plugin_dir:
# In case of deeper callers we need a range of the file_name
pt_len = len(plugin_top.parts)
name_path = '.'.join(file_name.parts[(pt_len - 1):-1])
module_name = f'<plugins>.{name_path}.{module_name}'

# Check we're still inside the installation folder.
elif file_name.parent == internal_plugin_dir:
# Is this a deeper caller ?
pt_len = len(plugin_top.parts)
name_path = '.'.join(file_name.parts[(pt_len - 1):-1])

# Pre-pend 'plugins.<plugin folder>.' to module
if name_path == '':
# No sub-folder involved so module_name is sufficient
module_name = f'plugins.{module_name}'

else:
# Sub-folder(s) involved, so include them
module_name = f'plugins.{name_path}.{module_name}'
elif plugin_dir in file_name.parents:
return f'<plugin>.{".".join(file_name.relative_to(plugin_dir).parent.parts)}'

return module_name

Expand Down
281 changes: 196 additions & 85 deletions EDMarketConnector.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def __init__(self, filename: Optional[str] = None) -> None:

self.respath_path = pathlib.Path(__file__).parent

self.internal_plugin_dir_path = self.respath_path / 'plugins'
self.internal_plugin_dir_path = self.respath_path / 'plugins2'
self.default_journal_dir_path = None # type: ignore
self.identifier = f'uk.org.marginal.{appname.lower()}' # TODO: Unused?

Expand Down
Loading