From 9d68938293aea1d57989fc7d8be51930f6f588cd Mon Sep 17 00:00:00 2001 From: A_D Date: Mon, 17 May 2021 08:22:35 +0200 Subject: [PATCH 01/34] Added the ability to copy individual entries from status Currently no method for entire pages. closes #1060 --- stats.py | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/stats.py b/stats.py index fcd514cc..d15d9622 100644 --- a/stats.py +++ b/stats.py @@ -3,7 +3,8 @@ import csv import tkinter as tk from sys import platform from tkinter import ttk -from typing import TYPE_CHECKING, Any, AnyStr, Dict, List, NamedTuple, Optional, Sequence, cast +import tkinter +from typing import Callable, TYPE_CHECKING, Any, AnyStr, Dict, List, NamedTuple, Optional, Sequence, cast import companion import EDMCLogging @@ -11,6 +12,7 @@ import myNotebook as nb # noqa: N813 from edmc_data import ship_name_map from l10n import Locale from monitor import monitor +from ttkHyperlinkLabel import HyperlinkLabel logger = EDMCLogging.get_main_logger() @@ -342,10 +344,11 @@ class StatsResults(tk.Toplevel): page = self.addpage(notebook) for thing in stats[1:3]: - self.addpagerow(page, [thing[0], self.credits(int(thing[1]))]) # assumes things two and three are money + # assumes things two and three are money + self.addpagerow(page, [thing[0], self.credits(int(thing[1]))], with_copy=True) for thing in stats[3:]: - self.addpagerow(page, thing) + self.addpagerow(page, thing, with_copy=True) ttk.Frame(page).grid(pady=5) # bottom spacer notebook.add(page, text=_('Status')) # Status dialog title @@ -361,7 +364,7 @@ class StatsResults(tk.Toplevel): shiplist = ships(data) for ship_data in shiplist: # skip id, last item is money - self.addpagerow(page, list(ship_data[1:-1]) + [self.credits(int(ship_data[-1]))]) + self.addpagerow(page, list(ship_data[1:-1]) + [self.credits(int(ship_data[-1]))], with_copy=True) ttk.Frame(page).grid(pady=5) # bottom spacer notebook.add(page, text=_('Ships')) # Status dialog title @@ -417,14 +420,14 @@ class StatsResults(tk.Toplevel): :param header: The headers to add to the page :param align: The alignment of the page, defaults to None """ - self.addpagerow(parent, header, align=align) + self.addpagerow(parent, header, align=align, with_copy=False) ttk.Separator(parent, orient=tk.HORIZONTAL).grid(columnspan=len(header), padx=10, pady=2, sticky=tk.EW) def addpagespacer(self, parent) -> None: """Add a spacer to the page.""" self.addpagerow(parent, ['']) - def addpagerow(self, parent: tk.Frame, content: Sequence[str], align: Optional[str] = None): + def addpagerow(self, parent: tk.Frame, content: Sequence[str], align: Optional[str] = None, with_copy: bool = False): """ Add a single row to parent. @@ -434,7 +437,11 @@ class StatsResults(tk.Toplevel): """ row = -1 # To silence unbound warnings for i in range(len(content)): + # label = HyperlinkLabel(parent, text=content[i], popup_copy=True) label = nb.Label(parent, text=content[i]) + if with_copy: + label.bind('', self.copy_callback(label, content[i])) + if i == 0: label.grid(padx=10, sticky=tk.W) row = parent.grid_size()[1]-1 @@ -449,3 +456,16 @@ class StatsResults(tk.Toplevel): """Localised string of given int, including a trailing ` Cr`.""" # TODO: Locale is a class, this calls an instance method on it with an int as its `self` return Locale.string_from_number(value, 0) + ' Cr' # type: ignore + + @staticmethod + def copy_callback(label: tk.Label, text_to_copy: str) -> Callable[..., None]: + """Copy data in Label to clipboard.""" + def do_copy(event: tkinter.Event) -> None: + label.clipboard_clear() + label.clipboard_append(text_to_copy) + old_bg = label['bg'] + label['bg'] = 'gray49' + + label.after(100, (lambda: label.configure(bg=old_bg))) + + return do_copy From e68494035edfeebc6e21e5da0851ac110d74ff4b Mon Sep 17 00:00:00 2001 From: A_D Date: Mon, 17 May 2021 08:25:13 +0200 Subject: [PATCH 02/34] Sorted imports --- stats.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stats.py b/stats.py index d15d9622..3cc1c593 100644 --- a/stats.py +++ b/stats.py @@ -1,10 +1,10 @@ """CMDR Status information.""" import csv +import tkinter import tkinter as tk from sys import platform from tkinter import ttk -import tkinter -from typing import Callable, TYPE_CHECKING, Any, AnyStr, Dict, List, NamedTuple, Optional, Sequence, cast +from typing import TYPE_CHECKING, Any, AnyStr, Callable, Dict, List, NamedTuple, Optional, Sequence, cast import companion import EDMCLogging @@ -12,7 +12,6 @@ import myNotebook as nb # noqa: N813 from edmc_data import ship_name_map from l10n import Locale from monitor import monitor -from ttkHyperlinkLabel import HyperlinkLabel logger = EDMCLogging.get_main_logger() From a89d4f1901bfd43ae160cae9c6e946001eb3550a Mon Sep 17 00:00:00 2001 From: A_D Date: Fri, 21 May 2021 11:02:51 +0200 Subject: [PATCH 03/34] Fixed line too long --- stats.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stats.py b/stats.py index 3cc1c593..704e4703 100644 --- a/stats.py +++ b/stats.py @@ -426,7 +426,9 @@ class StatsResults(tk.Toplevel): """Add a spacer to the page.""" self.addpagerow(parent, ['']) - def addpagerow(self, parent: tk.Frame, content: Sequence[str], align: Optional[str] = None, with_copy: bool = False): + def addpagerow( + self, parent: tk.Frame, content: Sequence[str], align: Optional[str] = None, with_copy: bool = False + ): """ Add a single row to parent. From eb4cbded7aaef767371da8e121f2d24885da1274 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 21 May 2021 15:36:53 +0100 Subject: [PATCH 04/34] Post-release appversion bump I'm trying out a new policy of bumping to patch+1 and -beta0 after a stable release. Makes it more obvious when I was testing, especially over EDDN (which doesn't get sent the +buildmeta). --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index 8c78e64e..290d08fe 100644 --- a/config.py +++ b/config.py @@ -33,7 +33,7 @@ appcmdname = 'EDMC' # # Major.Minor.Patch(-prerelease)(+buildmetadata) # NB: Do *not* import this, use the functions appversion() and appversion_nobuild() -_static_appversion = '5.0.2' +_static_appversion = '5.0.3-beta0' copyright = '© 2015-2019 Jonathan Harris, 2020-2021 EDCD' update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml' From 69d8270e8fc2b7117b10755c27d81bc095883415 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 21 May 2021 16:55:10 +0100 Subject: [PATCH 05/34] config: Rework 'git but dirty?' check to handle 'no git' `shorthash` was still `None` if no git, so we then tried to concatenate `NoneType` and `str` which is verbotten. There's no point using git to detect dirtyness if `shorthash` is None because that itself indicates no git available. --- config.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config.py b/config.py index 290d08fe..fb644a73 100644 --- a/config.py +++ b/config.py @@ -101,15 +101,6 @@ def git_shorthash_from_head() -> str: :return: str - None if we couldn't determine the short hash. """ shorthash: str = None # type: ignore - dirty = False - - with contextlib.suppress(Exception): - result = subprocess.run('git diff --stat HEAD'.split(), capture_output=True) - if len(result.stdout) > 0: - dirty = True - - if len(result.stderr) > 0: - logger.warning(f'Data from git on stderr:\n{str(result.stderr)}') try: git_cmd = subprocess.Popen('git rev-parse --short HEAD'.split(), @@ -127,7 +118,16 @@ def git_shorthash_from_head() -> str: logger.error(f"'{shorthash}' doesn't look like a valid git short hash, forcing to None") shorthash = None # type: ignore - return shorthash + ('-WORKING-DIR-IS-DIRTY' if dirty else '') + if shorthash is not None: + with contextlib.suppress(Exception): + result = subprocess.run('git diff --stat HEAD'.split(), capture_output=True) + if len(result.stdout) > 0: + shorthash += '-WORKING-DIR-IS-DIRTY' + + if len(result.stderr) > 0: + logger.warning(f'Data from git on stderr:\n{str(result.stderr)}') + + return shorthash def appversion() -> semantic_version.Version: From 00469384b497e8919b9fb19fb691f84ed33e19cb Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 14:26:01 +0100 Subject: [PATCH 06/34] Suits: Keep using CAPI-source Suit name if we have it. * We were referring to *suit* 'slot id', when that's only for the loadouts. For suits we have a full id, from Frontier, that we use. * Comment that creating a suit loadout does *not* automatically equip it. Now, **if we have CAPI data** we will use the CAPI-sourced localised name for the suit display. Where we don't (yet) have CAPI data we still use the badly localised journal name for the suit. --- monitor.py | 60 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/monitor.py b/monitor.py index eeedfbd6..6b04ad69 100644 --- a/monitor.py +++ b/monitor.py @@ -1075,8 +1075,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below # "ModuleName":"wpn_s_pistol_plasma_charged", # "ModuleName_Localised":"Manticore Tormentor" } ] } # - suit_slotid, suitloadout_slotid = self.suitloadout_store_from_event(entry) - if not self.suit_and_loadout_setcurrent(suit_slotid, suitloadout_slotid): + suitid, suitloadout_slotid = self.suitloadout_store_from_event(entry) + if not self.suit_and_loadout_setcurrent(suitid, suitloadout_slotid): logger.error(f"Event was: {entry}") elif event_type == 'CreateSuitLoadout': @@ -1091,7 +1091,10 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below # { "SlotName":"SecondaryWeapon", "SuitModuleID":1700217869872834, # "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } # - _, _ = self.suitloadout_store_from_event(entry) + suitid, suitloadout_slotid = self.suitloadout_store_from_event(entry) + # Creation doesn't mean equipping it + # if not self.suit_and_loadout_setcurrent(suitid, suitloadout_slotid): + # logger.error(f"Event was: {entry}") elif event_type == 'DeleteSuitLoadout': # alpha4: @@ -1591,45 +1594,52 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below :param entry: Journal entry - 'SwitchSuitLoadout' or 'SuitLoadout' :return Tuple[suit_slotid, suitloadout_slotid]: The IDs we set data for. """ - suit_slotid = self.suit_loadout_id_from_loadoutid(entry['LoadoutID']) - # Initial suit containing just the data that is then embedded in - # the loadout - new_suit = { - 'name': entry['SuitName'], - 'locName': entry.get('SuitName_Localised', entry['SuitName']), - 'suitId': entry['SuitID'], - } + # This is the full ID from Frontier, it's not a sparse array slot id + suitid = entry['SuitID'] + + # Check if this looks like a suit we already have stored, so as + # to avoid 'bad' Journal localised names. + suit = self.state['Suits'].get(f"{suitid}", None) + if not suit: + # Initial suit containing just the data that is then embedded in + # the loadout + suit = { + 'locName': entry.get('SuitName_Localised', entry['SuitName']), + 'suitId': entry['SuitID'], + 'name': entry['SuitName'], + } + + suitloadout_slotid = self.suit_loadout_id_from_loadoutid(entry['LoadoutID']) # Make the new loadout, in the CAPI format new_loadout = { - 'loadoutSlotId': suit_slotid, - 'suit': new_suit, + 'loadoutSlotId': suitloadout_slotid, + 'suit': suit, 'name': entry['LoadoutName'], - 'slots': self.suit_loadout_slots_array_to_dict( - entry['Modules']), + 'slots': self.suit_loadout_slots_array_to_dict(entry['Modules']), } # Assign this loadout into our state - self.state['SuitLoadouts'][f"{new_loadout['loadoutSlotId']}"] = new_loadout + self.state['SuitLoadouts'][f"{suitloadout_slotid}"] = new_loadout # Now add in the extra fields for new_suit to be a 'full' Suit structure - new_suit['id'] = None # Not available in 4.0.0.100 journal event - new_suit['slots'] = new_loadout['slots'] # 'slots', not 'Modules', to match CAPI - # Ensure new_suit is in self.state['Suits'] - self.state['Suits'][f"{suit_slotid}"] = new_suit + suit['id'] = suit.get('id') # Not available in 4.0.0.100 journal event + suit['slots'] = new_loadout['slots'] # 'slots', not 'Modules', to match CAPI + # Ensure the suit is in self.state['Suits'] + self.state['Suits'][f"{suitid}"] = suit - return suit_slotid, new_loadout['loadoutSlotId'] + return suitid, suitloadout_slotid - def suit_and_loadout_setcurrent(self, suit_slotid: int, suitloadout_slotid: int) -> bool: + def suit_and_loadout_setcurrent(self, suitid: int, suitloadout_slotid: int) -> bool: """ Set self.state for SuitCurrent and SuitLoadoutCurrent as requested. If the specified slots are unknown we abort and return False, else return True. - :param suit_slotid: Numeric ID of the slot for the suit. + :param suitid: Numeric ID of the suit. :param suitloadout_slotid: Numeric ID of the slot for the suit loadout. :return: True if we could do this, False if not. """ - str_suitid = f"{suit_slotid}" + str_suitid = f"{suitid}" str_suitloadoutid = f"{suitloadout_slotid}" if (self.state['Suits'].get(str_suitid, False) @@ -1638,7 +1648,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below self.state['SuitLoadoutCurrent'] = self.state['SuitLoadouts'][str_suitloadoutid] return True - logger.error(f"Tried to set a suit and suitloadout where we didn't know about both: {suit_slotid=}, " + logger.error(f"Tried to set a suit and suitloadout where we didn't know about both: {suitid=}, " f"{str_suitloadoutid=}") return False From 68a0e6c7af1014da3fa0d3854ccb21bafb07eb42 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 14:31:27 +0100 Subject: [PATCH 07/34] Test for `if suit is None` rather than a boolean test. This matches the explicit default in the .get() --- monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor.py b/monitor.py index 6b04ad69..8caceb97 100644 --- a/monitor.py +++ b/monitor.py @@ -1600,7 +1600,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below # Check if this looks like a suit we already have stored, so as # to avoid 'bad' Journal localised names. suit = self.state['Suits'].get(f"{suitid}", None) - if not suit: + if suit is None: # Initial suit containing just the data that is then embedded in # the loadout suit = { From 48c852ec1d586d472dcff283cc89e9820a1e6984 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 14:45:18 +0100 Subject: [PATCH 08/34] Suits: Code scaffolding for sanitising suit names --- monitor.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/monitor.py b/monitor.py index 8caceb97..a0c15881 100644 --- a/monitor.py +++ b/monitor.py @@ -1584,6 +1584,27 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below logger.debug(f'Invalid journal entry:\n{line!r}\n', exc_info=ex) return {'event': None} + def suit_sane_name(self, name: str) -> str: + """ + Given an input suit name return the best 'sane' name we can. + + AS of 4.0.0.102 the Journal events are fine for a Grade 1 suit, but + anything above that has broken SuitName_Localised strings, e.g. + $TacticalSuit_Class1_Name; + + Also, if there isn't a SuitName_Localised value at all we'll use the + plain SuitName which can be, e.g. tacticalsuit_class3 + + If the names were correct we would get 'Dominator Suit' in this instance, + however what we want to return is, e.g. 'Dominator'. As that's both + sufficient for disambiguation and more succinct. + + :param name: Name that could be in any of the forms. + :return: Our sane version of this suit's name. + """ + # TODO: Localisation ? + return name + def suitloadout_store_from_event(self, entry) -> Tuple[int, int]: """ Store Suit and SuitLoadout data from a journal event. @@ -1603,10 +1624,16 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below if suit is None: # Initial suit containing just the data that is then embedded in # the loadout + + # TODO: Attempt to map SuitName_Localised to something sane, if it + # isn't already. + suitname = entry.get('SuitName_Localised', entry['SuitName']) + edmc_suitname = self.suit_sane_name(suitname) suit = { - 'locName': entry.get('SuitName_Localised', entry['SuitName']), - 'suitId': entry['SuitID'], - 'name': entry['SuitName'], + 'edmcName': edmc_suitname, + 'locName': suitname, + 'suitId': entry['SuitID'], + 'name': entry['SuitName'], } suitloadout_slotid = self.suit_loadout_id_from_loadoutid(entry['LoadoutID']) From f85213b3188269793c3256ffd0f7dcb15ab0eade Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 14:52:43 +0100 Subject: [PATCH 09/34] Suits: Initial stab at grabbing a usable name out of a $symbol; version --- monitor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/monitor.py b/monitor.py index a0c15881..eca0d5b0 100644 --- a/monitor.py +++ b/monitor.py @@ -1603,6 +1603,13 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below :return: Our sane version of this suit's name. """ # TODO: Localisation ? + # Stage 1: Is it in `$_Class_Name;` form ? + if (m := re.fullmatch(r'^\$([^_]+)_Class([0-9]+)_Name$', name)): + n, c = m.group(1, 2) + name = n + + # Stage 2: Is it in `_class` form ? + # Stage 3: Is it in verbose ` Suit` form ? return name def suitloadout_store_from_event(self, entry) -> Tuple[int, int]: From dba3fba8e3a35f30cc2defd8034d76d3038ead32 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 15:24:21 +0100 Subject: [PATCH 10/34] Suits: Fully implement mapping to sane (English only for now) names --- EDMarketConnector.py | 4 ++-- edmc_data.py | 15 +++++++++++++++ monitor.py | 12 +++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 2f94f660..5e0a0f4c 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -629,7 +629,7 @@ class AppWindow(object): self.suit['text'] = f'<{_("Unknown")}>' return - suitname = suit['locName'] + suitname = suit['edmcName'] if (suitloadout := monitor.state.get('SuitLoadoutCurrent')) is None: self.suit['text'] = '' @@ -927,7 +927,7 @@ class AppWindow(object): if monitor.state.get('SuitCurrent') is not None: if (loadout := data.get('loadout')) is not None: if (suit := loadout.get('suit')) is not None: - if (suitname := suit.get('locName')) is not None: + if (suitname := suit.get('edmcName')) is not None: # We've been paranoid about loadout->suit->suitname, now just assume loadouts is there loadout_name = index_possibly_sparse_list( data['loadouts'], loadout['loadoutSlotId'] diff --git a/edmc_data.py b/edmc_data.py index 7aea749b..11a7db4d 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -495,3 +495,18 @@ ship_name_map = { 'viper_mkiv': 'Viper MkIV', 'vulture': 'Vulture', } + +# Odyssey Suit Names +edmc_suit_shortnames = { + 'Artemis Suit': 'Artemis', + 'Dominator Suit': 'Dominator', + 'Flight Suit': 'Flight', + 'Maverick Suit': 'Maverick', +} + +edmc_suit_symbol_to_en = { + 'explorationsuit': 'Artemis Suit', + 'flightsuit': 'Flight Suit', + 'tacticalsuit': 'Dominator Suit', + 'utilitysuit': 'Maverick Suit', +} diff --git a/monitor.py b/monitor.py index eca0d5b0..8f6736fd 100644 --- a/monitor.py +++ b/monitor.py @@ -19,6 +19,7 @@ if TYPE_CHECKING: import util_ships from config import config +from edmc_data import edmc_suit_shortnames, edmc_suit_symbol_to_en from EDMCLogging import get_main_logger logger = get_main_logger() @@ -1604,12 +1605,21 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below """ # TODO: Localisation ? # Stage 1: Is it in `$_Class_Name;` form ? - if (m := re.fullmatch(r'^\$([^_]+)_Class([0-9]+)_Name$', name)): + if m := re.fullmatch(r'^\$([^_]+)_Class([0-9]+)_Name;$', name): n, c = m.group(1, 2) name = n # Stage 2: Is it in `_class` form ? + elif m := re.fullmatch(r'^([^_]+)_class([0-9]+)$', name): + n, c = m.group(1, 2) + name = n + + # Now turn either of those into an English ' Suit' form + name = edmc_suit_symbol_to_en.get(name.lower(), name) + # Stage 3: Is it in verbose ` Suit` form ? + name = edmc_suit_shortnames.get(name, name) + return name def suitloadout_store_from_event(self, entry) -> Tuple[int, int]: From 43a7974da590302fc5793f2e92d0d401d066b3c0 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 16:05:34 +0100 Subject: [PATCH 11/34] Suits: Make suit name regex's case-insensitive (and tweak a comment) --- monitor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monitor.py b/monitor.py index 8f6736fd..4aa742b9 100644 --- a/monitor.py +++ b/monitor.py @@ -1605,19 +1605,19 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below """ # TODO: Localisation ? # Stage 1: Is it in `$_Class_Name;` form ? - if m := re.fullmatch(r'^\$([^_]+)_Class([0-9]+)_Name;$', name): + if m := re.fullmatch(r'(?i)^\$([^_]+)_Class([0-9]+)_Name;$', name): n, c = m.group(1, 2) name = n # Stage 2: Is it in `_class` form ? - elif m := re.fullmatch(r'^([^_]+)_class([0-9]+)$', name): + elif m := re.fullmatch(r'(?i)^([^_]+)_class([0-9]+)$', name): n, c = m.group(1, 2) name = n # Now turn either of those into an English ' Suit' form name = edmc_suit_symbol_to_en.get(name.lower(), name) - # Stage 3: Is it in verbose ` Suit` form ? + # Finally, map that to a form without the verbose ' Suit' on the end name = edmc_suit_shortnames.get(name, name) return name From e9e5352e3740fd9ac695f51c4f8a999e7c3c2b85 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 16:30:23 +0100 Subject: [PATCH 12/34] Suits: Set edmcName in `BuySuit` handling --- monitor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitor.py b/monitor.py index 4aa742b9..3b01ab3e 100644 --- a/monitor.py +++ b/monitor.py @@ -1135,10 +1135,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below # alpha4 : # { "timestamp":"2021-04-29T09:03:37Z", "event":"BuySuit", "Name":"UtilitySuit_Class1", # "Name_Localised":"Maverick Suit", "Price":150000, "SuitID":1698364934364699 } + loc_name = entry.get('Name_Localised', entry['Name']) self.state['Suits'][entry['SuitID']] = { 'name': entry['Name'], - 'locName': entry.get('Name_Localised', entry['Name']), - 'id': None, # Is this an FDev ID for suit type ? + 'locName': loc_name, + 'edmcName': self.suit_sane_name(loc_name), + 'id': None, # Is this an FDev ID for suit type ? 'suitId': entry['SuitID'], 'slots': [], } From bac718aeffc75f65eb8dd272ffd6d5afcbd65151 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 17:56:11 +0100 Subject: [PATCH 13/34] Store `Fileheader` language, gameversion and build in monitor.state --- PLUGINS.md | 3 +++ monitor.py | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/PLUGINS.md b/PLUGINS.md index 1eb2a4a2..cff302ef 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -566,6 +566,9 @@ Content of `state` (updated to the current journal entry): | Field | Type | Description | | :------------- | :-------------------------: | :-------------------------------------------------------------------------------------------------------------- | +| `GameLanguage` | `Optional[str]` | `language` value from `Fileheader` event. | +| `GameVersion` | `Optional[str]` | `version` value from `Fileheader` event. | +| `GameBuild` | `Optional[str]` | `build` value from `Fileheader` event. | | `Captain` | `Optional[str]` | Name of the commander who's crew you're on, if any | | `Cargo` | `dict` | Current cargo. Note that this will be totals, and any mission specific duplicates will be counted together | | `CargoJSON` | `dict` | content of cargo.json as of last read. | diff --git a/monitor.py b/monitor.py index 3b01ab3e..1ae82c05 100644 --- a/monitor.py +++ b/monitor.py @@ -115,6 +115,9 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below # Cmdr state shared with EDSM and plugins # If you change anything here update PLUGINS.md documentation! self.state: Dict = { + 'GameLanguage': None, # From `Fileheader + 'GameVersion': None, # From `Fileheader + 'GameBuild': None, # From `Fileheader 'Captain': None, # On a crew 'Cargo': defaultdict(int), 'Credits': None, @@ -497,13 +500,15 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below self.systemaddress = None self.started = None self.__init_state() + # In self.state as well, as that's what plugins get + self.stat['GameLanguage'] = entry['language'] + self.stat['GameVersion'] = entry['gameversion'] + self.stat['GameBuild'] = entry['build'] elif event_type == 'Commander': self.live = True # First event in 3.0 elif event_type == 'LoadGame': - # alpha4 - # Odyssey: bool self.cmdr = entry['Commander'] # 'Open', 'Solo', 'Group', or None for CQC (and Training - but no LoadGame event) self.mode = entry.get('GameMode') From 20f373a37d2b00ed29cf6456c2823401a55efb21 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 18:27:10 +0100 Subject: [PATCH 14/34] Suits: Localise out suit symbol name -> display name (stage1) lookup We'll need to localise the following 'shortname' lookup as well. --- edmc_data.py | 14 +++++++++----- monitor.py | 11 ++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/edmc_data.py b/edmc_data.py index 11a7db4d..009a5057 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -504,9 +504,13 @@ edmc_suit_shortnames = { 'Maverick Suit': 'Maverick', } -edmc_suit_symbol_to_en = { - 'explorationsuit': 'Artemis Suit', - 'flightsuit': 'Flight Suit', - 'tacticalsuit': 'Dominator Suit', - 'utilitysuit': 'Maverick Suit', +edmc_suit_symbol_localised = { + # The key here should match what's seen in Fileheader 'language', but with + # any in-file `\\` already unescaped to a single `\`. + r'English\UK': { + 'explorationsuit': 'Artemis Suit', + 'flightsuit': 'Flight Suit', + 'tacticalsuit': 'Dominator Suit', + 'utilitysuit': 'Maverick Suit', + }, } diff --git a/monitor.py b/monitor.py index 1ae82c05..06c82b88 100644 --- a/monitor.py +++ b/monitor.py @@ -19,7 +19,7 @@ if TYPE_CHECKING: import util_ships from config import config -from edmc_data import edmc_suit_shortnames, edmc_suit_symbol_to_en +from edmc_data import edmc_suit_shortnames, edmc_suit_symbol_localised from EDMCLogging import get_main_logger logger = get_main_logger() @@ -501,9 +501,9 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below self.started = None self.__init_state() # In self.state as well, as that's what plugins get - self.stat['GameLanguage'] = entry['language'] - self.stat['GameVersion'] = entry['gameversion'] - self.stat['GameBuild'] = entry['build'] + self.state['GameLanguage'] = entry['language'] + self.state['GameVersion'] = entry['gameversion'] + self.state['GameBuild'] = entry['build'] elif event_type == 'Commander': self.live = True # First event in 3.0 @@ -1622,7 +1622,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below name = n # Now turn either of those into an English ' Suit' form - name = edmc_suit_symbol_to_en.get(name.lower(), name) + if loc_lookup := edmc_suit_symbol_localised.get(self.state['GameLanguage']): + name = loc_lookup.get(name.lower(), name) # Finally, map that to a form without the verbose ' Suit' on the end name = edmc_suit_shortnames.get(name, name) From 033cfb7577a088da19cc02d63ff804117832c853 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Tue, 25 May 2021 19:09:55 +0100 Subject: [PATCH 15/34] Suits: Prepare for Russian localisation of names --- edmc_data.py | 1 + 1 file changed, 1 insertion(+) diff --git a/edmc_data.py b/edmc_data.py index 009a5057..fdaf0d39 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -513,4 +513,5 @@ edmc_suit_symbol_localised = { 'tacticalsuit': 'Dominator Suit', 'utilitysuit': 'Maverick Suit', }, + # r'Russian\RU': { } From f46618b61ce150aaca3e55ca50cd07360243be83 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 14:49:17 +0100 Subject: [PATCH 16/34] Suits: Added German localisations/short forms for names. --- PLUGINS.md | 5 +++++ edmc_data.py | 32 +++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/PLUGINS.md b/PLUGINS.md index cff302ef..31a20593 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -655,6 +655,11 @@ this is **NOT** the same as the return from because CAPI data doesn't (didn't always?) have an indication of Horizons or not. +New in version 5.0.3: + +The `Suits` members have an additional key:value pair `edmcName` which is our +preferred name for display on the UI, for the in-use game language. + ##### Synthetic Events A special "StartUp" entry is sent if EDMC is started while the game is already diff --git a/edmc_data.py b/edmc_data.py index fdaf0d39..387048a5 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -498,20 +498,42 @@ ship_name_map = { # Odyssey Suit Names edmc_suit_shortnames = { - 'Artemis Suit': 'Artemis', - 'Dominator Suit': 'Dominator', - 'Flight Suit': 'Flight', - 'Maverick Suit': 'Maverick', + 'Flight Suit': 'Flight', # EN + 'Flug-Anzug': 'Flug', # DE + 'Artemis Suit': 'Artemis', # EN + 'Artemis-Anzug': 'Artemis', # DE + 'Dominator Suit': 'Dominator', # EN + 'Dominator-Anzug': 'Dominator', # DE + 'Maverick Suit': 'Maverick', # EN + 'Maverick-Anzug': 'Maverick', # DE } edmc_suit_symbol_localised = { # The key here should match what's seen in Fileheader 'language', but with # any in-file `\\` already unescaped to a single `\`. r'English\UK': { - 'explorationsuit': 'Artemis Suit', 'flightsuit': 'Flight Suit', + 'explorationsuit': 'Artemis Suit', 'tacticalsuit': 'Dominator Suit', 'utilitysuit': 'Maverick Suit', }, # r'Russian\RU': { + # { "timestamp":"2021-05-25T19:04:54Z", "event":"SwitchSuitLoadout", "SuitID":1700222635552764, "SuitName":"flightsuit", "SuitName_Localised":"Летный комбинезон", "LoadoutID":4293000000, "LoadoutName":"Снаряжение по умолчанию", "Modules":[ { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } + # { "timestamp":"2021-05-25T19:04:58Z", "event":"SwitchSuitLoadout", "SuitID":1700399023825621, "SuitName":"tacticalsuit_class1", "SuitName_Localised":"Комбинезон Dominator", "LoadoutID":4293000001, "LoadoutName":"Боевой 1", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700399051643021, "ModuleName":"wpn_m_sniper_plasma_charged", "ModuleName_Localised":"Manticore Executioner" }, { "SlotName":"PrimaryWeapon2", "SuitModuleID":1700399078090377, "ModuleName":"wpn_m_shotgun_plasma_doublebarrel", "ModuleName_Localised":"Manticore Intimidator" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } + # { "timestamp":"2021-05-25T19:05:02Z", "event":"SwitchSuitLoadout", "SuitID":1700575627706590, "SuitName":"tacticalsuit_class2", "SuitName_Localised":"$TacticalSuit_Class1_Name;", "LoadoutID":4293000002, "LoadoutName":"Снаряжение: 1", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700575634697937, "ModuleName":"wpn_m_assaultrifle_plasma_fauto", "ModuleName_Localised":"Manticore Oppressor" }, { "SlotName":"PrimaryWeapon2", "SuitModuleID":1700399051643021, "ModuleName":"wpn_m_sniper_plasma_charged", "ModuleName_Localised":"Manticore Executioner" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } + # { "timestamp":"2021-05-25T19:05:05Z", "event":"SwitchSuitLoadout", "SuitID":1700563770964710, "SuitName":"utilitysuit_class1", "SuitName_Localised":"Комбинезон Maverick", "LoadoutID":4293000003, "LoadoutName":"ывы ", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700399078090377, "ModuleName":"wpn_m_shotgun_plasma_doublebarrel", "ModuleName_Localised":"Manticore Intimidator" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } + # { "timestamp":"2021-05-25T19:05:07Z", "event":"SwitchSuitLoadout", "SuitID":1700571499909982, "SuitName":"explorationsuit_class2", "SuitName_Localised":"$ExplorationSuit_Class1_Name;", "LoadoutID":4293000004, "LoadoutName":"Снаряжение: 2", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700399061224625, "ModuleName":"wpn_m_submachinegun_kinetic_fauto", "ModuleName_Localised":"Karma C-44" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } + # { "timestamp":"2021-05-25T19:05:18Z", "event":"SuitLoadout", "SuitID":1700571499909982, "SuitName":"explorationsuit_class2", "SuitName_Localised":"$ExplorationSuit_Class1_Name;", "LoadoutID":4293000004, "LoadoutName":"Снаряжение: 2", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700399061224625, "ModuleName":"wpn_m_submachinegun_kinetic_fauto", "ModuleName_Localised":"Karma C-44" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } + # { "timestamp":"2021-05-25T19:05:18Z", "event":"BackPack" } + # { "timestamp":"2021-05-25T19:05:19Z", "event":"ReceiveText", "From":"Crown Prospect", "Message":"$STATION_NoFireZone_entered;", "Message_Localised":"Вы вошли в зону запрета огня", "Channel":"npc" } + # { "timestamp":"2021-05-25T19:05:32Z", "event":"BuySuit", "Name":"ExplorationSuit_Class1", "Name_Localised":"Комбинезон Artemis", "Price":150000, "SuitID":1700758324607786 } + # { "timestamp":"2021-05-25T19:05:47Z", "event":"Friends", "Status":"Online", "Name":"Automatic system" } + # { "timestamp":"2021-05-25T19:05:51Z", "event":"CreateSuitLoadout", "SuitID":1700758324607786, "SuitName":"explorationsuit_class1", "SuitName_Localised":"Комбинезон Artemis", "LoadoutID":4293000005, "LoadoutName":"Снаряжение: 3", "Modules":[ ] } + # { "timestamp":"2021-05-25T19:05:53Z", "event":"SwitchSuitLoadout", "SuitID":1700758324607786, "SuitName":"explorationsuit_class1", "SuitName_Localised":"Комбинезон Artemis", "LoadoutID":4293000005, "LoadoutName":"Снаряжение: 3", "Modules":[ ] } + r'German\DE': { + 'flightsuit': 'Flug-Anzug', + 'explorationsuit': 'Artemis-Anzug', + 'tacticalsuit': 'Dominator-Anzug', + 'utilitysuit': 'Maverick-Anzug', + }, } From e93ab9033e3684c571819ede4eaeeec468ec23b3 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 14:58:55 +0100 Subject: [PATCH 17/34] Suits: Spanish localisation and short names. The full string for the Flightsuit is 'Traje de vuelo', and we indeed have 'Traje' as the translation for 'Suit', so the UI comes out as 'Traje: de vuelo' for this. --- edmc_data.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/edmc_data.py b/edmc_data.py index 387048a5..d06dd4db 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -500,12 +500,16 @@ ship_name_map = { edmc_suit_shortnames = { 'Flight Suit': 'Flight', # EN 'Flug-Anzug': 'Flug', # DE + 'Traje de vuelo': 'de vuelo', # ES 'Artemis Suit': 'Artemis', # EN 'Artemis-Anzug': 'Artemis', # DE + 'Traje Artemis': 'Artemis', # ES 'Dominator Suit': 'Dominator', # EN 'Dominator-Anzug': 'Dominator', # DE + 'Traje Dominator': 'Dominator', # ES 'Maverick Suit': 'Maverick', # EN 'Maverick-Anzug': 'Maverick', # DE + 'Traje Maverick': 'Maverick', # ES } edmc_suit_symbol_localised = { @@ -536,4 +540,10 @@ edmc_suit_symbol_localised = { 'tacticalsuit': 'Dominator-Anzug', 'utilitysuit': 'Maverick-Anzug', }, + r'Spanish\ES': { + 'flightsuit': 'Traje de vuelo', + 'explorationsuit': 'Traje Artemis', + 'tacticalsuit': 'Traje Dominator', + 'utilitysuit': 'Traje Maverick', + }, } From 7b613b6124d04dcffc3e1194432e7b978f9ab01d Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 15:07:28 +0100 Subject: [PATCH 18/34] Suits: Russian name localisation and short names --- edmc_data.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/edmc_data.py b/edmc_data.py index d06dd4db..06652a7d 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -500,16 +500,20 @@ ship_name_map = { edmc_suit_shortnames = { 'Flight Suit': 'Flight', # EN 'Flug-Anzug': 'Flug', # DE + 'Летный комбинезон': 'Летный', # RU 'Traje de vuelo': 'de vuelo', # ES 'Artemis Suit': 'Artemis', # EN 'Artemis-Anzug': 'Artemis', # DE - 'Traje Artemis': 'Artemis', # ES + 'Traje Artemis': 'Artemis', # ES + 'Комбинезон Artemis': 'Artemis', # RU 'Dominator Suit': 'Dominator', # EN 'Dominator-Anzug': 'Dominator', # DE 'Traje Dominator': 'Dominator', # ES + 'Комбинезон Dominator': 'Dominator', # RU 'Maverick Suit': 'Maverick', # EN 'Maverick-Anzug': 'Maverick', # DE 'Traje Maverick': 'Maverick', # ES + 'Комбинезон Maverick': 'Maverick', # RU } edmc_suit_symbol_localised = { @@ -521,19 +525,12 @@ edmc_suit_symbol_localised = { 'tacticalsuit': 'Dominator Suit', 'utilitysuit': 'Maverick Suit', }, - # r'Russian\RU': { - # { "timestamp":"2021-05-25T19:04:54Z", "event":"SwitchSuitLoadout", "SuitID":1700222635552764, "SuitName":"flightsuit", "SuitName_Localised":"Летный комбинезон", "LoadoutID":4293000000, "LoadoutName":"Снаряжение по умолчанию", "Modules":[ { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } - # { "timestamp":"2021-05-25T19:04:58Z", "event":"SwitchSuitLoadout", "SuitID":1700399023825621, "SuitName":"tacticalsuit_class1", "SuitName_Localised":"Комбинезон Dominator", "LoadoutID":4293000001, "LoadoutName":"Боевой 1", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700399051643021, "ModuleName":"wpn_m_sniper_plasma_charged", "ModuleName_Localised":"Manticore Executioner" }, { "SlotName":"PrimaryWeapon2", "SuitModuleID":1700399078090377, "ModuleName":"wpn_m_shotgun_plasma_doublebarrel", "ModuleName_Localised":"Manticore Intimidator" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } - # { "timestamp":"2021-05-25T19:05:02Z", "event":"SwitchSuitLoadout", "SuitID":1700575627706590, "SuitName":"tacticalsuit_class2", "SuitName_Localised":"$TacticalSuit_Class1_Name;", "LoadoutID":4293000002, "LoadoutName":"Снаряжение: 1", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700575634697937, "ModuleName":"wpn_m_assaultrifle_plasma_fauto", "ModuleName_Localised":"Manticore Oppressor" }, { "SlotName":"PrimaryWeapon2", "SuitModuleID":1700399051643021, "ModuleName":"wpn_m_sniper_plasma_charged", "ModuleName_Localised":"Manticore Executioner" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } - # { "timestamp":"2021-05-25T19:05:05Z", "event":"SwitchSuitLoadout", "SuitID":1700563770964710, "SuitName":"utilitysuit_class1", "SuitName_Localised":"Комбинезон Maverick", "LoadoutID":4293000003, "LoadoutName":"ывы ", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700399078090377, "ModuleName":"wpn_m_shotgun_plasma_doublebarrel", "ModuleName_Localised":"Manticore Intimidator" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } - # { "timestamp":"2021-05-25T19:05:07Z", "event":"SwitchSuitLoadout", "SuitID":1700571499909982, "SuitName":"explorationsuit_class2", "SuitName_Localised":"$ExplorationSuit_Class1_Name;", "LoadoutID":4293000004, "LoadoutName":"Снаряжение: 2", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700399061224625, "ModuleName":"wpn_m_submachinegun_kinetic_fauto", "ModuleName_Localised":"Karma C-44" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } - # { "timestamp":"2021-05-25T19:05:18Z", "event":"SuitLoadout", "SuitID":1700571499909982, "SuitName":"explorationsuit_class2", "SuitName_Localised":"$ExplorationSuit_Class1_Name;", "LoadoutID":4293000004, "LoadoutName":"Снаряжение: 2", "Modules":[ { "SlotName":"PrimaryWeapon1", "SuitModuleID":1700399061224625, "ModuleName":"wpn_m_submachinegun_kinetic_fauto", "ModuleName_Localised":"Karma C-44" }, { "SlotName":"SecondaryWeapon", "SuitModuleID":1700222635552854, "ModuleName":"wpn_s_pistol_kinetic_sauto", "ModuleName_Localised":"Karma P-15" } ] } - # { "timestamp":"2021-05-25T19:05:18Z", "event":"BackPack" } - # { "timestamp":"2021-05-25T19:05:19Z", "event":"ReceiveText", "From":"Crown Prospect", "Message":"$STATION_NoFireZone_entered;", "Message_Localised":"Вы вошли в зону запрета огня", "Channel":"npc" } - # { "timestamp":"2021-05-25T19:05:32Z", "event":"BuySuit", "Name":"ExplorationSuit_Class1", "Name_Localised":"Комбинезон Artemis", "Price":150000, "SuitID":1700758324607786 } - # { "timestamp":"2021-05-25T19:05:47Z", "event":"Friends", "Status":"Online", "Name":"Automatic system" } - # { "timestamp":"2021-05-25T19:05:51Z", "event":"CreateSuitLoadout", "SuitID":1700758324607786, "SuitName":"explorationsuit_class1", "SuitName_Localised":"Комбинезон Artemis", "LoadoutID":4293000005, "LoadoutName":"Снаряжение: 3", "Modules":[ ] } - # { "timestamp":"2021-05-25T19:05:53Z", "event":"SwitchSuitLoadout", "SuitID":1700758324607786, "SuitName":"explorationsuit_class1", "SuitName_Localised":"Комбинезон Artemis", "LoadoutID":4293000005, "LoadoutName":"Снаряжение: 3", "Modules":[ ] } + r'Russian\RU': { + 'flightsuit': 'Летный комбинезон', + 'explorationsuit': 'Комбинезон Artemis', + 'tacticalsuit': 'Комбинезон Dominator', + 'utilitysuit': 'Комбинезон Maverick', + }, r'German\DE': { 'flightsuit': 'Flug-Anzug', 'explorationsuit': 'Artemis-Anzug', From a38834c8eb90283bd84aa1505735b7177369d491 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 15:15:27 +0100 Subject: [PATCH 19/34] Suits: French name localisations and short names Also re-arranged/re-formatted the shortnames to be grouped by language, rather than suit. --- edmc_data.py | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/edmc_data.py b/edmc_data.py index 06652a7d..29513dda 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -499,20 +499,28 @@ ship_name_map = { # Odyssey Suit Names edmc_suit_shortnames = { 'Flight Suit': 'Flight', # EN - 'Flug-Anzug': 'Flug', # DE - 'Летный комбинезон': 'Летный', # RU - 'Traje de vuelo': 'de vuelo', # ES 'Artemis Suit': 'Artemis', # EN - 'Artemis-Anzug': 'Artemis', # DE - 'Traje Artemis': 'Artemis', # ES - 'Комбинезон Artemis': 'Artemis', # RU 'Dominator Suit': 'Dominator', # EN - 'Dominator-Anzug': 'Dominator', # DE - 'Traje Dominator': 'Dominator', # ES - 'Комбинезон Dominator': 'Dominator', # RU 'Maverick Suit': 'Maverick', # EN + + 'Flug-Anzug': 'Flug', # DE + 'Artemis-Anzug': 'Artemis', # DE + 'Dominator-Anzug': 'Dominator', # DE 'Maverick-Anzug': 'Maverick', # DE + + 'Traje de vuelo': 'de vuelo', # ES + 'Traje Artemis': 'Artemis', # ES + 'Traje Dominator': 'Dominator', # ES 'Traje Maverick': 'Maverick', # ES + + 'Combinaison de vol': 'de vol', # FR + 'Combinaison Artemis': 'Artemis', # FR + 'Combinaison Dominator': 'Dominator', # FR + 'Combinaison Maverick': 'Maverick', # FR + + 'Летный комбинезон': 'Летный', # RU + 'Комбинезон Artemis': 'Artemis', # RU + 'Комбинезон Dominator': 'Dominator', # RU 'Комбинезон Maverick': 'Maverick', # RU } @@ -525,18 +533,24 @@ edmc_suit_symbol_localised = { 'tacticalsuit': 'Dominator Suit', 'utilitysuit': 'Maverick Suit', }, - r'Russian\RU': { - 'flightsuit': 'Летный комбинезон', - 'explorationsuit': 'Комбинезон Artemis', - 'tacticalsuit': 'Комбинезон Dominator', - 'utilitysuit': 'Комбинезон Maverick', - }, r'German\DE': { 'flightsuit': 'Flug-Anzug', 'explorationsuit': 'Artemis-Anzug', 'tacticalsuit': 'Dominator-Anzug', 'utilitysuit': 'Maverick-Anzug', }, + r'French\FR': { + 'flightsuit': 'Combinaison de vol', + 'explorationsuit': 'Combinaison Artemis', + 'tacticalsuit': 'Combinaison Dominator', + 'utilitysuit': 'Combinaison Maverick', + }, + r'Russian\RU': { + 'flightsuit': 'Летный комбинезон', + 'explorationsuit': 'Комбинезон Artemis', + 'tacticalsuit': 'Комбинезон Dominator', + 'utilitysuit': 'Комбинезон Maverick', + }, r'Spanish\ES': { 'flightsuit': 'Traje de vuelo', 'explorationsuit': 'Traje Artemis', From 04c3b20c99272d82bd444c5a8a1157017a9e511e Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 15:28:35 +0100 Subject: [PATCH 20/34] Suits: Portugese (Brazil) (short)names localisation Also aligned all of the languages in the shortnames dict. --- edmc_data.py | 51 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/edmc_data.py b/edmc_data.py index 29513dda..1f6036cd 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -498,30 +498,35 @@ ship_name_map = { # Odyssey Suit Names edmc_suit_shortnames = { - 'Flight Suit': 'Flight', # EN - 'Artemis Suit': 'Artemis', # EN - 'Dominator Suit': 'Dominator', # EN - 'Maverick Suit': 'Maverick', # EN + 'Flight Suit': 'Flight', # EN + 'Artemis Suit': 'Artemis', # EN + 'Dominator Suit': 'Dominator', # EN + 'Maverick Suit': 'Maverick', # EN - 'Flug-Anzug': 'Flug', # DE - 'Artemis-Anzug': 'Artemis', # DE - 'Dominator-Anzug': 'Dominator', # DE - 'Maverick-Anzug': 'Maverick', # DE + 'Flug-Anzug': 'Flug', # DE + 'Artemis-Anzug': 'Artemis', # DE + 'Dominator-Anzug': 'Dominator', # DE + 'Maverick-Anzug': 'Maverick', # DE - 'Traje de vuelo': 'de vuelo', # ES - 'Traje Artemis': 'Artemis', # ES - 'Traje Dominator': 'Dominator', # ES - 'Traje Maverick': 'Maverick', # ES + 'Traje de vuelo': 'de vuelo', # ES + 'Traje Artemis': 'Artemis', # ES + 'Traje Dominator': 'Dominator', # ES + 'Traje Maverick': 'Maverick', # ES - 'Combinaison de vol': 'de vol', # FR - 'Combinaison Artemis': 'Artemis', # FR - 'Combinaison Dominator': 'Dominator', # FR - 'Combinaison Maverick': 'Maverick', # FR + 'Combinaison de vol': 'de vol', # FR + 'Combinaison Artemis': 'Artemis', # FR + 'Combinaison Dominator': 'Dominator', # FR + 'Combinaison Maverick': 'Maverick', # FR - 'Летный комбинезон': 'Летный', # RU - 'Комбинезон Artemis': 'Artemis', # RU - 'Комбинезон Dominator': 'Dominator', # RU - 'Комбинезон Maverick': 'Maverick', # RU + 'Traje voador': 'voador', # PT-BR + 'Traje Artemis': 'Artemis', # PT-BR + 'Traje Dominator': 'Dominator', # PT-BR + 'Traje Maverick': 'Maverick', # PT-BR + + 'Летный комбинезон': 'Летный', # RU + 'Комбинезон Artemis': 'Artemis', # RU + 'Комбинезон Dominator': 'Dominator', # RU + 'Комбинезон Maverick': 'Maverick', # RU } edmc_suit_symbol_localised = { @@ -545,6 +550,12 @@ edmc_suit_symbol_localised = { 'tacticalsuit': 'Combinaison Dominator', 'utilitysuit': 'Combinaison Maverick', }, + r'Portuguese\BR': { + 'flightsuit': 'Traje voador', + 'explorationsuit': 'Traje Artemis', + 'tacticalsuit': 'Traje Dominator', + 'utilitysuit': 'Traje Maverick', + }, r'Russian\RU': { 'flightsuit': 'Летный комбинезон', 'explorationsuit': 'Комбинезон Artemis', From c3b87df1b0e5d21459204bf1c102f3824ca46208 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 16:07:34 +0100 Subject: [PATCH 21/34] EngineerProgress: Progress can be for a single engineer, no array This tweak means we'll look in the event itself instead, but still won't cope with missing expected keys. That's up next.... --- monitor.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/monitor.py b/monitor.py index eeedfbd6..304dc4a4 100644 --- a/monitor.py +++ b/monitor.py @@ -1651,7 +1651,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below :param entry: Journal event dict :return: True if passes validation, else False. """ - # The event should have at least one of thes + # The event should have at least one of these if 'Engineers' not in entry and 'Progress' not in entry: logger.warning(f"EngineerProgress has neither 'Engineers' nor 'Progress': {entry=}") return False @@ -1687,7 +1687,13 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below return False if 'Progress' in entry: - for e in entry['Engineers']: + # Progress can be only a single Engineer, so it's not an array + # { "timestamp":"2021-05-24T17:57:52Z", + # "event":"EngineerProgress", + # "Engineer":"Felicity Farseer", + # "EngineerID":300100, + # "Progress":"Invited" } + for e in entry.get('Engineers', entry): for f in ('Engineer', 'EngineerID', 'Rank', 'Progress', 'RankProgress'): if f not in e: logger.warning(f"Engineer entry without '{f}' key: {e=} in {entry=}") From af5ffabd305992628bdd2d9cc928f5324c0a89a5 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 16:10:36 +0100 Subject: [PATCH 22/34] EngineerProgress: Cope with no Rank/RankProgress in 'single engineer' form Yes, this isn't DRY, if we do the check a third time I'll pull it out into a helper function. --- monitor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/monitor.py b/monitor.py index 304dc4a4..667c17e1 100644 --- a/monitor.py +++ b/monitor.py @@ -1696,6 +1696,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below for e in entry.get('Engineers', entry): for f in ('Engineer', 'EngineerID', 'Rank', 'Progress', 'RankProgress'): if f not in e: + # For some Progress there's no Rank/RankProgress yet + if f in ('Rank', 'RankProgress'): + if (progress := e.get('Progress', None)) is not None: + if progress in ('Invited', 'Known'): + continue + logger.warning(f"Engineer entry without '{f}' key: {e=} in {entry=}") return False From 6f100a3ebf6aa50546067ce0ce60423204fe4570 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 16:17:20 +0100 Subject: [PATCH 23/34] EngineerProgress: Duh, we already checked for the array, this is the array-less form This was never properly edited after copy/paste from the "we have an array" form. --- monitor.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/monitor.py b/monitor.py index 667c17e1..c6837b2f 100644 --- a/monitor.py +++ b/monitor.py @@ -1687,23 +1687,22 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below return False if 'Progress' in entry: - # Progress can be only a single Engineer, so it's not an array + # Progress is only a single Engineer, so it's not an array # { "timestamp":"2021-05-24T17:57:52Z", # "event":"EngineerProgress", # "Engineer":"Felicity Farseer", # "EngineerID":300100, # "Progress":"Invited" } - for e in entry.get('Engineers', entry): - for f in ('Engineer', 'EngineerID', 'Rank', 'Progress', 'RankProgress'): - if f not in e: - # For some Progress there's no Rank/RankProgress yet - if f in ('Rank', 'RankProgress'): - if (progress := e.get('Progress', None)) is not None: - if progress in ('Invited', 'Known'): - continue + for f in ('Engineer', 'EngineerID', 'Rank', 'Progress', 'RankProgress'): + if f not in entry: + # For some Progress there's no Rank/RankProgress yet + if f in ('Rank', 'RankProgress'): + if (progress := entry.get('Progress', None)) is not None: + if progress in ('Invited', 'Known'): + continue - logger.warning(f"Engineer entry without '{f}' key: {e=} in {entry=}") - return False + logger.warning(f"Progress event without '{f}' key: {entry=}") + return False return True From 4d5d9ae645954166e8d3649381a37547a3729f95 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 27 May 2021 09:21:13 +0100 Subject: [PATCH 24/34] config: appversion: Use `+DIRTY` to ensure SemVer compliance. It's also more succinct. We know what it means. --- config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index fb644a73..d958aad8 100644 --- a/config.py +++ b/config.py @@ -96,7 +96,7 @@ def git_shorthash_from_head() -> str: """ Determine short hash for current git HEAD. - Includes -DIRTY if any changes have been made from HEAD + Includes +DIRTY if any changes have been made from HEAD :return: str - None if we couldn't determine the short hash. """ @@ -122,7 +122,7 @@ def git_shorthash_from_head() -> str: with contextlib.suppress(Exception): result = subprocess.run('git diff --stat HEAD'.split(), capture_output=True) if len(result.stdout) > 0: - shorthash += '-WORKING-DIR-IS-DIRTY' + shorthash += '+DIRTY' if len(result.stderr) > 0: logger.warning(f'Data from git on stderr:\n{str(result.stderr)}') From 4643d95f26b9e985acf573f77ae453fd2aa20f2a Mon Sep 17 00:00:00 2001 From: A_D Date: Thu, 27 May 2021 10:27:25 +0200 Subject: [PATCH 25/34] Add HACK/MAGIC/WORKAROUND comments --- Contributing.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Contributing.md b/Contributing.md index 0f57c12c..d1541369 100644 --- a/Contributing.md +++ b/Contributing.md @@ -325,6 +325,21 @@ literals. Doc strings are preferred on all new modules, functions, classes, and methods, as they help others understand your code. We use the `sphinx` formatting style, which for pycharm users is the default. +### Mark hacks and workarounds with a specific comment + +We often write hacks or workarounds to make EDMC work on a given version or around a specific bug. +Please mark all hacks, workarounds, magic with one of the following comments, where applicable: +``` +# HACK $elite-version-number | $date: $description +# MAGIC $elite-version-number | $date: $description +# WORKAROUND $elite-version-number | $date: $description +``` + +The description should cover exactly why the hack is needed, what it does, what is required / expected for it to be removed. +Please be verbose here, more info about weird choices is always prefered over magic that we struggle to understand in six months. + +Additionally, if your hack is giant, please include a `# HACK END` or similar comment to indicate the end of the hack. + --- ## Git commit conventions From cd8319bfc6472c13119ae7b15ac092a192ffee8e Mon Sep 17 00:00:00 2001 From: A_D Date: Thu, 27 May 2021 11:18:31 +0200 Subject: [PATCH 26/34] Clarify size of giant --- Contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contributing.md b/Contributing.md index d1541369..5b4518f1 100644 --- a/Contributing.md +++ b/Contributing.md @@ -338,7 +338,7 @@ Please mark all hacks, workarounds, magic with one of the following comments, wh The description should cover exactly why the hack is needed, what it does, what is required / expected for it to be removed. Please be verbose here, more info about weird choices is always prefered over magic that we struggle to understand in six months. -Additionally, if your hack is giant, please include a `# HACK END` or similar comment to indicate the end of the hack. +Additionally, if your hack is over around 5 lines, please include a `# HACK END` or similar comment to indicate the end of the hack. --- From e9973d239a8a2e5b739e0af5b24c47ac58d9c2fc Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 27 May 2021 11:09:52 +0100 Subject: [PATCH 27/34] Suits: Comment out 'duplicate' PT-BR shortnames They're the same key, and value, as the ES ones. PyCharm highlighted this, flake8 did not complain. There's a comment as to why they're commented out, but still present in that form. --- edmc_data.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/edmc_data.py b/edmc_data.py index 1f6036cd..45f424fc 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -519,9 +519,10 @@ edmc_suit_shortnames = { 'Combinaison Maverick': 'Maverick', # FR 'Traje voador': 'voador', # PT-BR - 'Traje Artemis': 'Artemis', # PT-BR - 'Traje Dominator': 'Dominator', # PT-BR - 'Traje Maverick': 'Maverick', # PT-BR + # These are duplicates of the ES ones, but kept here for clarity + # 'Traje Artemis': 'Artemis', # PT-BR + # 'Traje Dominator': 'Dominator', # PT-BR + # 'Traje Maverick': 'Maverick', # PT-BR 'Летный комбинезон': 'Летный', # RU 'Комбинезон Artemis': 'Artemis', # RU From a3598a1c40b76c2a9f2f4750d54f74a19e7b72af Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 27 May 2021 11:31:06 +0100 Subject: [PATCH 28/34] Suits: The symbol -> name code is a WORKAROUND --- monitor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitor.py b/monitor.py index a753e6b1..fd69a594 100644 --- a/monitor.py +++ b/monitor.py @@ -1610,7 +1610,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below :param name: Name that could be in any of the forms. :return: Our sane version of this suit's name. """ - # TODO: Localisation ? + # WORKAROUND 4.0.0.200 | 2021-05-27: Suit names above Grade 1 aren't localised + # properly by Frontier, so we do it ourselves. # Stage 1: Is it in `$_Class_Name;` form ? if m := re.fullmatch(r'(?i)^\$([^_]+)_Class([0-9]+)_Name;$', name): n, c = m.group(1, 2) @@ -1621,9 +1622,10 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below n, c = m.group(1, 2) name = n - # Now turn either of those into an English ' Suit' form + # Now turn either of those into a ' Suit' (modulo language) form if loc_lookup := edmc_suit_symbol_localised.get(self.state['GameLanguage']): name = loc_lookup.get(name.lower(), name) + # WORKAROUND END # Finally, map that to a form without the verbose ' Suit' on the end name = edmc_suit_shortnames.get(name, name) From 6a1a2673ecda4d7909c5ffb0167fb88d70ea1436 Mon Sep 17 00:00:00 2001 From: A_D Date: Thu, 27 May 2021 12:45:03 +0200 Subject: [PATCH 29/34] Update MicroResource tracking for 4.0.0.200 This updates our TransferMicroResources handler with the changes from v4.0.0.200, and BackPack handler to also handle Backpack as the event name. Additionally Fixed various events (CollectItems, DropItems, TransferMicroResources) doubling up BackpackChange work, thus causing offset counts. Fixes #1115 --- monitor.py | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/monitor.py b/monitor.py index fd69a594..eff8799f 100644 --- a/monitor.py +++ b/monitor.py @@ -877,7 +877,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below {self.canonicalise(x['Name']): x['Count'] for x in clean_data} ) - elif event_type == 'BackPack': + elif event_type in ('BackPack', 'Backpack'): # WORKAROUND 4.0.0.200: BackPack becomes Backpack # TODO: v31 doc says this is`backpack.json` ... but Howard Chalkley # said it's `Backpack.json` with open(join(self.currentdir, 'Backpack.json'), 'rb') as backpack: # type: ignore @@ -984,19 +984,15 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below elif event_type == 'TransferMicroResources': # Moving Odyssey MicroResources between ShipLocker and BackPack + # Backpack dropped as its done in BackpackChange + # + # from: 4.0.0.200 -- Locker(Old|New)Count is now a thing. for mr in entry['Transfers']: category = self.category(mr['Category']) name = self.canonicalise(mr['Name']) - if mr['Direction'] == 'ToShipLocker': - self.state[category][name] += mr['Count'] - self.state['BackPack'][category][name] -= mr['Count'] - - elif mr['Direction'] == 'ToBackpack': - self.state[category][name] -= mr['Count'] - self.state['BackPack'][category][name] += mr['Count'] - - else: + self.state[category][name] = mr['LockerNewCount'] + if mr['Direction'] not in ('ToShipLocker', 'ToBackpack'): logger.warning(f'TransferMicroResources with unexpected Direction {mr["Direction"]=}: {mr=}') # Paranoia check to see if anything has gone negative. @@ -1014,9 +1010,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below # • Name # • Type # • OwnerID - for i in self.state['BackPack'][entry['Type']]: - if i == entry['Name']: - self.state['BackPack'][entry['Type']][i] += entry['Count'] + + # Handled by BackpackChange + # for i in self.state['BackPack'][entry['Type']]: + # if i == entry['Name']: + # self.state['BackPack'][entry['Type']][i] += entry['Count'] + pass elif event_type == 'DropItems': # alpha4 @@ -1026,12 +1025,15 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below # • OwnerID # • MissionID # • Count - for i in self.state['BackPack'][entry['Type']]: - if i == entry['Name']: - self.state['BackPack'][entry['Type']][i] -= entry['Count'] - # Paranoia in case we lost track - if self.state['BackPack'][entry['Type']][i] < 0: - self.state['BackPack'][entry['Type']][i] = 0 + + # This is handled by BackpackChange. + # for i in self.state['BackPack'][entry['Type']]: + # if i == entry['Name']: + # self.state['BackPack'][entry['Type']][i] -= entry['Count'] + # # Paranoia in case we lost track + # if self.state['BackPack'][entry['Type']][i] < 0: + # self.state['BackPack'][entry['Type']][i] = 0 + pass elif event_type == 'UseConsumable': # TODO: XXX: From v31 doc From efcf5dda2cac541388310d12c4ed2c937638cbea Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 27 May 2021 12:46:46 +0100 Subject: [PATCH 30/34] appversion 'DIRTY': Separator must be `.` --- config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index d958aad8..f2350ab2 100644 --- a/config.py +++ b/config.py @@ -96,7 +96,7 @@ def git_shorthash_from_head() -> str: """ Determine short hash for current git HEAD. - Includes +DIRTY if any changes have been made from HEAD + Includes `.DIRTY` if any changes have been made from HEAD :return: str - None if we couldn't determine the short hash. """ @@ -122,7 +122,7 @@ def git_shorthash_from_head() -> str: with contextlib.suppress(Exception): result = subprocess.run('git diff --stat HEAD'.split(), capture_output=True) if len(result.stdout) > 0: - shorthash += '+DIRTY' + shorthash += '.DIRTY' if len(result.stderr) > 0: logger.warning(f'Data from git on stderr:\n{str(result.stderr)}') From b11486c64cd312c50a418ca3bfaa655338792152 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 27 May 2021 13:57:28 +0100 Subject: [PATCH 31/34] PLUGINS.md: Document new language/gameversion/gamebuild state fields. --- PLUGINS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PLUGINS.md b/PLUGINS.md index 31a20593..1dd0e4e8 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -660,6 +660,11 @@ New in version 5.0.3: The `Suits` members have an additional key:value pair `edmcName` which is our preferred name for display on the UI, for the in-use game language. +The "language", "gameversion" and "build" values from the "Fileheader" event +are all now stored in `state[]` fields; "GameLanguage", "GameVersion" and +"GameBuild". + + ##### Synthetic Events A special "StartUp" entry is sent if EDMC is started while the game is already From 8a3351869fd83634891878d26446ab687d9037af Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 27 May 2021 14:17:08 +0100 Subject: [PATCH 32/34] Release 5.0.3: appversion and changelog --- ChangeLog.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ config.py | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index c73af664..a2140dc1 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -17,6 +17,54 @@ This is the master changelog for Elite Dangerous Market Connector. Entries are in the source (it's not distributed with the Windows installer) for the currently used version in a given branch. +Release 5.0.3 +=== + +* You can now click on a 'cell' in the "File" > "Status" popup to copy that + text to the clipboard. This was a relatively easy, and non-intrusive, code + change. We'll look at richer, fuller, copy functionality in the future. + +* Suit names, for all grades, should now be displaying as just the relevant + word, never a symbol, and with the redundant 'suit' word(s) from all + languages removed. Note that Frontier have *not* translated the + following, so neither do we: "Artemis", "Dominator", "Maverick". The 'Flight + Suit' should, approximately, use the Frontier-supplied translation for + 'Flight' in this context. In essence the displayed name is now as short + as possible whilst disambiguating the suit names from each other. + +Bug Fixes +--- + +* The check for "source, but with extra changes?" in appversion will now + not cause an error if the "git" command isn't available. Also, the extra + text added to the build number is now ".DIRTY". + +* Actually properly handle the "you just made progress" version of the + `EngineerProgress` Journal event, so that it doesn't throw errors. + +Plugin Developers +--- + +* The backpack and ship locker tracking of micro-resources might now + actually be correct with respect to 'reality' in-game. This is in part + thanks to Frontier changes to some events in 4.0.0.200. + +* Suit names will now only be sourced from Journal events if the + application didn't (yet) have the equivalent CAPI data. + +* The displayed Suit name is stored in an extra "edmcName" key within + `state['Suits']` and `state['SuitCurrent']`. What was found in the + Journal or CAPI data is still present in the "name" and "locName" values. + +* The "language", "gameversion" and "build" values from the "Fileheader" event + are all now stored in `state[]` fields. See [PLUGINS.md](./PLUGINS.md) for + updated documentation. + +* We have a new [Contributing.md](./Contributing.md) policy of adding + comments in a defined format when we add or change code such that there's a + 'hack', 'magic' or 'workaround' in play. You might find some of this + enlightening going forwards. + Release 5.0.2 === diff --git a/config.py b/config.py index f2350ab2..e0f5c444 100644 --- a/config.py +++ b/config.py @@ -33,7 +33,7 @@ appcmdname = 'EDMC' # # Major.Minor.Patch(-prerelease)(+buildmetadata) # NB: Do *not* import this, use the functions appversion() and appversion_nobuild() -_static_appversion = '5.0.3-beta0' +_static_appversion = '5.0.3-rc1' copyright = '© 2015-2019 Jonathan Harris, 2020-2021 EDCD' update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml' From 00ba3b5a41d2e6507c8f72e21d6c646a0ab5e3e1 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 27 May 2021 14:30:17 +0100 Subject: [PATCH 33/34] Translations: Latest from OneSky --- ChangeLog.md | 2 +- L10n/cs.strings | 6 ++++++ L10n/de.strings | 6 ++++++ L10n/es.strings | 6 ++++++ L10n/fi.strings | 21 +++++++++++++++++++++ L10n/fr.strings | 3 +++ L10n/ko.strings | 6 ++++++ L10n/pl.strings | 6 ++++++ L10n/ru.strings | 6 ++++++ L10n/sr-Latn-BA.strings | 6 ++++++ L10n/sr-Latn.strings | 6 ++++++ 11 files changed, 73 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index a2140dc1..f6844c63 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -45,7 +45,7 @@ Bug Fixes Plugin Developers --- -* The backpack and ship locker tracking of micro-resources might now +* The backpack and ship locker tracking of micro-resources **might** now actually be correct with respect to 'reality' in-game. This is in part thanks to Frontier changes to some events in 4.0.0.200. diff --git a/L10n/cs.strings b/L10n/cs.strings index 35a85378..0582c905 100644 --- a/L10n/cs.strings +++ b/L10n/cs.strings @@ -230,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "Cesta k souboru"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Dotaz na Frontier CAPI selhal"; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Chyba Frontier CAPI serveru"; + /* CQC rank. [stats.py] */ "Gladiator" = "Gladiator"; diff --git a/L10n/de.strings b/L10n/de.strings index cf994243..f2a9f170 100644 --- a/L10n/de.strings +++ b/L10n/de.strings @@ -230,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "Speicherort"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Frontier CAPI Anfrage gescheitert"; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Frontier CAPI Server-Fehler"; + /* CQC rank. [stats.py] */ "Gladiator" = "Gladiator"; diff --git a/L10n/es.strings b/L10n/es.strings index f0d59d08..24178743 100644 --- a/L10n/es.strings +++ b/L10n/es.strings @@ -230,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "Localización de archivos"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Fallo de consulta del CAPI de Frontier"; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Error de servidor CAPI de Frontier"; + /* CQC rank. [stats.py] */ "Gladiator" = "Gladiador"; diff --git a/L10n/fi.strings b/L10n/fi.strings index 5f21226f..d77cd871 100644 --- a/L10n/fi.strings +++ b/L10n/fi.strings @@ -124,6 +124,15 @@ /* Location of the new Journal file in E:D 2.2. [EDMarketConnector.py] */ "E:D journal file location" = "E:D lokikirjan tiedostosijainti"; +/* When EDDB functionality has been killswitched. [plugins/eddb.py] */ +"EDDB Journal processing disabled. See Log." = "EDDB lokikirjan käsittely ei käytössä. Katso lokitiedot."; + +/* When EDDN journal handling has been killswitched [plugins/eddn.py] */ +"EDDN journal handler disabled. See Log." = "EDDB lokikirjan käsittelijä ei käytössä. Katso lokitiedot."; + +/* When EDSM functionality has been killswitched [plugins/edsm.py] */ +"EDSM Handler disabled. See Log." = "ESDM käsittelijä ei käytössä. Katso lokitiedot."; + /* Empire rank. [stats.py] */ "Earl" = "Earl"; @@ -173,6 +182,9 @@ "Error: EDSM {MSG}" = "Virhe: EDSM {MSG}"; +/* Raised when cannot contact the Companion API server. [companion.py] */ +"Error: Frontier CAPI didn't respond" = "Virhe: Frontier CAPI ei vastaa."; + /* OLD: Raised when cannot contact the Companion API server. [companion.py] */ "Error: Frontier server is down" = "Virhe: Frontierin palvelin ei vastaa"; @@ -218,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "Tiedostosijainti"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Frontier CAPI kyselyvirhe."; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Frontier CAPI palvelinvirhe."; + /* CQC rank. [stats.py] */ "Gladiator" = "Gladiator"; @@ -251,6 +269,9 @@ /* Section heading in settings. [inara.py] */ "Inara credentials" = "Inaran kirjautuminen"; +/* When Inara support has been killswitched [plugins/inara.py] */ +"Inara disabled. See Log." = "Inara ei käytössä. Katso lokitiedot."; + /* Settings>Plugins>Information on migrating plugins [prefs.py] */ "Information on migrating plugins" = "Tietoja lisäosien siirrosta"; diff --git a/L10n/fr.strings b/L10n/fr.strings index 932dd3bd..e845c70b 100644 --- a/L10n/fr.strings +++ b/L10n/fr.strings @@ -461,6 +461,9 @@ /* Menu item. [EDMarketConnector.py] */ "Status" = "État"; +/* 'Suit' label in main UI' [EDMarketConnector.py] */ +"Suit" = "Combinaison"; + /* Explorer rank. [stats.py] */ "Surveyor" = "Éclaireur"; diff --git a/L10n/ko.strings b/L10n/ko.strings index 088231f6..ff2eaec0 100644 --- a/L10n/ko.strings +++ b/L10n/ko.strings @@ -230,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "파일 위치"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Frontier CAPI 쿼리 실패"; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Frontier CAPI 서버 에러"; + /* CQC rank. [stats.py] */ "Gladiator" = "Gladiator"; diff --git a/L10n/pl.strings b/L10n/pl.strings index 6e84ce7c..4f7e306f 100644 --- a/L10n/pl.strings +++ b/L10n/pl.strings @@ -230,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "Położenie pliku"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Błąd zapytania CAPI Frontier"; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Błąd serwera CAPI Frontier"; + /* CQC rank. [stats.py] */ "Gladiator" = "Gladiator"; diff --git a/L10n/ru.strings b/L10n/ru.strings index 677d518a..91eaa285 100644 --- a/L10n/ru.strings +++ b/L10n/ru.strings @@ -230,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "Путь хранения файлов"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Неудача при запросе к Frontier CAPI"; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Серверная ошибка Frontier CAPI"; + /* CQC rank. [stats.py] */ "Gladiator" = "Гладиатор"; diff --git a/L10n/sr-Latn-BA.strings b/L10n/sr-Latn-BA.strings index 27072cba..71fe0765 100644 --- a/L10n/sr-Latn-BA.strings +++ b/L10n/sr-Latn-BA.strings @@ -230,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "Lokacija fajlova"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Frontier CAPI neuspješan upit"; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Frontier CAPI serverska greška"; + /* CQC rank. [stats.py] */ "Gladiator" = "Gladiator"; diff --git a/L10n/sr-Latn.strings b/L10n/sr-Latn.strings index 0c51b415..0166358d 100644 --- a/L10n/sr-Latn.strings +++ b/L10n/sr-Latn.strings @@ -230,6 +230,12 @@ /* Section heading in settings. [prefs.py] */ "File location" = "Lokacija fajlova"; +/* Failures to access Frontier CAPI endpoints [companion.py] */ +"Frontier CAPI query failure" = "Greška pri Frontier CAPI upitu"; + +/* Server errors from Frontier CAPI server [companion.py] */ +"Frontier CAPI server error" = "Greška na Frontier CAPI serveru"; + /* CQC rank. [stats.py] */ "Gladiator" = "Gladiator"; From 6bac280a43ebb73b86039f411e576f1ffa4b226c Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 27 May 2021 15:05:59 +0100 Subject: [PATCH 34/34] Release 5.0.3: No longer an -rc1 --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index e0f5c444..d0fa3043 100644 --- a/config.py +++ b/config.py @@ -33,7 +33,7 @@ appcmdname = 'EDMC' # # Major.Minor.Patch(-prerelease)(+buildmetadata) # NB: Do *not* import this, use the functions appversion() and appversion_nobuild() -_static_appversion = '5.0.3-rc1' +_static_appversion = '5.0.3' copyright = '© 2015-2019 Jonathan Harris, 2020-2021 EDCD' update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'