1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

61 Commits

Author SHA1 Message Date
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
Jonathan Harris
c8f25730ae Add functions to enumerate and invoke a function on a named plugin 2018-04-02 23:01:47 +01:00
Jonathan Harris
f42d5d7af6 plugin_app() can return None
so it can be used as a callback after the main window and all other plugins are initialised.
2018-04-02 13:03:39 +01:00
Jonathan Harris
0b0ac162e1 Add dashboard constants 2018-02-27 19:47:54 +00:00
Jonathan Harris
75edff5fc3 Rename plugin callback to dashboard_entry 2018-01-30 00:11:49 +00:00
Jonathan Harris
a081b6b637 Monitor player status, and call new "status" plugin callback 2018-01-29 01:36:14 +00:00
Jonathan Harris
e3323f8f6f Drop support for interaction log 2017-11-24 08:59:50 +00:00
Jonathan Harris
190d9c6bd3 Rewrite '.' in plugin name as '_'
Fixes #254
2017-10-16 14:40:19 +01:00
Jonathan Harris
929bd82684 Allow executable and plugins to be run from non-ASCII paths
Fixes #234
2017-08-19 16:03:39 +01:00
Jonathan Harris
a2ce9da44e Revert "Don't generate .pyc/.pyo files for plugins"
since this breaks __file__ for the plugin. Document removal of .pyc/.pyo files instead.

Reverts b8d252a.
2017-08-17 10:11:55 +01:00
Jonathan Harris
b8d252ae25 Don't generate .pyc/.pyo files for plugins 2017-08-16 19:27:40 +01:00
Jonathan Harris
b206015eef Put plugins and strings in their own folders in packaged app
Load plugins with name 'plugin_*' in order to not pollute the global namespace.

Addresses #230
2017-08-16 14:36:12 +01:00
Jonathan Harris
5e5ac2db31 Log plugin's load path
Fixes #232
2017-08-16 14:06:16 +01:00
Jonathan Harris
8bc117ff32 Allow plugins to show error in status area asynchronously 2017-08-13 18:34:23 +01:00
Jonathan Harris
91ee6f3722 Notify plugins on program closing 2017-08-13 18:34:23 +01:00
Jonathan Harris
c8ff0a9701 Continue to call plugin callbacks if earlier one fails 2017-08-13 15:21:02 +01:00
Jonathan Harris
d223770af8 Add plugins' folders to sys.path again.
Was broken by 084128e.
2017-08-02 09:05:31 +01:00
Jonathan Harris
60ad3b4c09 Inform plugins of Cmdr and Beta status
Notify plugins when Cmdr or Beta status changes while the preferences dialog
is open.

Display a note on the Credentials tab when Cmdr is not set. Addresses #224
2017-07-29 15:36:43 +01:00
Jonathan Harris
084128e797 Add support for internal plugins
Settings tab shows current plugins.
2017-07-29 14:41:59 +01:00