def __on_gearth(self, _event): tempPath = tempfile.mkdtemp() tempFile = os.path.join(tempPath, 'RTLSDRScannerLink.kml') handle = open(tempFile, 'wb') create_gearth(handle) handle.close() if not run_file(tempFile): wx.MessageBox('Error starting Google Earth', 'Error', wx.OK | wx.ICON_ERROR)
def __on_kml(self, _event): tempPath = tempfile.mkdtemp() tempFile = os.path.join(tempPath, "RTLSDRScannerLink.kml") handle = open(tempFile, "wb") handle.write( '<?xml version="1.0" encoding="UTF-8"?>\n' '<kml xmlns="http://www.opengis.net/kml/2.2">\n' "\t<NetworkLink>\n" "\t\t<name>{}</name>\n" "\t\t<flyToView>1</flyToView>\n" "\t\t<open>1</open>\n" "\t\t<Link>\n" "\t\t\t<href>http://localhost:{}</href>\n" "\t\t\t<refreshMode>onInterval</refreshMode>\n" "\t\t\t<refreshInterval>10</refreshInterval>\n" "\t\t</Link>\n" "\t</NetworkLink>\n" "</kml>\n".format(APP_NAME, KML_PORT) ) handle.close() if not run_file(tempFile): wx.MessageBox("Error starting Google Earth", "Error", wx.OK | wx.ICON_ERROR)