mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 08:17:13 +03:00
plug.py: reorder notify* functions
This commit is contained in:
parent
bd32b44903
commit
c08c1a574e
50
plug.py
50
plug.py
@ -273,6 +273,31 @@ def notify_journal_entry(cmdr, is_beta, system, station, entry, state):
|
||||
return error
|
||||
|
||||
|
||||
def notify_journal_entry_cqc(cmdr, is_beta, entry, state):
|
||||
"""
|
||||
Send a journal entry to each plugin.
|
||||
:param cmdr: The Cmdr name, or None if not yet known
|
||||
:param entry: The journal entry as a dictionary
|
||||
:param state: A dictionary containing info about the Cmdr, current ship and cargo
|
||||
:param is_beta: whether the player is in a Beta universe.
|
||||
:returns: Error message from the first plugin that returns one (if any)
|
||||
"""
|
||||
|
||||
error = None
|
||||
for plugin in PLUGINS:
|
||||
cqc_callback = plugin._get_func('journal_entry_cqc')
|
||||
if cqc_callback is not None and callable(cqc_callback):
|
||||
try:
|
||||
# Pass a copy of the journal entry in case the callee modifies it
|
||||
newerror = cqc_callback(cmdr, is_beta, copy.deepcopy(entry), copy.deepcopy(state))
|
||||
error = error or newerror
|
||||
|
||||
except Exception:
|
||||
logger.exception(f'Plugin "{plugin.name}" failed while handling CQC mode journal entry')
|
||||
|
||||
return error
|
||||
|
||||
|
||||
def notify_dashboard_entry(cmdr, is_beta, entry):
|
||||
"""
|
||||
Send a status entry to each plugin.
|
||||
@ -313,31 +338,6 @@ def notify_newdata(data, is_beta):
|
||||
return error
|
||||
|
||||
|
||||
def notify_journal_entry_cqc(cmdr, is_beta, entry, state):
|
||||
"""
|
||||
Send a journal entry to each plugin.
|
||||
:param cmdr: The Cmdr name, or None if not yet known
|
||||
:param entry: The journal entry as a dictionary
|
||||
:param state: A dictionary containing info about the Cmdr, current ship and cargo
|
||||
:param is_beta: whether the player is in a Beta universe.
|
||||
:returns: Error message from the first plugin that returns one (if any)
|
||||
"""
|
||||
|
||||
error = None
|
||||
for plugin in PLUGINS:
|
||||
cqc_callback = plugin._get_func('journal_entry_cqc')
|
||||
if cqc_callback is not None and callable(cqc_callback):
|
||||
try:
|
||||
# Pass a copy of the journal entry in case the callee modifies it
|
||||
newerror = cqc_callback(cmdr, is_beta, copy.deepcopy(entry), copy.deepcopy(state))
|
||||
error = error or newerror
|
||||
|
||||
except Exception:
|
||||
logger.exception(f'Plugin "{plugin.name}" failed while handling CQC mode journal entry')
|
||||
|
||||
return error
|
||||
|
||||
|
||||
def show_error(err):
|
||||
"""
|
||||
Display an error message in the status line of the main window.
|
||||
|
Loading…
x
Reference in New Issue
Block a user