Commit Graph
79 Commits
Author SHA1 Message Date
norohind c08c1a574e plug.py: reorder notify* functions 2021-08-11 13:55:46 +03:00
norohind ba38b5f02d plug.py: more verbose log message on failed while handling CQC mode journal entry 2021-08-10 16:16:01 +03:00
norohind 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
norohind 030713f5b9 plug.py: rename journal_entry to cqc_callback in notify_journal_entry_cqc 2021-08-10 13:55:10 +03:00
norohind 6e2f49a63c plug.py: remove useless 'as e' in notify_journal_entry_cqc 2021-08-10 13:51:22 +03:00
norohind 3283439485 Code style fixes 2021-08-10 03:00:36 +03:00
norohindandA_D 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
norohind 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
Athanasius 2e12513c6c Changes plug.py to proper logging.
This relies on the logger.Formatter setup to fill in function name
rather than calling out exactly why we're logging.  It should be
obvious, i.e. if you're in plug.py:notify_journal_entry then the named
plugin threw an un-caught exception trying to call its method for this.
2020-07-27 06:57:52 +01:00
Athanasius 076eab9e22 sort internal plugins before loading
This is already done for 'found' plugins, so let's avoid any potnetial
future surprise with the internal ones as well.

close #589
2020-07-12 15:50:49 +01:00
Bernd Gollesch 77a2a1b533 Use the after method of root to open the messagebox inside the mainloop (fixes #522). 2020-06-21 22:05:12 +02:00
Athanasius 558392d21b Move "plugins need migrating" popup to plug.py
Where it was in EDMarketConnector.py caused issues because then the
main thread was blocking on the popup when other threads expected it to
be running:

---------------------------------------------------------------------
Exception in thread Journal worker:
Traceback (most recent call last):
  File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Athan\Documents\Devel\EDMarketConnector-python3\monitor.py", line 273, in worker
    self.root.event_generate('<<JournalEvent>>', when="tail")
  File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1673, in event_generate
    self.tk.call(args)
RuntimeError: main thread is not in main loop
---------------------------------------------------------------------

However *now* it pops up before the main UI is running properly at all,
so the EDMC window is likely out of position, and won't be
painted/themed yet.
  This is deemed acceptable for a 'once a day at most' popup.

  The popup title now has 'EDMC: ' at the start to be sure users know
what it's talking about.
  It also has some brief advice about how to disable a plugin.
2020-06-21 17:14:16 +01:00
Athanasius 3178ad1b6f Remove dangling 'imp.release_lock()' that's no longer required 2020-06-21 16:58:50 +01:00
Athanasius 259bb3bbd6 Merge branch 'release-final-python27' into python3 2020-06-21 16:43:02 +01:00
Jonathan Harris c62d110448 Plugin migration 2020-06-21 16:33:13 +01:00
Athanasius 90b05d22c5 Now runs without console errors so far as pressing 'Update' is concerned.
There's an error on the console about an iterator when doing so
though.
2020-06-21 16:23:00 +01:00
Athanasius d0ae621387 Running EDMarketConnector.py 'works'.
First pass utilising 'futurize' to do most of the work.

  There's an issue with ur'\"' in l10n.py which I'm not sure how to
properly fix.

  This now has errors when hitting the 'Update' button.
2020-06-21 16:23:00 +01:00
Athanasius d3abb6fa1f Detect plugins without Python 3.x support and warn user.
To allow users to sort out their plugins before EDMC itself moves to
Python 3.x warn them if any of their enabled, non-stock, plugins do not
have a plugin_start3() method.

  * If any are found without support there's a popup triggered at the
    end of AppWindow initialisation.
  * Then the user can check Settings > Plugins to see a list of the
    plugins without Python 3.x support.
2020-06-18 19:40:46 +01:00
Jonathan Harris f6a8e67e90 Add more dashboard flags 2019-08-09 20:04:22 +01:00
Jonathan Harris 737b3b5b70 Fix new flags 2018-11-22 23:09:51 +00:00
Jonathan Harris 00762b8cb0 Add Status flags and GuiFocus constants new in 3.3 2018-11-22 10:28:22 +00:00
Jonathan Harris e6a88e7225 Document turret flags 2018-10-30 19:35:27 +00:00
Jonathan Harris b8a7d143d4 Pass plugin's folder to plugin_start() 2018-08-09 00:47:28 +01:00
Jonathan Harris 63eb128934 Don't try to load files in the plugin folder as plugins
Fixes #325
2018-05-27 15:46:56 +01:00
Jonathan Harris fa3cf23c09 Load any plugins that are also packages first
Addresses #313
2018-04-26 18:53:29 +01:00
Jonathan Harris 9ed8a9200c Fix plugin widgets' layout
Fixes #311
2018-04-07 09:57:45 +01:00