From dd8ec061d300781ceac821b3a62db194ce1acd52 Mon Sep 17 00:00:00 2001
From: Athanasius <github@miggy.org>
Date: Sun, 10 Oct 2021 15:40:41 +0100
Subject: [PATCH] EDDN: Dummy tracking UI to determine layout

---
 EDMarketConnector.py |  3 +++
 plugins/eddn.py      | 35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/EDMarketConnector.py b/EDMarketConnector.py
index 95426754..593d3adf 100755
--- a/EDMarketConnector.py
+++ b/EDMarketConnector.py
@@ -189,6 +189,9 @@ if __name__ == '__main__':  # noqa: C901
     if args.eddn_url:
         config.set_eddn_url(args.eddn_url)
 
+    if args.eddn_tracking_ui:
+        config.set_eddn_tracking_ui()
+
     if args.force_edmc_protocol:
         if sys.platform == 'win32':
             config.set_auth_force_edmc_protocol()
diff --git a/plugins/eddn.py b/plugins/eddn.py
index 48ed2b9f..28c65d95 100644
--- a/plugins/eddn.py
+++ b/plugins/eddn.py
@@ -79,6 +79,12 @@ class This:
         self.eddn_delay: tk.IntVar
         self.eddn_delay_button: nb.Checkbutton
 
+        # Tracking UI
+        self.ui: Optional[tk.Frame] = None
+        self.ui_j_body_name: Optional[tk.Label] = None
+        self.ui_j_body_id: Optional[tk.Label] = None
+        self.ui_s_body_name: Optional[tk.Label] = None
+
 
 this = This()
 
@@ -942,7 +948,7 @@ def plugin_start3(plugin_dir: str) -> str:
     return 'EDDN'
 
 
-def plugin_app(parent: tk.Tk) -> None:
+def plugin_app(parent: tk.Tk) -> Optional[tk.Frame]:
     """
     Set up any plugin-specific UI.
 
@@ -953,6 +959,7 @@ def plugin_app(parent: tk.Tk) -> None:
           necessary.
 
     :param parent: tkinter parent frame.
+    :return: Optional tk.Frame, if the tracking UI is active.
     """
     this.parent = parent
     this.eddn = EDDN(parent)
@@ -961,6 +968,32 @@ def plugin_app(parent: tk.Tk) -> None:
         # Shouldn't happen - don't bother localizing
         this.parent.children['status']['text'] = 'Error: Is another copy of this app already running?'
 
+    if config.eddn_tracking_ui:
+        this.ui = tk.Frame(parent)
+
+        row = this.ui.grid_size()[1]
+        journal_body_name_label = tk.Label(this.ui, text="J:BodyName:")
+        journal_body_name_label.grid(row=row, column=0, sticky=tk.W)
+        this.ui_j_body_name = tk.Label(this.ui, text='<>')
+        this.ui_j_body_name.grid(row=row, column=1, sticky=tk.E)
+        row += 1
+
+        journal_body_id_label = tk.Label(this.ui, text="J:BodyID:")
+        journal_body_id_label.grid(row=row, column=0, sticky=tk.W)
+        this.ui_j_body_id = tk.Label(this.ui, text='<>')
+        this.ui_j_body_id.grid(row=row, column=1, sticky=tk.E)
+        row += 1
+
+        status_body_name_label = tk.Label(this.ui, text="S:BodyName:")
+        status_body_name_label.grid(row=row, column=0, sticky=tk.W)
+        this.ui_s_body_name = tk.Label(this.ui, text='<>')
+        this.ui_s_body_name.grid(row=row, column=1, sticky=tk.E)
+        row += 1
+
+        return this.ui
+
+    return None
+
 
 def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
     """