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

314 Commits

Author SHA1 Message Date
Athanasius
19e750eddd Use logger.exception() not log.error(.., exc_info=..) 2020-07-27 10:47:57 +01:00
Athanasius
6c9139e395 TODO: unittest hint about testing logging
And comment out the use of it here.
2020-07-27 10:35:08 +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
307910739a Remove now un-necessary imports for logging/traceback 2020-07-27 06:57:53 +01:00
Athanasius
66e2c354c7 Documentation update and getLogger() -> get_logger()
* Technically %(class)s can be e.g. A.B not just 'B' so say "name(s)".
* To not confuse EDMCLogging.getLogger() with logging.getLogger() it's
 been renamed to get_logger().
* Note how we signal errors with finding class and/or qualname.
* Call out EDMCLogging.py in Contributing.md.
2020-07-27 06:57:53 +01:00
Athanasius
596527bda2 Move logging setup to EDMCLogging.py with a class
* Also now providers single caller_class_and_qualname() method to get
 both strings, returned as a Tuple[str, str].  Either could be empty
 if something went wrong.
* Rather than a fragile 'skip' this now:
    1. Looks for the first up-stack frame with self of logging.Logger
    1. Then looks for the next up-stack frame with self NOT of
     logging.Logger.  This should be the call site we want.
2020-07-27 06:57:53 +01:00
Athanasius
c196a38e09 Add logging TODOs. logger creation & frame detection
* Nothing should "from EDMarketConnector import logger" any more, so
 we can move this back inside __main__ section
* We shouldn't rely on a magic number of frames to skip.  Detect the
 proper frame automatically.
2020-07-27 06:57:52 +01:00
Athanasius
2176187be7 Fix typos in class/qualname finders 2020-07-27 06:57:52 +01:00
Athanasius
4d7f81cec1 Add emergency print()s if we can't find class/qualname 2020-07-27 06:57:52 +01:00
Athanasius
89cadbc0eb Add paranoia checks to class and qualname finders 2020-07-27 06:57:52 +01:00
Athanasius
5af87a5b98 Clean up EDMarketConnector.py after that qualname testing 2020-07-27 06:57:52 +01:00
Athanasius
6b9d4a11cb Use a logging.Filter to implement %(qualname)s in formatting.
This gets the function that called the logging, and if it's in a class
it looks up the function via getattr(<class>, <func name>) and then
uses __qualname__ to quickly get the fully qualified name.
2020-07-27 06:57:52 +01:00
Athanasius
debc7f97d3 Use a logging.Filter to implement %(class)s in formatting. 2020-07-27 06:57:52 +01:00
Athanasius
23b167fe66 Change startup version back to a print()
This is so early it doesn't need to be a spammy log message.
2020-07-27 06:57:27 +01:00
Athanasius
fe0ff2498e Moves logger definition so it's import'able 2020-07-27 06:57:23 +01:00
Athanasius
c971106c0e Convert print()s to logging & refactor help_about -> HelpAbout 2020-07-27 06:57:23 +01:00
Athanasius
cd4216d19c logger setup and initialisation
* Initial printing of version is now a logger.info(...)
2020-07-26 23:16:52 +01:00
Athanasius
e1752506c5 Move "only run once" code into def enforce_single_instance() 2020-07-26 23:16:52 +01:00
A_D
99014dd970 Added a config to use the new file based shipyard
This also reverts commenting out the old solution for long URLs
2020-07-23 14:36:02 +01:00
A_D
b818922193 Fixed issues with super long links for shipyards
This works by creating a temp file at config.app_dir and storing the
link in there, followed by directing the local browser to open the file.

HTML meta tags are then used to direct the browser to refresh to a URL
of our choosing (which is HTML escaped, just in case someone tries
something clever)

This should work everywhere, and on any browser (as the file:// format
is defined at https://tools.ietf.org/html/rfc1738 which was posted in
1994).

The URI used (`file://localhost/path`) ensures that we only ever
ask for a localhost file at our path.

The HTML format should be completely compliant with all major browsers
as well, ensuring that behaviour is consistent (assuming they support
HTML meta tags)
2020-07-23 14:36:02 +01:00
Athanasius
4435bb004a Technically could still be frozen with darwin and thus non-Win Sparkle 2020-07-19 11:45:07 +01:00
Athanasius
35f573bc14 Updater class now used for all updates checking
* Updater.__init__() now takes 'provider' argument to specify if we use
 the internal checking code, or the available external code.
* EDMC.py changed to utilise this with internal provider.
* EDMarketConnector.py changed to use internal provider if not frozen,
 else the internal provider.
* Corrected the darwin/MacOS toggling of auto updates checking to actually
 use the Sparkle, not WinSparkle, API call.
* Updater.check_appcast() does the internal checking:
    * class EDMCVersion to hold the information.
    * Returns None on any error, or if it didn't find a newer version.
    * Returns an EDMCVersion object if it found a newer version.
