Athanasius
69bc90f5b4
Make export_ship() paranoid about possible encoding issues.
...
We had a report of a UnicodeDecodeError trying to read an old file. So
try utf-8 first, if it fails try the default, and if nothing else try to
write a new file so the next call should actually work as expected.
2021-04-01 14:46:43 +01:00
A_D
60dd93a3de
Fixed invalid type annotation
2021-04-01 14:45:50 +01:00
Athanasius
84afe6821a
import of watchdog.events.FileCreatedEvent needed even when not type checking
...
PyCharm debugging bailed out due to the lack.
2021-04-01 14:45:50 +01:00
Athanasius
eef4acd30b
Document line
param to parse_entry()
2021-04-01 14:45:50 +01:00
Athanasius
4a1feb4d49
Type hints should be 100% now.
...
There's something around line 324:
entry: OrderedDictT[str, Any] = OrderedDict([
producing an error with pre-commit's run of mypy
2021-04-01 14:45:50 +01:00
Athanasius
20772e7daf
Fixed current mypy complaints.
...
There are still *missing* type annotations.
2021-04-01 14:45:50 +01:00
Athanasius
1c82605d9f
monitor.py: General cleanup work on flake8 output.
...
* docstrings added as per flake8 complaints.
* Some type hints added (as I was documenting param and return).
* Also reworked two uses of .format()
* A number of functions had noqa added for cognitive complexity.
2021-04-01 14:45:50 +01:00
Athanasius
3fddd2bdf9
try/except ModulesInfo.json load & fully document
2021-04-01 14:45:50 +01:00
Athanasius
fd0ce63341
Add basic support for ModuleInfo event.
...
This still needs documentation adding in PLUGINS.md, which is easiest
done after #897 is merged and re-based upon.
2021-04-01 14:45:50 +01:00
Athanasius
361cd168af
Actually show exception on json.load(<NavRoute.json>) exception
2021-04-01 14:45:50 +01:00
Athanasius
f280a7e863
try/except for NavRoute json.load()
2021-04-01 14:45:50 +01:00
Athanasius
0dc7c62fa8
Correct Route
to NavRoute
in the code/comments as well
2021-04-01 14:45:50 +01:00
Athanasius
b3a1b0492e
Correct event and file name to NavRoute(.json) & expand docs
...
* Despite what section 4.18 of v28 Journal docs say, the event is
`NavRoute`, not `Route`, and the file is `NavRoute.json`. The array
of hops is still keyed as `Route` though.
* Calls out that both `NavRoute` and `Cargo` events, as passed to
plugins, are augmented with the data from their respective files, and
are not simply the 'bare' event as seen in the Journal.
2021-04-01 14:45:50 +01:00
Athanasius
ef891fa8bd
Initial support for Route.json file
2021-04-01 14:45:50 +01:00
Athanasius
96953744c9
monitor: Close journal loghandle if signalled to close down.
2021-04-01 14:45:50 +01:00
Athanasius
4255a2fd28
monitor: Fix isort complains
...
* Tested with py2exe build on Windows 10 native. Frontier auth works.
2021-04-01 14:45:50 +01:00
Athanasius
d39c0521da
Move JournalLock class into its own file
...
Closes #891
# Conflicts:
# journal_lock.py
# monitor.py
2021-04-01 14:45:49 +01:00
Athanasius
851c4f0c7e
Update config.get() calls to config.get_str()
...
# Conflicts:
# monitor.py
2021-04-01 14:45:49 +01:00
Athanasius
55ee4485d1
Implement retry of locking when journal dir changed.
...
In case the user does have another EDMC instance running that they need
to kill first.
# Conflicts:
# monitor.py
2021-04-01 14:45:49 +01:00
Athanasius
0cb0701ca8
Implement releasing of monitor.JournalLock()
...
* Implement JournalLock.release_lock().
* Renamed other methods to remove journaldir_ prefix.
* Slightly tweak the code flow for obtaining the lock.
* Implement JournalLock.update_lock(), called from AppWindow.postprefs().
# Conflicts:
# EDMarketConnector.py
2021-04-01 14:45:49 +01:00
Athanasius
b3959cb8d2
Move journal locking code into new monitor.JournalLock class
2021-04-01 14:45:49 +01:00
A_D
051245cf90
Renamed various config values to be backwards compatible
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
A_D
48427a770d
Updated monitor to support '' configured journal dir
2021-04-01 14:45:46 +01:00
A_D
278480b99f
replaced ors with defaults in config usage
2021-04-01 14:45:46 +01:00
Athanasius
25852997c5
Updated all source to use new config methods
...
# Conflicts:
# monitor.py
2021-04-01 14:45:46 +01:00
Athanasius
8b3785cdf7
monitor.py: Detailed logging EDLogs.worker()
2021-04-01 14:45:44 +01:00
Athanasius
9be7f14573
monitor.py: Detailed logging EDLogs.start()
2021-04-01 14:45:44 +01:00
Athanasius
4a84d9c341
monitor: Detailed logging EDLogs.stop()
...
# Conflicts:
# monitor.py
2021-04-01 14:45:44 +01:00
Athanasius
7ebf2a553a
monitor: Detailed logging EDLogs.close()
2021-04-01 14:45:44 +01:00
Athanasius
f53d2cfb7c
Remove "If it's not Fleet Carriers it's beta" check
...
Odyssey Alpha confirmed to have 'alpha' in gameversion.
2021-03-29 15:41:57 +01:00
Athanasius
f8057925a5
Odyssey: Support JournalAlpha.<etc>.log files
2021-03-29 13:50:18 +01:00
Athanasius
5fcafe52d3
Attempt writing new file if reading old one fails for any reason.
2021-03-29 10:15:52 +01:00
Athanasius
fd03bf6427
Add try/except retry/paranoia to monitor.export_ship()
...
An old loadout might have been written before we made any attempt at
utf-8.
Even now, if someone is on sufficiently old Windows we might not be on
utf-8. If that's the case then no telling what will/won't work, but try
to read/write with utf-8 first, and fall back to default encoding if it
fails.
2021-03-29 09:05:17 +01:00
Athanasius
aab2a58a2d
Reduce some log spam:
...
* Comment out the traceback in plugins/eddn.py, the return is enough.
* 'Called with no event_queue' can be TRACE.
* Don't care about "Everything was alright, the near-neutral status just
wasn't stored." from Inara.
2021-03-23 13:48:44 +00:00
Athanasius
83f8f4f547
Clean up "not Fleet Carriers" gameversion check
...
1. No need for the () on the if.
2. Log when we force is_beta = True from this.
2021-03-23 12:44:12 +00:00
Athanasius
c722a1cada
Extra paranoia: Don't pick up 'JournalAlpha...' for now
...
It's possible FDev will use JournalAlpha, but forget to change the
gameversion string.
2021-03-23 12:40:28 +00:00
Athanasius
f9034076d8
Extra paranoia about game version for forthcoming Odyssey Alpha
...
1. Pick up 'JournalAlpha' files if they ever are a thing.
2. Pick up 'alpha' in gameversion to set is_beta = True.
3. For now any gameversion without 'Fleet Carriers Update' is considered
a beta.
2021-03-23 12:37:05 +00:00
Athanasius
a6939c77d9
Backport of fix/891/force-localserver-for-auth_fix-journallock-import
...
* Move JournalLock into its own file.
2021-03-09 12:37:59 +00:00
Athanasius
d8e9748c88
Small tweak to "couldn't lock" message
2021-03-05 16:02:36 +00:00
Athanasius
f3ef653a8d
Change journal changed locking strings to translations.
2021-03-05 15:46:30 +00:00
Athanasius
f449286983
Implement retry of locking when journal dir changed.
...
In case the user does have another EDMC instance running that they need
to kill first.
2021-03-05 15:08:13 +00:00
Athanasius
447cd2c2d7
Remove unused monitor.JournalLock.self.journal_dir_lock
2021-03-05 14:18:34 +00:00
Athanasius
4884f75419
Change self.journal_dir* vars when updating lock.
...
* Also, need to seek(0) before unlock to be operating on correct range
of bytes with msvcrt.locking().
2021-03-05 13:46:10 +00:00
Athanasius
e9c31c3293
Implement releasing of monitor.JournalLock()
...
* Implement JournalLock.release_lock().
* Renamed other methods to remove journaldir_ prefix.
* Slightly tweak the code flow for obtaining the lock.
* Implement JournalLock.update_lock(), called from AppWindow.postprefs().
2021-03-05 12:45:22 +00:00
Athanasius
c0e7be98f8
Move journal locking code into new monitor.JournalLock class
2021-03-05 12:03:54 +00:00
Athanasius
462cd25312
config: Make config.shutting_down() a property, and change 'callers'
2021-01-11 16:54:09 +00:00
Athanasius
571f9665b3
monitor: Avoid Tk event_generate() calls during shutdown.
2021-01-11 16:43:07 +00:00
Athanasius
81974f66ec
monitor/dashboard: move away from if __debug__
...
This includes changing one print_exc() to logger.exception()
2021-01-08 14:56:22 +00:00
Athanasius
8a0a82fe43
monitor: Bail from get_entry() if self.thread is None
...
If there's no thread to have sent the message then we shouldn't care
about it as this means we're in shutdown.
2021-01-08 14:56:22 +00:00