mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 00:07:14 +03:00
Merge branch 'beta'
This commit is contained in:
commit
694b3636d2
8
.github/workflows/submodule-update.yml
vendored
8
.github/workflows/submodule-update.yml
vendored
@ -2,10 +2,10 @@
|
||||
name: Submodule Updates
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: [ develop ]
|
||||
schedule:
|
||||
- cron: '0 12 * * *'
|
||||
push:
|
||||
branches: [ develop ]
|
||||
# schedule:
|
||||
# - cron: '0 12 * * *'
|
||||
|
||||
jobs:
|
||||
check_submodules:
|
||||
|
4
.github/workflows/windows-build.yml
vendored
4
.github/workflows/windows-build.yml
vendored
@ -106,9 +106,9 @@ jobs:
|
||||
|
||||
- name: Download winsparkle
|
||||
run: |
|
||||
Invoke-Webrequest -UseBasicParsing https://github.com/vslavik/winsparkle/releases/download/v0.7.0/WinSparkle-0.7.0.zip -OutFile out.zip
|
||||
Invoke-Webrequest -UseBasicParsing https://github.com/vslavik/winsparkle/releases/download/v0.8.0/WinSparkle-0.8.0.zip -OutFile out.zip
|
||||
Expand-Archive out.zip
|
||||
Move-Item 'out\WinSparkle-0.7.0\Release\*' '.\'
|
||||
Move-Item 'out\WinSparkle-0.8.0\Release\*' '.\'
|
||||
|
||||
- name: Build EDMC
|
||||
run: |
|
||||
|
@ -70,7 +70,6 @@ APP = 'EDMarketConnector.py'
|
||||
APPCMD = 'EDMC.py'
|
||||
PLUGINS = [
|
||||
'plugins/coriolis.py',
|
||||
'plugins/eddb.py',
|
||||
'plugins/eddn.py',
|
||||
'plugins/edsm.py',
|
||||
'plugins/edsy.py',
|
||||
|
11
ChangeLog.md
11
ChangeLog.md
@ -34,6 +34,17 @@ produce the Windows executables and installer.
|
||||
|
||||
---
|
||||
|
||||
Pre-Release 5.9.0-rc1
|
||||
===
|
||||
This release contains the removal of the EDDB module, as well as a few under-the-hood
|
||||
updates.
|
||||
|
||||
* Removes the EDDB plugin due to EDDB shutting down.
|
||||
* Unsets EDDB as the default handler for certain URL preferences.
|
||||
* Updates the FDevIDs to latest versions.
|
||||
* Removes EDDB references from help string documentations.
|
||||
* Updated a number of dependencies to their latest working versions
|
||||
|
||||
Release 5.8.1
|
||||
===
|
||||
This fixes a bug where the Cmdr/APIKey sections on Settings > EDSM would never
|
||||
|
@ -67,7 +67,7 @@ if __name__ == '__main__': # noqa: C901
|
||||
description="Utilises Elite Dangerous Journal files and the Frontier "
|
||||
"Companion API (CAPI) service to gather data about a "
|
||||
"player's state and actions to upload to third-party sites "
|
||||
"such as EDSM, Inara.cz and EDDB."
|
||||
"such as EDSM and Inara.cz."
|
||||
)
|
||||
|
||||
###########################################################################
|
||||
@ -534,7 +534,7 @@ class AppWindow(object):
|
||||
self.station_label = tk.Label(frame, name='station_label')
|
||||
self.station = HyperlinkLabel(frame, compound=tk.RIGHT, url=self.station_url, name='station')
|
||||
# system and station text is set/updated by the 'provider' plugins
|
||||
# eddb, edsm and inara. Look for:
|
||||
# edsm and inara. Look for:
|
||||
#
|
||||
# parent.nametowidget(f".{appname.lower()}.system")
|
||||
# parent.nametowidget(f".{appname.lower()}.station")
|
||||
@ -1737,7 +1737,7 @@ class AppWindow(object):
|
||||
def station_url(self, station: str) -> str | None:
|
||||
"""Despatch a station URL to the configured handler."""
|
||||
return plug.invoke(
|
||||
config.get_str('station_provider'), 'eddb', 'station_url',
|
||||
config.get_str('station_provider'), 'EDSM', 'station_url',
|
||||
monitor.state['SystemName'], monitor.state['StationName']
|
||||
)
|
||||
|
||||
|
@ -205,9 +205,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Neplatný režim přepisu Coriolis!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "Zpracování EDDB deníku je deaktivováno. Zkontrolujte log.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Chyba: Nelze se připojit k EDDN";
|
||||
|
||||
|
@ -253,9 +253,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Ungültiger Coriolis-Überschreibungsmodus!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "EDDB Journal-Verarbeitung deaktiviert. Siehe Log.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Fehler: Keine Verbindung zum EDDN";
|
||||
|
||||
|
@ -253,9 +253,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Invalid Coriolis override mode!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "EDDB Journal processing disabled. See Log.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Error: Can't connect to EDDN";
|
||||
|
||||
|
@ -211,9 +211,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "¡Modo sobrescritura de Coriolis Inválido!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "Procesamiento de Journal para EDDB desactivado. Ver Log.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Error: No se puede conectar a EDDN";
|
||||
|
||||
|
@ -178,9 +178,6 @@
|
||||
/* l10n.py: The system default language choice in Settings > Appearance; prefs.py: Settings > Configuration - Label on 'reset journal files location to default' button; prefs.py: The system default language choice in Settings > Appearance; prefs.py: Label for 'Default' theme radio button; In files: l10n.py:193; prefs.py:455; prefs.py:709; prefs.py:742; */
|
||||
"Default" = "Oletus";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "EDDB lokikirjan käsittely ei käytössä. Katso lokitiedot.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Virhe: ei saatu yhteyttä EDDN:ään";
|
||||
|
||||
@ -193,9 +190,6 @@
|
||||
/* eddn.py: EDDN delay sending until docked option is on, this message notes that a send was skipped due to this; In files: eddn.py:2063; */
|
||||
"Delay sending until docked" = "Lähetä tiedot vasta telakoitumisen jälkeen";
|
||||
|
||||
/* eddn.py: Killswitch disabled EDDN; In files: eddn.py:2178; */
|
||||
"EDDN journal handler disabled. See Log." = "EDDB lokikirjan käsittelijä ei käytössä. Katso lokitiedot.";
|
||||
|
||||
/* eddn.py: Status text shown while attempting to send data; In files: eddn.py:2507; */
|
||||
"Sending data to EDDN..." = "Lähetetään tietoja EDDN:ään...";
|
||||
|
||||
|
@ -184,9 +184,6 @@
|
||||
/* coriolis.py: Settings>Coriolis: Label for selection of using Normal, Beta or 'auto' Coriolis URL; In files: coriolis.py:116; */
|
||||
"Override Beta/Normal Selection" = "Sovrascrivi selezione Beta/Normale";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "Elaborazione di EDDB Journal disabilitata. Guarda il Log.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Errore: Non riesco a connettermi a EDDN";
|
||||
|
||||
|
@ -253,9 +253,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "無効なCoriolis上書きモードです!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "EDDBジャーナル処理が無効です。ログを確認してください。";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "エラー: EDDNに接続できません";
|
||||
|
||||
|
@ -229,9 +229,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "잘못된 Coriolis 오버라이딩 모드입니다!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "EDDB 저널 처리 비활성화됨. 로그 참고 바람.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "오류: EDDN에 연결할 수 없음";
|
||||
|
||||
|
@ -232,9 +232,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Niewłaściwy tryb nadpisania Coriolis!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "Wyłączone przetwarzanie dziennika EDDB. Sprawdź logi.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Błąd: Brak połączenia z EDDN";
|
||||
|
||||
@ -257,7 +254,7 @@
|
||||
"Delay sending until docked" = "Czekaj z wysłaniem na zadokowanie";
|
||||
|
||||
/* eddn.py: Killswitch disabled EDDN; In files: eddn.py:2178; */
|
||||
"EDDN journal handler disabled. See Log." = "Wyłączona obsługa dziennika EDDB. Sprawdź logi.";
|
||||
"EDDN journal handler disabled. See Log." = "Wyłączona obsługa dziennika EDDN. Sprawdź logi.";
|
||||
|
||||
/* eddn.py: Status text shown while attempting to send data; In files: eddn.py:2507; */
|
||||
"Sending data to EDDN..." = "Wysłanie danych do EDDN...";
|
||||
@ -278,7 +275,7 @@
|
||||
"None" = "Brak";
|
||||
|
||||
/* edsm.py: EDSM plugin - Journal handling disabled by killswitch; In files: edsm.py:516; */
|
||||
"EDSM Handler disabled. See Log." = "Wyłączona obsługa EDDB. Sprawdź logi.";
|
||||
"EDSM Handler disabled. See Log." = "Wyłączona obsługa EDSM. Sprawdź logi.";
|
||||
|
||||
/* edsm.py: EDSM Plugin - Error message from EDSM API; In files: edsm.py:916; edsm.py:1048; */
|
||||
"Error: EDSM {MSG}" = "Błąd: EDSM {MSG}";
|
||||
|
@ -253,9 +253,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Modo de substituição Coriolis inválido!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "Processamento de Jornais no EDDB desativado. Verifique o Log.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Erro: Não é possível conectar-se ao EDDN";
|
||||
|
||||
|
@ -253,9 +253,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Modo de sobreposição Coriolis inválido!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "Processamento do diário do EDDB desactivado. Verifique o ficheiro de registos.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Erro: Não é possível conectar ao EDDN";
|
||||
|
||||
|
@ -253,9 +253,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Некорректный режим переопределения URL для coriolis.io";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "Обработка журнала EDDB отключена. См. логи.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Ошибка: не удается подключиться к EDDN";
|
||||
|
||||
|
@ -232,9 +232,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Neispravan Coriolis režim rada!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "EDDB obrada journala je deaktivirana. Pogledajte Log.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Greška: Nemoguće povezivanje sa EDDN";
|
||||
|
||||
|
@ -253,9 +253,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "Pogrešan Coriolis preinačeni mod!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "Obrada žurnala za EDDB je deaktivirana. Pogledajte Log.";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "Greška: Nemoguće povezivanje na EDDN";
|
||||
|
||||
|
@ -232,9 +232,6 @@
|
||||
/* coriolis.py: Settings>Coriolis - invalid override mode found; In files: coriolis.py:156; */
|
||||
"Invalid Coriolis override mode!" = "无效的 Coriolis 覆盖模式!";
|
||||
|
||||
/* eddb.py: Journal Processing disabled due to an active killswitch; In files: eddb.py:179; */
|
||||
"EDDB Journal processing disabled. See Log." = "EDDB Journal Processing 已禁用。请查看诊断日志。";
|
||||
|
||||
/* eddn.py: Error while trying to send data to EDDN; In files: eddn.py:458; eddn.py:2413; eddn.py:2451; eddn.py:2519; */
|
||||
"Error: Can't connect to EDDN" = "错误:无法连接到 EDDN";
|
||||
|
||||
|
@ -52,7 +52,7 @@ appcmdname = 'EDMC'
|
||||
# <https://semver.org/#semantic-versioning-specification-semver>
|
||||
# Major.Minor.Patch(-prerelease)(+buildmetadata)
|
||||
# NB: Do *not* import this, use the functions appversion() and appversion_nobuild()
|
||||
_static_appversion = '5.8.1'
|
||||
_static_appversion = '5.9.0-rc1'
|
||||
_cached_version: Optional[semantic_version.Version] = None
|
||||
copyright = '© 2015-2019 Jonathan Harris, 2020-2023 EDCD'
|
||||
|
||||
|
@ -7,7 +7,9 @@ import time
|
||||
import tkinter as tk
|
||||
from calendar import timegm
|
||||
from os.path import getsize, isdir, isfile
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, Optional, cast
|
||||
|
||||
from watchdog.observers.api import BaseObserver
|
||||
|
||||
from config import config
|
||||
from EDMCLogging import get_main_logger
|
||||
@ -34,9 +36,10 @@ class Dashboard(FileSystemEventHandler):
|
||||
|
||||
def __init__(self) -> None:
|
||||
FileSystemEventHandler.__init__(self) # futureproofing - not need for current version of watchdog
|
||||
self.session_start: int = int(time.time())
|
||||
self.root: tk.Tk = None # type: ignore
|
||||
self.currentdir: str = None # type: ignore # The actual logdir that we're monitoring
|
||||
self.observer: Observer = None # type: ignore
|
||||
self.observer: Optional[Observer] = None # type: ignore
|
||||
self.observed = None # a watchdog ObservedWatch, or None if polling
|
||||
self.status: Dict[str, Any] = {} # Current status for communicating status back to main thread
|
||||
|
||||
@ -86,7 +89,7 @@ class Dashboard(FileSystemEventHandler):
|
||||
|
||||
if not self.observed and not (sys.platform != 'win32'):
|
||||
logger.debug('Starting observer...')
|
||||
self.observed = self.observer.schedule(self, self.currentdir)
|
||||
self.observed = cast(BaseObserver, self.observer).schedule(self, self.currentdir)
|
||||
logger.debug('Done')
|
||||
|
||||
logger.info(f'{(sys.platform != "win32") and "Polling" or "Monitoring"} Dashboard "{self.currentdir}"')
|
||||
|
@ -22,7 +22,7 @@ SAFE_TRANSLATE = str.maketrans({x: '_' for x in "!@#$%^&*()./\\\r\n[]-+='\";:?<>
|
||||
class LoggingHandler(server.BaseHTTPRequestHandler):
|
||||
"""HTTP Handler implementation that logs to EDMCs logger and writes data to files on disk."""
|
||||
|
||||
def __init__(self, request: bytes, client_address: Tuple[str, int], server) -> None:
|
||||
def __init__(self, request, client_address: Tuple[str, int], server) -> None:
|
||||
super().__init__(request, client_address, server)
|
||||
|
||||
def log_message(self, format: str, *args: Any) -> None:
|
||||
|
@ -162,13 +162,13 @@ in older versions will simply become unconditional kills in the new version.
|
||||
The current recognised (to EDMC and its internal plugins) killswitch strings are
|
||||
as follows:
|
||||
|
||||
| Kill Switch | Supported Plugins | Description |
|
||||
| :------------------------------------------- | :---------------------: | :---------------------------------------------------------------------------------------- |
|
||||
| `plugins.eddn.send` | eddn | Disables all use of the send method on EDDN (effectively disables EDDN updates) |
|
||||
| `plugins.<plugin>.journal` | eddn, inara, edsm, eddb | Disables all journal processing for the plugin |
|
||||
| `plugins.<plugin>.worker` | edsm, *inara | Disables the plugins worker thread (effectively disables updates) (does not close thread) |
|
||||
| `plugins.<plugin>.worker.<eventname>` | edsm, inara | Disables the plugin worker for the given eventname |
|
||||
| `plugins.<plugin>.journal.event.<eventname>` | eddn, inara, edsm | Specific events to disable processing for. |
|
||||
| Kill Switch | Supported Plugins | Description |
|
||||
| :------------------------------------------- |:-----------------:| :---------------------------------------------------------------------------------------- |
|
||||
| `plugins.eddn.send` | eddn | Disables all use of the send method on EDDN (effectively disables EDDN updates) |
|
||||
| `plugins.<plugin>.journal` | eddn, inara, edsm | Disables all journal processing for the plugin |
|
||||
| `plugins.<plugin>.worker` | edsm, *inara | Disables the plugins worker thread (effectively disables updates) (does not close thread) |
|
||||
| `plugins.<plugin>.worker.<eventname>` | edsm, inara | Disables the plugin worker for the given eventname |
|
||||
| `plugins.<plugin>.journal.event.<eventname>` | eddn, inara, edsm | Specific events to disable processing for. |
|
||||
|
||||
Killswitches marked with `*` do **not** support modification of their values via
|
||||
set/redact/delete. And as such any match will simply stop processing.
|
||||
|
@ -7,7 +7,7 @@ Name=E:D Market Connector
|
||||
Comment=Utilise Elite Dangerous Journal and CAPI data
|
||||
Icon=io.edcd.EDMarketConnector
|
||||
Categories=Game;
|
||||
Keywords=Elite;Dangerous;EDDN;EDSM;EDDB;Inara;Spansh;
|
||||
Keywords=Elite;Dangerous;EDDN;EDSM;Inara;Spansh;
|
||||
Exec=edmarketconnector
|
||||
Terminal=false
|
||||
SingleMainWindow=true
|
||||
|
@ -43,6 +43,7 @@ if sys.platform == 'darwin':
|
||||
from AppKit import NSWorkspace
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.observers.api import BaseObserver
|
||||
F_GLOBAL_NOCACHE = 55
|
||||
|
||||
elif sys.platform == 'win32':
|
||||
@ -51,6 +52,7 @@ elif sys.platform == 'win32':
|
||||
|
||||
from watchdog.events import FileCreatedEvent, FileSystemEventHandler
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.observers.api import BaseObserver
|
||||
|
||||
EnumWindows = ctypes.windll.user32.EnumWindows
|
||||
EnumWindowsProc = ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
|
||||
@ -70,6 +72,7 @@ else:
|
||||
# this isn't ever used, but this will make type checking happy
|
||||
from watchdog.events import FileCreatedEvent
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.observers.api import BaseObserver
|
||||
|
||||
|
||||
# Journal handler
|
||||
@ -91,7 +94,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.root: 'tkinter.Tk' = None # type: ignore # Don't use Optional[] - mypy thinks no methods
|
||||
self.currentdir: str | None = None # The actual logdir that we're monitoring
|
||||
self.logfile: str | None = None
|
||||
self.observer: 'Observer' | None = None
|
||||
self.observer: BaseObserver | None = None
|
||||
self.observed = None # a watchdog ObservedWatch, or None if polling
|
||||
self.thread: threading.Thread | None = None
|
||||
# For communicating journal entries back to main thread
|
||||
|
255
plugins/eddb.py
255
plugins/eddb.py
@ -1,255 +0,0 @@
|
||||
"""Station display and eddb.io lookup."""
|
||||
# Tests:
|
||||
#
|
||||
# As there's a lot of state tracking in here, need to ensure (at least)
|
||||
# the URL text and link follow along correctly with:
|
||||
#
|
||||
# 1) Game not running, EDMC started.
|
||||
# 2) Then hit 'Update' for CAPI data pull
|
||||
# 3) Login fully to game, and whether #2 happened or not:
|
||||
# a) If docked then update Station
|
||||
# b) Either way update System
|
||||
# 4) Undock, SupercruiseEntry, FSDJump should change Station text to 'x'
|
||||
# and link to system one.
|
||||
# 5) RequestDocking should populate Station, no matter if the request
|
||||
# succeeded or not.
|
||||
# 6) FSDJump should update System text+link.
|
||||
# 7) Switching to a different provider and then back... combined with
|
||||
# any of the above in the interim.
|
||||
#
|
||||
|
||||
|
||||
# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $#
|
||||
# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $#
|
||||
#
|
||||
# This is an EDMC 'core' plugin.
|
||||
#
|
||||
# All EDMC plugins are *dynamically* loaded at run-time.
|
||||
#
|
||||
# We build for Windows using `py2exe`.
|
||||
#
|
||||
# `py2exe` can't possibly know about anything in the dynamically loaded
|
||||
# core plugins.
|
||||
#
|
||||
# Thus you **MUST** check if any imports you add in this file are only
|
||||
# referenced in this file (or only in any other core plugin), and if so...
|
||||
#
|
||||
# YOU MUST ENSURE THAT PERTINENT ADJUSTMENTS ARE MADE IN
|
||||
# `Build-exe-and-msi.py` SO AS TO ENSURE THE FILES ARE ACTUALLY PRESENT IN
|
||||
# AN END-USER INSTALLATION ON WINDOWS.
|
||||
#
|
||||
#
|
||||
# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $#
|
||||
# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $# ! $#
|
||||
import tkinter
|
||||
from typing import TYPE_CHECKING, Any, Mapping
|
||||
|
||||
import requests
|
||||
|
||||
import EDMCLogging
|
||||
import killswitch
|
||||
import plug
|
||||
from companion import CAPIData
|
||||
from config import appname, config
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tkinter import Tk
|
||||
|
||||
def _(x: str) -> str:
|
||||
return x
|
||||
|
||||
logger = EDMCLogging.get_main_logger()
|
||||
|
||||
|
||||
class This:
|
||||
"""Holds module globals."""
|
||||
|
||||
STATION_UNDOCKED: str = '×' # "Station" name to display when not docked = U+00D7
|
||||
|
||||
def __init__(self) -> None:
|
||||
# Main window clicks
|
||||
self.system_link: tkinter.Widget
|
||||
self.system_name: str | None = None
|
||||
self.system_address: str | None = None
|
||||
self.system_population: int | None = None
|
||||
self.station_link: tkinter.Widget
|
||||
self.station_name: str | None = None
|
||||
self.station_marketid: int | None = None
|
||||
self.on_foot = False
|
||||
|
||||
|
||||
this = This()
|
||||
|
||||
|
||||
def system_url(system_name: str) -> str:
|
||||
"""
|
||||
Construct an appropriate EDDB.IO URL for the provided system.
|
||||
|
||||
:param system_name: Will be overridden with `this.system_address` if that
|
||||
is set.
|
||||
:return: The URL, empty if no data was available to construct it.
|
||||
"""
|
||||
if this.system_address:
|
||||
return requests.utils.requote_uri(f'https://eddb.io/system/ed-address/{this.system_address}')
|
||||
|
||||
if system_name:
|
||||
return requests.utils.requote_uri(f'https://eddb.io/system/name/{system_name}')
|
||||
|
||||
return ''
|
||||
|
||||
|
||||
def station_url(system_name: str, station_name: str) -> str:
|
||||
"""
|
||||
Construct an appropriate EDDB.IO URL for a station.
|
||||
|
||||
Ignores `station_name` in favour of `this.station_marketid`.
|
||||
|
||||
:param system_name: Name of the system the station is in.
|
||||
:param station_name: **NOT USED**
|
||||
:return: The URL, empty if no data was available to construct it.
|
||||
"""
|
||||
if this.station_marketid:
|
||||
return requests.utils.requote_uri(f'https://eddb.io/station/market-id/{this.station_marketid}')
|
||||
|
||||
return system_url(system_name)
|
||||
|
||||
|
||||
def plugin_start3(plugin_dir: str) -> str:
|
||||
"""
|
||||
Start the plugin.
|
||||
|
||||
:param plugin_dir: NAme of directory this was loaded from.
|
||||
:return: Identifier string for this plugin.
|
||||
"""
|
||||
return 'eddb'
|
||||
|
||||
|
||||
def plugin_app(parent: 'Tk'):
|
||||
"""
|
||||
Construct this plugin's main UI, if any.
|
||||
|
||||
:param parent: The tk parent to place our widgets into.
|
||||
:return: See PLUGINS.md#display
|
||||
"""
|
||||
# system label in main window
|
||||
this.system_link = parent.nametowidget(f".{appname.lower()}.system")
|
||||
this.system_name = None
|
||||
this.system_address = None
|
||||
this.station_name = None
|
||||
this.station_marketid = None # Frontier MarketID
|
||||
# station label in main window
|
||||
this.station_link = parent.nametowidget(f".{appname.lower()}.station")
|
||||
this.station_link['popup_copy'] = lambda x: x != this.STATION_UNDOCKED
|
||||
|
||||
|
||||
def prefs_changed(cmdr: str, is_beta: bool) -> None:
|
||||
"""
|
||||
Update any saved configuration after Settings is closed.
|
||||
|
||||
:param cmdr: Name of Commander.
|
||||
:param is_beta: If game beta was detected.
|
||||
"""
|
||||
# Do *NOT* set 'url' here, as it's set to a function that will call
|
||||
# through correctly. We don't want a static string.
|
||||
pass
|
||||
|
||||
|
||||
def journal_entry(
|
||||
cmdr: str, is_beta: bool, system: str, station: str,
|
||||
entry: dict[str, Any],
|
||||
state: Mapping[str, Any]
|
||||
):
|
||||
"""
|
||||
Handle a new Journal event.
|
||||
|
||||
:param cmdr: Name of Commander.
|
||||
:param is_beta: Whether game beta was detected.
|
||||
:param system: Name of current tracked system.
|
||||
:param station: Name of current tracked station location.
|
||||
:param entry: The journal event.
|
||||
:param state: `monitor.state`
|
||||
:return: None if no error, else an error string.
|
||||
"""
|
||||
should_return: bool
|
||||
new_entry: dict[str, Any] = {}
|
||||
|
||||
should_return, new_entry = killswitch.check_killswitch('plugins.eddb.journal', entry)
|
||||
if should_return:
|
||||
# LANG: Journal Processing disabled due to an active killswitch
|
||||
plug.show_error(_('EDDB Journal processing disabled. See Log.'))
|
||||
return
|
||||
|
||||
should_return, new_entry = killswitch.check_killswitch(f'plugins.eddb.journal.event.{entry["event"]}', new_entry)
|
||||
if should_return:
|
||||
return
|
||||
|
||||
this.on_foot = state['OnFoot']
|
||||
this.system_address = state['SystemAddress']
|
||||
this.system_name = state['SystemName']
|
||||
this.system_population = state['SystemPopulation']
|
||||
this.station_name = state['StationName']
|
||||
this.station_marketid = state['MarketID']
|
||||
|
||||
# Only change URL text if we are current provider.
|
||||
if config.get_str('station_provider') == 'eddb':
|
||||
this.system_link['text'] = this.system_name
|
||||
# Do *NOT* set 'url' here, as it's set to a function that will call
|
||||
# through correctly. We don't want a static string.
|
||||
this.system_link.update_idletasks()
|
||||
|
||||
if this.station_name:
|
||||
this.station_link['text'] = this.station_name
|
||||
|
||||
else:
|
||||
if this.system_population is not None and this.system_population > 0:
|
||||
this.station_link['text'] = this.STATION_UNDOCKED
|
||||
|
||||
else:
|
||||
this.station_link['text'] = ''
|
||||
|
||||
# Do *NOT* set 'url' here, as it's set to a function that will call
|
||||
# through correctly. We don't want a static string.
|
||||
this.station_link.update_idletasks()
|
||||
|
||||
|
||||
def cmdr_data(data: CAPIData, is_beta: bool) -> str | None:
|
||||
"""
|
||||
Process new CAPI data.
|
||||
|
||||
:param data: The latest merged CAPI data.
|
||||
:param is_beta: Whether game beta was detected.
|
||||
:return: Optional error string.
|
||||
"""
|
||||
# Always store initially, even if we're not the *current* system provider.
|
||||
if not this.station_marketid and data['commander']['docked']:
|
||||
this.station_marketid = data['lastStarport']['id']
|
||||
|
||||
# Only trust CAPI if these aren't yet set
|
||||
if not this.system_name:
|
||||
this.system_name = data['lastSystem']['name']
|
||||
|
||||
if not this.station_name and data['commander']['docked']:
|
||||
this.station_name = data['lastStarport']['name']
|
||||
|
||||
# Override standard URL functions
|
||||
if config.get_str('system_provider') == 'eddb':
|
||||
this.system_link['text'] = this.system_name
|
||||
# Do *NOT* set 'url' here, as it's set to a function that will call
|
||||
# through correctly. We don't want a static string.
|
||||
this.system_link.update_idletasks()
|
||||
|
||||
if config.get_str('station_provider') == 'eddb':
|
||||
if data['commander']['docked'] or this.on_foot and this.station_name:
|
||||
this.station_link['text'] = this.station_name
|
||||
|
||||
elif data['lastStarport']['name'] and data['lastStarport']['name'] != "":
|
||||
this.station_link['text'] = this.STATION_UNDOCKED
|
||||
|
||||
else:
|
||||
this.station_link['text'] = ''
|
||||
|
||||
# Do *NOT* set 'url' here, as it's set to a function that will call
|
||||
# through correctly. We don't want a static string.
|
||||
this.station_link.update_idletasks()
|
||||
|
||||
return ''
|
@ -692,8 +692,8 @@ class EDDN:
|
||||
# not send an empty commodities list, as the EDDN Schema doesn't allow
|
||||
# it (as of 2020-09-28).
|
||||
# BUT, Fleet Carriers can go from having buy/sell orders to having
|
||||
# none and that really does need to be recorded over EDDN so that, e.g.
|
||||
# EDDB can update in a timely manner.
|
||||
# none and that really does need to be recorded over EDDN so that
|
||||
# tools can update in a timely manner.
|
||||
if this.commodities != commodities:
|
||||
message: OrderedDictT[str, Any] = OrderedDict([
|
||||
('timestamp', data['timestamp']),
|
||||
@ -929,8 +929,8 @@ class EDDN:
|
||||
# not send an empty commodities list, as the EDDN Schema doesn't allow
|
||||
# it (as of 2020-09-28).
|
||||
# BUT, Fleet Carriers can go from having buy/sell orders to having
|
||||
# none and that really does need to be recorded over EDDN so that, e.g.
|
||||
# EDDB can update in a timely manner.
|
||||
# none and that really does need to be recorded over EDDN so that
|
||||
# tools can update in a timely manner.
|
||||
if this.commodities != commodities:
|
||||
self.send_message(cmdr, {
|
||||
'$schemaRef': f'https://eddn.edcd.io/schemas/commodity/3{"/test" if is_beta else ""}',
|
||||
|
2
prefs.py
2
prefs.py
@ -625,7 +625,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
with row as cur_row:
|
||||
station_provider = config.get_str('station_provider')
|
||||
self.station_provider = tk.StringVar(
|
||||
value=str(station_provider if station_provider in plug.provides('station_url') else 'eddb')
|
||||
value=str(station_provider if station_provider in plug.provides('station_url') else 'EDSM')
|
||||
)
|
||||
|
||||
# LANG: Configuration - Label for selection of 'Station' provider website
|
||||
|
@ -5,51 +5,51 @@ wheel
|
||||
# We can't rely on just picking this up from either the base (not venv),
|
||||
# or venv-init-time version. Specify here so that dependabot will prod us
|
||||
# about new versions.
|
||||
setuptools==66.0.0
|
||||
setuptools==68.0.0
|
||||
|
||||
# Static analysis tools
|
||||
flake8==6.0.0
|
||||
flake8-annotations-coverage==0.0.6
|
||||
flake8-cognitive-complexity==0.1.0
|
||||
flake8-comprehensions==3.10.1
|
||||
flake8-docstrings==1.6.0
|
||||
isort==5.11.4
|
||||
flake8-comprehensions==3.14.0
|
||||
flake8-docstrings==1.7.0
|
||||
isort==5.12.0
|
||||
flake8-isort==6.0.0
|
||||
flake8-json==21.7.0
|
||||
flake8-noqa==1.3.0
|
||||
flake8-json==23.7.0
|
||||
flake8-noqa==1.3.2
|
||||
flake8-polyfill==1.0.2
|
||||
flake8-use-fstring==1.4
|
||||
|
||||
mypy==0.991
|
||||
mypy==1.4.1
|
||||
pep8-naming==0.13.3
|
||||
safety==2.3.5
|
||||
types-requests==2.28.11.7
|
||||
types-requests==2.31.0.2
|
||||
types-pkg-resources==0.1.3
|
||||
|
||||
# Code formatting tools
|
||||
autopep8==2.0.1
|
||||
autopep8==2.0.2
|
||||
|
||||
# Git pre-commit checking
|
||||
pre-commit==2.21.0
|
||||
pre-commit==3.3.3
|
||||
|
||||
# HTML changelogs
|
||||
grip==4.6.1
|
||||
|
||||
# Packaging
|
||||
# Used to put together a WiX configuration from template/auto-gen
|
||||
lxml==4.9.2
|
||||
lxml==4.9.3
|
||||
# We only need py2exe on windows.
|
||||
# Pre-release version addressing semantic_version 2.9.0+ issues:
|
||||
# <https://github.com/py2exe/py2exe/issues/126>
|
||||
py2exe==0.13.0.0; sys_platform == 'win32'
|
||||
|
||||
# Testing
|
||||
pytest==7.2.1
|
||||
pytest-cov==4.0.0 # Pytest code coverage support
|
||||
coverage[toml]==7.0.5 # pytest-cov dep. This is here to ensure that it includes TOML support for pyproject.toml configs
|
||||
coverage-conditional-plugin==0.8.0
|
||||
pytest==7.4.0
|
||||
pytest-cov==4.1.0 # Pytest code coverage support
|
||||
coverage[toml]==7.2.7 # pytest-cov dep. This is here to ensure that it includes TOML support for pyproject.toml configs
|
||||
coverage-conditional-plugin==0.9.0
|
||||
# For manipulating folder permissions and the like.
|
||||
pywin32==305; sys_platform == 'win32'
|
||||
pywin32==306; sys_platform == 'win32'
|
||||
|
||||
|
||||
# All of the normal requirements
|
||||
|
@ -1,9 +1,9 @@
|
||||
certifi==2022.12.7
|
||||
requests==2.28.2
|
||||
certifi==2023.7.22
|
||||
requests==2.31.0
|
||||
# requests depends on this now ?
|
||||
charset-normalizer==2.1.1
|
||||
|
||||
watchdog==2.2.1
|
||||
watchdog==3.0.0
|
||||
# Commented out because this doesn't package well with py2exe
|
||||
infi.systray==0.1.12; sys_platform == 'win32'
|
||||
# argh==0.26.2 watchdog dep
|
||||
|
@ -23,10 +23,6 @@ KNOWN_KILLSWITCH_NAMES: list[str] = [
|
||||
'plugins.eddn.send',
|
||||
'plugins.eddn.journal',
|
||||
'plugins.eddn.journal.event.$event',
|
||||
|
||||
# eddb
|
||||
'plugins.eddb.journal',
|
||||
'plugins.eddb.journal.event.$event'
|
||||
]
|
||||
|
||||
SPLIT_KNOWN_NAMES = [x.split('.') for x in KNOWN_KILLSWITCH_NAMES]
|
||||
|
@ -543,9 +543,6 @@
|
||||
<Component Guid="*">
|
||||
<File KeyPath="yes" Source="SourceDir\plugins\coriolis.py" />
|
||||
</Component>
|
||||
<Component Guid="*">
|
||||
<File KeyPath="yes" Source="SourceDir\plugins\eddb.py" />
|
||||
</Component>
|
||||
<Component Guid="*">
|
||||
<File KeyPath="yes" Source="SourceDir\plugins\eddn.py" />
|
||||
</Component>
|
||||
@ -709,7 +706,6 @@
|
||||
<ComponentRef Id="winTheme.tcl" />
|
||||
<ComponentRef Id="xpTheme.tcl" />
|
||||
<ComponentRef Id="coriolis.py" />
|
||||
<ComponentRef Id="eddb.py" />
|
||||
<ComponentRef Id="eddn.py" />
|
||||
<ComponentRef Id="edsm.py" />
|
||||
<ComponentRef Id="edsy.py" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user