2020-07-19 11:45:07 +01:00
Athanasius
cba673ae12 Correct 'compoun' to 'compound' in 'Release Notes' URL code 2020-07-19 11:45:07 +01:00
Athanasius
66a63597f1 Use appversion_nobuild in 'Release Notes' URL 2020-07-19 11:45:06 +01:00
Athanasius
c1221fb6fc Change 'Release Notes' URL to use 'Release/A.B.C.D' tag form
Closes #544
2020-07-01 17:11:23 +01:00
Athanasius
38593058f4 Use translations of some words in Python 3.x popup text
'File', 'Settings' and 'Plugins' are defined to have translations for
the menus/tabs texts, so use them.
2020-07-01 15:55:37 +01:00
Athanasius
821111284e Add translations for python 3.x warning popup 2020-07-01 15:55:37 +01:00
Athanasius
314fc7082d Implements 'Help > About' menu item
* Re-uses the 'About {APP}' that was defined because the MacOS version
   always had an 'About' bit.
 * As a side effect of wanting the copyright string in the popup this is
   now defined in config.py, and setup.py has been adjusted to also take
   it from there.
 * The About popup includes a link to the release notes, contingent on
   the git tag existing on github.
 * Only one instance of the popup is allowed at once.
 * There's still a 'TODO' for moving 'Check for updates' into this
   popup.

Addresses issue #509
2020-07-01 15:44:20 +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
b829c1bbd1 Remove the 'plugins not py 3.x' warning popup from EDMarketConnector.py
This *was* moved to plug.py, and it executing there prevents this
version from actually causing a popup, but it doesn't belong here.
2020-06-21 20:15:33 +01: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
8690f1bb83 Fix old style 'print ' statements 2020-06-21 16:58:21 +01:00
Athanasius
a40b0e33ca 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-21 16:57:37 +01:00
Athanasius
259bb3bbd6 Merge branch 'release-final-python27' into python3 2020-06-21 16:43:02 +01:00
Jonathan Harris
3fe4454888 Fix for DDE registration 2020-06-21 16:32:09 +01:00
Jonathan Harris
d71e3445c7 Allow Windows executable to be invoked from any cwd 2020-06-21 16:31:42 +01:00
Jonathan Harris
3c46e8d5fa All executable files invoked with #!/usr/bin/env python3 2020-06-21 16:28:30 +01:00
Jonathan Harris
a2ea9e014c Change ttk import for consistency 2020-06-21 16:28:30 +01:00
Athanasius
937cd990c6 exe: Removes the previous un-setting of TCL_LIBRARY
This is what was causing py2exe 0.9.3.2's fix for 'import tkinter' to
then fail on .exe run due to unset TCL_LIBRARY.
2020-06-21 16:23:02 +01:00
Athanasius
6adb64913e Revert "Switches to .format() for startup code."
This reverts commit 11194c1374e4e325b523e6a348503dd0bc0d1a6b.
2020-06-21 16:23:00 +01:00
Athanasius
83e925325e EDMarketConnector.py: De-future 2020-06-21 16:23:00 +01:00
Athanasius
868a294b6b Switches to .format() for startup code. 2020-06-21 16:23:00 +01:00
Athanasius
8237a94f72 Fixes __debug__ dump/ file writing.
Similarly to the 'Save Raw Data' fix in 9ccca42b31102fd713b26a7a8223472d364772ab
2020-06-21 16:23:00 +01:00
Athanasius
a56c48437b Fixes File > 'Save Raw Data'
Another str versus bytes issue.  We *do* need the .encode('utf-8') in
this case, else it will assume Windows cp1252 encoding which then can't
encode some characters.  So we switch to binary file mode instead.
2020-06-21 16:23:00 +01:00
Athanasius
1fbdfcc113 Applies "log to file" necessary fix, whether we're forcing it or not. 2020-06-21 16:23:00 +01:00
Athanasius
662d35f0bb Fixes str/bytes issues on "Last updated at" UI update 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
4d5fa590af New option to NOT check for app updates automatically if in-game.
* Stores disable_autoappupdatecheckingame in settings.
  * If 'disable' is active then once you're in-game WinSparkle auto
    check for updates is disabled.
  * Whatever the state of the option WinSparkle auto updates are
    (re-)enabled when you exit the game to Main Menu or fully.
  * Using 'Help' > 'Check for updates' manually will still always work.

It has been difficult to test the code fully because it isn't easy to
get WinSparkle's registry data about last update check time set just right
to not check immediately, but to do so some reasonable time after you're
in-game and have confirmed the new option setting isn't easy.
  Worst case people won't learn about an update until the next time they
run EDMC.
2020-06-20 20:46:05 +01:00
Athanasius
aa8df90e55 Only warn once in 24 hours about plugins not ready for python 3.x 2020-06-20 14:29:00 +01:00