Browse Source

Use QDesktopServices.openUrl() instead of webbrowser

Lipu Fei 5 years ago
parent
commit
4c792419e3
1 changed files with 4 additions and 2 deletions
  1. 4 2
      cura/OAuth2/AuthorizationService.py

+ 4 - 2
cura/OAuth2/AuthorizationService.py

@@ -2,12 +2,14 @@
 # Cura is released under the terms of the LGPLv3 or higher.
 
 import json
-import webbrowser
 from datetime import datetime, timedelta
 from typing import Optional, TYPE_CHECKING
 from urllib.parse import urlencode
+
 import requests.exceptions
 
+from PyQt5.QtCore import QUrl
+from PyQt5.QtGui import QDesktopServices
 
 from UM.Logger import Logger
 from UM.Message import Message
@@ -163,7 +165,7 @@ class AuthorizationService:
         })
 
         # Open the authorization page in a new browser window.
-        webbrowser.open_new("{}?{}".format(self._auth_url, query_string))
+        QDesktopServices.openUrl(QUrl("{}?{}".format(self._auth_url, query_string)))
 
         # Start a local web server to receive the callback URL on.
         self._server.start(verification_code)