Athanasius
6b9ec285fd
plug.py: Use x if x else y
not or
, & small type cleanup
2022-12-30 16:43:58 +00:00
Athanasius
74b070ffe9
Merge pull request #1773 from aussig/feature/847/capi-fleetcarrier
...
Feature/847/capi fleetcarrier
2022-12-30 16:15:37 +00:00
Athanasius
18833c5e36
plugins: Comment *why* the "load plugins that are packages" first is there
...
It's *NOT* that it will actually load the plugin *as* a package, as the code
explicitly only loads `load.py` still.
2022-12-26 19:48:38 +00:00
aussig
1c39ca5eb9
Merge branch 'develop' into feature/847/capi-fleetcarrier
2022-12-24 10:38:22 +00:00
Athanasius
5d1eb9e3b1
Fix "could be None" conditional for call to plug.notify_journal_entry()
...
In testing the *first* hit on this does have `monitor.cmdr` set, but neither
`monitor.system` or `monitor.station`. So:
1. Allow those to be `None` in the function signature,
2. Guard against only `monitor.cmdr` being falsey before the call.
3. Move the `if err:` to the same scope.
2022-12-24 10:11:11 +00:00
aussig
41962663d8
Merge branch 'develop' into feature/847/capi-fleetcarrier
2022-12-24 08:21:18 +00:00
Athanasius
37b054b3d3
Fix type of master
passed to plug.load_plugins()
2022-12-23 14:47:27 +00:00
Athanasius
71cbfb8358
plugins/edsm: Lots of type fixing, inc. conditionals where None is possible
2022-12-23 14:47:23 +00:00
Athanasius
f4b150960c
prefs.py & related files: Fix up mypy type checking
...
* Some trivial.
* As myNotebook.py's class is based on `ttk.Notebook`, typing changed to
that.
2022-12-23 14:47:21 +00:00
Athanasius
26b12f5b14
plugins/inara, plug.py: Minor typing fixes
2022-12-23 14:47:18 +00:00
aussig
9e17c46b25
Implement suggestions from PR #1773 .
2022-12-22 16:21:42 +00:00
aussig
8e5953408e
Handling of /fleetcarrier CAPI endpoint and implementation of plugin callback function
2022-12-21 23:00:35 +00:00
Athanasius
b6fe115ea7
CAPI: Add support for plugin cmdr_data_legacy()
...
* Renames `plug.notify_newdata()` to the more precise `notify_capidata()`.
* If CAPI data was from SERVER_LEGACY, then use plugin `cmdr_data_legacy()`
instead of `cmdr_data()`.
2022-12-08 11:17:52 +00:00
Athanasius
a0c73a5c71
plug.py: flake8 & mypy pass
2022-12-03 14:48:50 +00:00
Athanasius
1f21c7fae4
plug.py: Only type annotation coverage to go in flake8
2022-12-03 14:10:09 +00:00
Athanasius
3247fb805c
plug.py: Further docstring fixes
2022-12-03 14:05:59 +00:00
Athanasius
413b2f06f8
plug.py: Some docstrings, change to plugin loading
...
* Plugin loading: Avoid using .format()
2022-12-03 14:03:47 +00:00
Athanasius
c8081f339a
plug.py: Use logger.trace_if(...)
2021-08-13 15:14:02 +01:00
c08c1a574e
plug.py: reorder notify* functions
2021-08-11 13:55:46 +03:00
ba38b5f02d
plug.py: more verbose log message on failed while handling CQC mode journal entry
2021-08-10 16:16:01 +03:00
7b39b0fda0
plug.py: use copy.deepcopy() instead of dict() in cqc_callback
...
To create deepcopy for passing data to cqc_callback
2021-08-10 15:55:14 +03:00
030713f5b9
plug.py: rename journal_entry to cqc_callback in notify_journal_entry_cqc
2021-08-10 13:55:10 +03:00
6e2f49a63c
plug.py: remove useless 'as e' in notify_journal_entry_cqc
2021-08-10 13:51:22 +03:00
3283439485
Code style fixes
2021-08-10 03:00:36 +03:00
84500b775a
More paranoia about is journal_entry_cqc callable
...
Co-authored-by: A_D <A-UNDERSCORE-D@users.noreply.github.com>
2021-08-10 02:52:39 +03:00
27fe43bf8c
WIP: implement journal_entry_cqc()
...
journal_entry_cqc function in plugin's api allow plugins to recieve
journal events when player are in CQC
2021-08-09 04:37:23 +03:00
A_D
fe90f1f0b3
Cleaned up imports, removed incase imports
...
closes EDCD/EDMarketConnector#569
2021-05-28 14:46:51 +02:00
Athanasius
bc6557dd9c
Quieten various TRACE log output.
...
* A lot of this is commented out. It might be useful in the future, but
is just too noisy for now.
* Changed the protocol webserver to info, as it is.
* Left the EDSM 'not 1XX, 2XX or 5XX' in as it's a warning, so 'pass's
on the conditional bodies that would be empty now trace's are
commented.
2021-04-12 08:31:47 +01:00
Athanasius
dda5a86f3d
Move Status.json flags into data.py
...
These aren't used by any core code, but at least one plugin uses one.
2021-04-12 08:31:46 +01:00
A_D
051245cf90
Renamed various config values to be backwards compatible
2021-04-01 14:45:48 +01:00
Athanasius
a8aab186bf
config: Update some 'callers' of config.shutting_down for it being a property
2021-04-01 14:45:48 +01:00
Athanasius
719a58cbe9
plug.py: Avoid Tk event_generate() call from show_error() if in shutdown
...
# Conflicts:
# plug.py
2021-04-01 14:45:48 +01:00
A_D
00629b7420
use _str versions of paths for string ops
2021-04-01 14:45:48 +01:00
Athanasius
462cd25312
config: Make config.shutting_down() a property, and change 'callers'
2021-01-11 16:54:09 +00:00
Athanasius
5175136419
plug.py: Avoid Tk event_generate() call from show_error() if in shutdown
2021-01-11 15:49:08 +00:00
Athanasius
90ddd4e1e3
plugins: Log plugin names as we ask them to stop, and when we're done with them all
...
This should point the finger at any plugin(s) that aren't stopping
properly. Well, at least those that are hanging *in* their
`plugin_stop()`.
2021-01-08 14:56:22 +00:00
Athanasius
1aba1a0596
Trace: Change several calls from debug to trace.
2020-09-23 22:07:18 +01:00
Athanasius
85d45aadd7
Place detailed logging for "Location" events.
...
To try and track down what's happening with #713
2020-09-23 11:45:48 +01:00
Athanasius
7750bbdf4a
Move GUI/CLI conditional into get_plugin_logger()
...
It's cleaner here than in the calling plug.py code.
2020-09-22 16:09:39 +01:00
Athanasius
3759f2f0f2
Use appropriate base logger name for plugins.
2020-09-22 15:48:09 +01:00
Athanasius
a883eb29b2
plug.py, prefs.py: Use get_main_logger()
2020-09-22 15:44:16 +01:00
Athanasius
09add21a1a
Logging: DEBUG always to rotated files, configured level to stdout/err
...
* EDMCLogging.Logger.get_streamhandler() method to get the
logger_channel so prefs.py can call setLevel() on it.
* The top-level Logger level is always DEBUG.
* The RotatingFileHandler level is always DEBUG.
* The StreamHandler level is as configured by the user.
* EDMCLogging now creates a singleton of EDMCLogging.Logger and its
associated Logger.
* plug.py tweaked to only import EDMCLogging where it's needed for
getting/creating plugin loggers, else `import logging`.
2020-09-08 10:03:16 +01:00
Athanasius
e572395718
LoggerAdapter can't change anything but %(message)s
2020-07-31 14:46:38 +01:00
Athanasius
04c4f5e683
Using a LoggerAdapter to prepend a string.
...
1. This makes setting up logging everywhere slightly more involved.
2. If I then want to change, say, %(module)s value I'll end up needing
to stack walk again.
So this might be better done in a filter. But these commits for the
record, and to come back to if needs be.
2020-07-31 14:46:38 +01:00
Athanasius
898ff9fbb2
Logging: Make correct loggers for 'found' plugins
...
* Log messages propagate up Parent.Child chains, so we don't need a
channel on the plugin logger.
* But it still needs the filter to define qualname and class for
formatting.
2020-07-31 14:46:38 +01:00
Athanasius
19e750eddd
Use logger.exception() not log.error(.., exc_info=..)
2020-07-27 10:47:57 +01:00
Athanasius
d7c2372417
Flake8 cleanup round #2
2020-07-27 10:14:16 +01:00
Athanasius
f9a23cc831
Clean up flake8 output for this branch
2020-07-27 09:37:10 +01:00
Athanasius
2e58d106bd
logging.getLogger(appname) instead of import from EDMarketConnector
...
Using:
from EDMarketConnector import logger
causes issues if EDMarketConnector is already importing 'this' file.
So just get a logger using logger.getLogger(appname) instead.
`from config import appname` if needs be.
2020-07-27 06:57:52 +01:00
Athanasius
818bd89fd7
Remove un-necessary {__class__} from logging messages
2020-07-27 06:57:52 +01:00