1
0

network: add singleton accessor classmethod, port trustedcoin to aiohttp

This commit is contained in:
Janus
2018-09-07 11:34:56 +02:00
parent 8f4b57f718
commit 52b877ac3d
5 changed files with 51 additions and 46 deletions

View File

@@ -103,11 +103,6 @@ class CrashReporter(BaseCrashReporter, Factory.Popup):
self.ids.crash_message.text = BaseCrashReporter.CRASH_MESSAGE
self.ids.request_help_message.text = BaseCrashReporter.REQUEST_HELP_MESSAGE
self.ids.describe_error_message.text = BaseCrashReporter.DESCRIBE_ERROR_MESSAGE
self.proxy = self.main_window.network.proxy
self.main_window.network.register_callback(self.set_proxy, ['proxy_set'])
def set_proxy(self, evt, proxy):
self.proxy = proxy
def show_contents(self):
details = CrashReportDetails(self.get_report_string())
@@ -121,7 +116,9 @@ class CrashReporter(BaseCrashReporter, Factory.Popup):
def send_report(self):
try:
response = json.loads(BaseCrashReporter.send_report(self, self.main_window.network.asyncio_loop, self.proxy, "/crash.json"))
loop = self.main_window.network.asyncio_loop
proxy = self.main_window.network.proxy
response = json.loads(BaseCrashReporter.send_report(self, loop, proxy, "/crash.json"))
except (ValueError, ClientError):
self.show_popup(_('Unable to send report'), _("Please check your network connection."))
else:

View File

@@ -42,9 +42,6 @@ class Exception_Window(BaseCrashReporter, QWidget, MessageBoxMixin):
BaseCrashReporter.__init__(self, exctype, value, tb)
self.main_window = main_window
self.proxy = self.main_window.network.proxy
self.main_window.network.register_callback(self.set_proxy, ['proxy_set'])
QWidget.__init__(self)
self.setWindowTitle('Electrum - ' + _('An Error Occurred'))
self.setMinimumSize(600, 300)
@@ -92,12 +89,10 @@ class Exception_Window(BaseCrashReporter, QWidget, MessageBoxMixin):
self.setLayout(main_box)
self.show()
def set_proxy(self, evt, proxy):
self.proxy = proxy
def send_report(self):
try:
response = BaseCrashReporter.send_report(self, self.main_window.network.asyncio_loop, self.proxy)
proxy = self.main_window.network.proxy
response = BaseCrashReporter.send_report(self, self.main_window.network.asyncio_loop, proxy)
except BaseException as e:
traceback.print_exc(file=sys.stderr)
self.main_window.show_critical(_('There was a problem with the automatic reporting:') + '\n' +