1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-22 03:40:46 +03:00

2134 Commits

Author SHA1 Message Date
Athanasius
17e65ae411 Update flake8/isort/etc versions.
Using older versions meant isort didn't pay attention to control
comments for the fixes in EDMC.py.
2020-09-11 14:10:56 +01:00
Athanasius
f73a372e6b EDMC.py: Correct import eddn position, with isort comments
isort thinks this is a STDLIB import, when it's actually from the
plugins directory.  So add comments to stop isort from re-ordering it.
2020-09-11 14:09:47 +01:00
Athanasius
4d3f9264f2 PLUGINS.md: Correct example to 'tkinter' not 'Tkinter'. 2020-09-10 18:31:09 +01:00
Athanasius
1c62cfaf4a
Merge pull request #694 from EDCD/enhancement/locale-logging-and-in-issue
Log locale settings at start & ask in bug template.
2020-09-10 17:58:10 +01:00
Athanasius
575acb3006 Log locale settings at start & ask in bug template. 2020-09-10 17:52:08 +01:00
Athanasius
1b226f8e08 Pre-Release 4.1.0-beta3 Release/4.1.0-beta3 2020-09-10 17:21:30 +01:00
Athanasius
95100ad586
Merge pull request #693 from EDCD/enhancement/515-ui-scaling
Change UI tk.Scale() to use integers to avoid locale issues.
2020-09-10 17:11:50 +01:00
Athanasius
f2ab8f0fd1 UI Scaling: Switch to using integers to avoid tk bug
Using a Tk.DoubleVar() with a locale where a comma is used as the
decimals separator leads to internal tk code recording values with the
comma but then other tk code not accepting that back, so it always
thinks the value is zero and the scale slider can't be moved.

Ref: https://stackoverflow.com/questions/45289237/tkinter-scale-slider-with-float-values-doesnt-work-with-locale-of-language-that

* Change to storing as a REG_DWORD under 'ui_scale' not 'ui_scaling'.
* Change all the code, except the call to *set* the tk scaling to use an
  integer, with 100 = 100%, i.e. equivalent to the old 1.0.
* Update strings slightly, so translations will need updating too.

NB: The theme.default_ui_scale value for plugin authors to query is
still the float that tk returns.
2020-09-10 16:54:14 +01:00
Athanasius
174e169469 UI Scaling: Add text stating changes require a restart.
Also updates the translation text.
2020-09-10 16:35:59 +01:00
Athanasius
b4d7d56222 Startup: Log application and Python version, extra in debug.
* appversion and sys.version logged at INFO.
* At DEBUG: platform, argv[0], exec_prefix, executable, sys.path
2020-09-10 10:14:58 +01:00
Athanasius
b162747e6e
Merge pull request #691 from A-UNDERSCORE-D/enhancement/add-flake8-plugins
Add more flake8 plugins
2020-09-10 09:34:47 +01:00
A_D
ee12b2073c
fixed some sentence construction 2020-09-09 23:23:15 +02:00
A_D
009ded50a1
Ensured PRs dont fail on doc lints 2020-09-09 23:05:59 +02:00
Athanasius
1446796eb8 UI Scaling: Store pre-fiddling default in theme.default_ui_scale
This is in case anything needs to know the ratio between what was the
default and what we then set it to.
2020-09-09 16:18:23 +01:00
A_D
054c2a09c7
Added noqa, docstring, and fstring linters
Additionally this removed one linter that was for preferring .format to
modulo formatting, as the new fstring linter does both
2020-09-09 17:13:13 +02:00
A_D
b50ed893ae
Cleaned up and updated Contributing docs 2020-09-09 17:12:44 +02:00
Athanasius
c5518cf763 Pre-release 4.1.0-beta2 Release/4.1.0-beta2 2020-09-09 15:31:42 +01:00
Athanasius
06b8661c91
Merge pull request #690 from EDCD/fix/console-redirect
Logging: Move stdout/stderr redirect to before `logging` can be run
2020-09-09 15:29:41 +01:00
Athanasius
f25c743d14 Logging: Move stdout/stderr redirect to before logging can be run
If anything does `import logging` it's likely to grab a copy of
sys.stderr before we redirect it meaning things aren't properly
redirected when we start logging.

So put the redirect as early as possible in EDMarketConnector.py.

This will need a test implemented to be sure it's not accidentally
broken by addition of an import before this.
2020-09-09 15:26:08 +01:00
Athanasius
82fc3cad65
Merge pull request #689 from EDCD/fix/eddn-missing-systemaddress
Fix/eddn missing systemaddress
2020-09-09 14:46:10 +01:00
Athanasius
99bac688af eddn: Tweak replay.jsonl try/except flow
* Catch OSError instead of Exception (which is *too* general).
* Put the set of self.replaylog in try/else so it only runs when there
  are no errors.
2020-09-09 14:36:38 +01:00
Athanasius
5e35012611 eddn: flake8 cleanups
* That "EDDN send failed" was too long, so now it's '''-formatted.
* journal_entry() cognitive complexity isn't changing any time soon.
2020-09-09 14:17:39 +01:00
Athanasius
48077f6a30 eddn: Straighten out replay.jsonl opening & minor cleanups.
* The logic for opening replay.jsonl, and detecting if the file was
  already there or not was tortured.  No longer.
