From 70e9976a341506a6591b7574aeac6d1738626fba Mon Sep 17 00:00:00 2001
From: Jonathan Harris <jonathan@marginal.org.uk>
Date: Thu, 27 Oct 2016 19:09:41 +0100
Subject: [PATCH] Also send balance on Update.

---
 EDMarketConnector.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/EDMarketConnector.py b/EDMarketConnector.py
index 254316a9..4438b55c 100755
--- a/EDMarketConnector.py
+++ b/EDMarketConnector.py
@@ -446,6 +446,17 @@ class AppWindow:
                             if not old_status:
                                 self.status['text'] = ''
 
+                    # Update credits and send to EDSM
+                    if data['commander'].get('credits') is not None:
+                        monitor.credits = (data['commander']['credits'], data['commander'].get('debt', 0))
+                        if config.getint('output') & config.OUT_SYS_EDSM and not monitor.is_beta:
+                            try:
+                                self.edsm.setcredits(monitor.credits)
+                            except Exception as e:
+                                # Not particularly important so silent on failure
+                                if __debug__: print_exc()
+
+
         except companion.VerificationRequired:
             return prefs.AuthenticationDialog(self.w, partial(self.verify, self.getandsend))