Commit Graph
2156 Commits
Author SHA1 Message Date
Athanasius 14d1a0ad5e companion.py: Re-format next(...) to be more obvious. 2020-09-15 17:30:23 +01:00
Athanasius ed52528718 companion.py: Slight tweaks from running mypy
NB: Using `mypy --follow-imports skip` for now to limit how much it
checks each time.
2020-09-15 16:15:13 +01:00
Athanasius c311957eff companion.py: import requests does belong down there. 2020-09-15 15:49:28 +01:00
Athanasius 55fcfbeb17 companion.py: Further PyCharm-prompted cleanup.
* Correct use of error[0] to just error.
* We don't want methods not referencing self to be static in this case,
  so annotate them.
* Take suggestion of "if v == []:" equivalent to "if not v:".
* Preserve CAPIData typing throughout filter_ship().
2020-09-15 15:33:00 +01:00
Athanasius 4575353923 companion.py: CAPIData type & PyCharm-prompted cleanup.
* CAPI Data really is just a Dict.  Define a custom type so it could
  easily be a class in future with minimal edits.
* Auth.refresh() *can* also return a str (Access Token).
* Catch specific (but still quite loose) exceptions in Auth.refresh().
* Set self.server in Session.__init__.
* Remove some extraneous () on conditionals.
2020-09-15 15:00:22 +01:00
Athanasius da2a582c46 companion.py: Use custom type for CAPI Data.
This way if we get more stringent about it (could be a class) we don't
need to edit all the references.
2020-09-15 14:35:37 +01:00
Athanasius c12c739c11 companion.py: Full pass to 100% pass flake8
* docstrings added throughout.
* .format() all now f-strings.
* Type annotations added throughout.
* White space tweaked.
2020-09-15 14:15:07 +01:00
Athanasius faf4906eea Merge pull request #701 from EDCD/fix/671-no-modules
Fix the detection of no modules being available at a station, so is_horizons() doesn't blindly modules.values().
2020-09-14 16:16:39 +01:00
Athanasius c7f8b3dada Translations: Fix erroneous newline in a RU string 2020-09-14 15:44:03 +01:00
Athanasius 62851bfe3b Merge pull request #702 from EDCD/feature/tk-dir-dialog
Use tkinter.filedialog on win32, because we now fix locale encoding
2020-09-14 15:43:49 +01:00
Athanasius 31203270bc Switch to "thing is None" on tests. 2020-09-14 15:43:15 +01:00
Athanasius 52dcd3b28a Use tkinter.filedialog on win32, because we now fix locale encoding
tkinter ends up calling something where utf8 characters won't work
because of the windows encoding, e.g. cp1252.

We can't set encoding just for the dialogs, as it's not thread safe.  So
we'll just set it at startup instead.  Utilising:

	locale.setlocale(locale.LC_ALL, '')

to get things set up initially, so we can properly retrieve the language
to go with the encoding on the subsequent setlocale() call.
2020-09-14 15:16:26 +01:00
Athanasius 735e37e10e Revert is_horizons to modules: MAP_STR_ANY as it works 2020-09-14 13:32:06 +01:00
Athanasius d45070c249 plugins/eddn: Tweak ships/modules in export of shipyard and outfitting from CAPI
There are cases where a station/FC doesn't have outfitting modules or a
ships list.  Let's make the checks happen in both those functions and be
extra paranoid with some logging.

Closes #671
2020-09-14 13:26:20 +01:00
Athanasius 44353b668e Update translations.
I meant to do this for 4.1.0-beta4, so let's try and make sure it's in
the next (pre-)release.
2020-09-11 16:48:20 +01:00
Athanasius 13f7ccc87a Pre-Release 4.1.0-beta4 Release/4.1.0-beta4 2020-09-11 14:28:25 +01:00
Athanasius 057a95f5fd Merge pull request #696 from EDCD/fix/edmc-eddn-import
Fix/edmc eddn import
2020-09-11 14:21:16 +01:00
Athanasius 3556808606 Remove flake8-pep3101, we're using flake8-use-fstrings instead 2020-09-11 14:18:44 +01:00
Athanasius 5effee0d67 Merge pull request #695 from EDCD/enhancement/515-ui-scaling
Scale versus the startup default value.
2020-09-11 14:16:18 +01:00
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 cd24db88a9 UI Scaling: Size the Scale bar as per our startup value
If we use the last configured value then the width of the Scale bar
changes as per the user's last setting, even though they might not have
yet restarted for all the rest of the UI to resize.
2020-09-11 11:14:19 +01:00
Athanasius 5f759ee2d3 UI Scaling: Update translation now that 100 is default. 2020-09-11 09:29:00 +01:00
Athanasius 0a5bbad55b UI Scaling: Change our %age scaling to be relative to base tk-scaling
So if at startup tk-scaling is 1.33 then a user configured 200(%) will
set it to 2.66 for this run.

* Low end of scale bar set to 10, not 0, because now 0 makes absolutely
  no sense.
* In theory the width of the scale bar, in pixels, is now also correctly
  scaled.
2020-09-11 09:26:01 +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