* Changed a few logger.debug(..., exc_info=) to logger.exception().
* Changed all logger.warn() (deprecated) to logger.warning().
2020-09-09 14:03:40 +01:00
Athanasius
5d612822da eddn: Tweak the extra EDDN failed message logging format.
It's more readable with \n between each part, and added a prefix.
2020-09-09 13:51:15 +01:00
Athanasius
f7e516c702 L10/en.template: Add 'Log Level' 2020-09-09 13:43:45 +01:00
Athanasius
e2cf050e63
Merge pull request #687 from EDCD/enhancement/515-ui-scaling
Enhancement/515 ui scaling
2020-09-09 13:39:27 +01:00
Athanasius
6484540263 UI Scaling: Add new strings to translation template 2020-09-09 13:35:05 +01:00
Athanasius
94607bf55f UI Scaling: Use a tk.Scale instead, allowing for finer grained setting.
* NB: Windows Registry has no type for 'Float', so we use a string.
* We now store '0.0' to mean 'default'.
2020-09-09 13:31:36 +01:00
Athanasius
62d5e3c1c9
Merge pull request #680 from EDCD/feature/more-companion-logging
companion.py: Add more logging to better trace auth/CAPI flow
2020-09-08 18:53:30 +01:00
Athanasius
5c3b8b9927 compnanion.py: Add more logging to better trace auth/CAPI flow 2020-09-08 18:52:03 +01:00
Athanasius
e693af1283 EDDN: Log the message we tried to send if it fails. 2020-09-08 18:51:17 +01:00
Athanasius
957d11c84b prefs.py: Minor comment format change 2020-09-08 13:16:07 +01:00
Athanasius
1850354b8d UI Scaling: Implement a 'default' option
* If no ui_scaling yet set, set it to 'default'.
* 'default' added to dropdown choices.

Note that you still need an application restart for this to take effect.
2020-09-08 12:27:57 +01:00
Athanasius
ea53a60596 UI Scaling: Option added to Appearance tab of Settings 2020-09-08 12:18:48 +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
45b8d5f164 Logging: Always have the rotated logfiles at DEBUG level 2020-09-08 09:15:43 +01:00
Athanasius
717253e7fa setup.py: Add 'dataclasses' and 'timeout_session'
These are needed for latest inara.py plugin code.
Release/4.1.0-beta1
2020-09-07 18:02:06 +01:00
Athanasius
58139a4348 Pre-release 4.1.0-beta1
This *should* be functionally equivalent to 4.0.6, but with the addition
of proper logging.  There's a chance some of the per-file code cleanups
might have inadvertently introduced bugs.
2020-09-07 17:38:55 +01:00
Athanasius
cd0d0f9e08 PLUGINS.md: Update for logging now being available 2020-09-07 17:38:15 +01:00
Athanasius
05971ab4c3
Merge pull request #685 from EDCD/enhancement/logging-rotating-archive
Enhancement/logging rotating archive
2020-09-07 16:56:25 +01:00
Athanasius
55fe4f37b8 EDMC: Blank line on scope change 2020-09-07 16:54:08 +01:00
Athanasius
f85371ac99 EDMCLogging: flake8 cleanup
* import order.
* Sanitise RotatingFileHandler() call formatting.
2020-09-07 15:09:11 +01:00
Athanasius
30c9dbefc1 EDMC.py: General flake8 cleanup.
* Fix f-strings that are just plain strings.
* Sort imports.
* noqa E501 lines I want that long.
* And misc other minor cleanups.
2020-09-07 15:06:15 +01:00
Athanasius
dde1eb911e EDMCLogging: Misc cleanups 2020-09-07 14:50:12 +01:00
Athanasius
d940357854 EDMarketConnector.py: Blank line at the end. 2020-09-07 14:44:09 +01:00
Athanasius
117c65c4db Logging: Use cleaner pathlib.mkdir() 2020-09-07 14:42:51 +01:00
Athanasius
10c3fec4f8 Logging: Set configured loglevel on creation 2020-09-07 14:40:55 +01:00
Athanasius
c3fbd1164e Logging: Implement additional logging to rotated set of files.
* All logging duplicated into %TEMP%/{appname}/{logger_name}.log
* These are handled by the RotatingFileHandler, currently set to 1MiB
  per file and 10 backup files.
* Do *NOT* setLevel() on the handlers, as we want to control the level
  up at the logger instead.  This would have caused the CL and GUI
  selection of loglevel to NOT have any effect (hidden by default having
  been DEBUG).
* EDMarketConnector.py now INFO logs its startup and exit.
2020-09-07 14:17:49 +01:00
Athanasius
faeb579be6 EDMC: Corrections to logging
* Use appcmdname as the logger name so it looks different from the GUI
  version.  This also causes a different log filename in the rotated log
  set.
* Log at DEBUG for Startup and Exiting.  Which means replacing all of
  the `sys.exit(EXIT_SUCCESS)` with `return` so we can log the Exit
  after `main()` returns and then `sys.exit(EXIT_SUCCESS)` there.
2020-09-07 14:10:27 +01:00
Athanasius
5c9c9e2056 Logging: Default loglevel now INFO
We have EDMC CL arg and GUI selection of loglevel now, stored in
settings, so default can be INFO.
2020-09-07 13:14:20 +01:00