Esempio n. 1
0
 def authorise(self):
     with Busy():
         # do full authentication procedure
         if self.auth_server:
             self.auth_server.running = False
             self.auth_server_thread.quit()
         self.auth_server = AuthServer()
         self.auth_server_thread = QtCore.QThread(self)
         self.auth_server.moveToThread(self.auth_server_thread)
         self.auth_server.response.connect(self.auth_response)
         self.auth_server_thread.started.connect(self.auth_server.start)
         self.auth_server_thread.start()
         redirect_uri = 'http://127.0.0.1:' + str(self.auth_server.port)
         auth_url = self.session.get_auth_url(redirect_uri)
         if not QtGui.QDesktopServices.openUrl(QtCore.QUrl(auth_url)):
             logger.error('Failed to open web browser')
             self.auth_server.running = False
             self.auth_server = None
             self.auth_server_thread.quit()
Esempio n. 2
0
 def authorise(self):
     with Busy():
         # do full authentication procedure
         http_server = HTTPServer(('127.0.0.1', 0), AuthRequestHandler)
         redirect_uri = 'http://127.0.0.1:' + str(http_server.server_port)
         auth_url = self.session.get_auth_url(redirect_uri)
         if not auth_url:
             logger.error('Failed to get auth URL')
             http_server.server_close()
             return
         server = AuthServer()
         thread = QtCore.QThread(self)
         server.moveToThread(thread)
         server.server = http_server
         server.response.connect(self.auth_response)
         thread.started.connect(server.handle_requests)
         server.finished.connect(thread.quit)
         server.finished.connect(server.deleteLater)
         thread.finished.connect(thread.deleteLater)
         thread.start()
         if QtGui.QDesktopServices.openUrl(QtCore.QUrl(auth_url)):
             return
         logger.error('Failed to open web browser')
Esempio n. 3
0
 def load_mapbox_tos(self):
     QtGui.QDesktopServices.openUrl(
         QtCore.QUrl('https://www.mapbox.com/tos/'))
Esempio n. 4
0
 def load_tou_osm(self):
     QtGui.QDesktopServices.openUrl(
         QtCore.QUrl('http://www.openstreetmap.org/copyright'))
Esempio n. 5
0
 def load_tou_opencage(self):
     QtGui.QDesktopServices.openUrl(
         QtCore.QUrl('https://geocoder.opencagedata.com/'))
Esempio n. 6
0
 def load_url(self, auth_url):
     self.browser.load(QtCore.QUrl(auth_url))
Esempio n. 7
0
 def open_docs(self):
     QtGui.QDesktopServices.openUrl(
         QtCore.QUrl('http://photini.readthedocs.io/'))