From 0cc35db96b560f971a78b3d4f30003a37805bc18 Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Tue, 18 Jun 2024 22:02:41 -0400 Subject: [PATCH] [2262] SLEF to this var --- plugins/inara.py | 6 +++++- ttkHyperlinkLabel.py | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/inara.py b/plugins/inara.py index 3fd42f34..c3f030c4 100644 --- a/plugins/inara.py +++ b/plugins/inara.py @@ -107,6 +107,7 @@ class This: self.fleet: list[dict[str, Any]] | None = None self.shipswap: bool = False # just swapped ship self.on_foot = False + self.SLEF: str | None = None self.timer_run = True @@ -1504,7 +1505,10 @@ def make_slef(entry) -> None: 'Modules': entry['Modules'], }) initial_dict.update({'data': data_dict}) - json.dump(initial_dict, open('inara.json', 'w'), indent=4) + output = json.dumps(initial_dict, indent=4) + this.SLEF = str(output) + print('set output') + print(type(this.SLEF)) return None diff --git a/ttkHyperlinkLabel.py b/ttkHyperlinkLabel.py index 6266d9fb..95ebd2e7 100644 --- a/ttkHyperlinkLabel.py +++ b/ttkHyperlinkLabel.py @@ -194,6 +194,11 @@ class HyperlinkLabel(tk.Label or ttk.Label): # type: ignore menu.add_command(label=tr.tl('Copy'), command=self.copy) # As in Copy and Paste if self.name == 'ship': + # TODO: Get SLEF from Inara + # print(self.SLEF) + # menu.add_command(label=tr.tl('Copy INARA SLEF'), command=lambda: self.copy_slef(self), state=tk.DISABLED) + # menu.entryconfigure(1, state=self.SLEF and tk.NORMAL or tk.DISABLED) + menu.add_separator() for url in plug.provides('shipyard_url'): menu.add_command( @@ -224,3 +229,8 @@ class HyperlinkLabel(tk.Label or ttk.Label): # type: ignore """Copy the current text to the clipboard.""" self.clipboard_clear() self.clipboard_append(self['text']) + + # def copy_slef(self, this) -> None: + # """Copy the current text to the clipboard.""" + # self.clipboard_clear() + # self.clipboard_append(this.SLEF)