Browse Source

browser.py: fix import lib

Arnau Sanchez 10 years ago
parent
commit
22d2252915
1 changed files with 6 additions and 10 deletions
  1. 6 10
      youtube_upload/auth/browser.py

+ 6 - 10
youtube_upload/auth/browser.py

@@ -1,22 +1,18 @@
-import lib
+from youtube_upload import lib
 
 
 try:
 try:
-    from youtube_upload.auth import webkit_qt
+    from youtube_upload.auth import webkit_qt as backend
     WEBKIT_BACKEND = "qt"
     WEBKIT_BACKEND = "qt"
 except ImportError:
 except ImportError:
-    from youtube_upload.auth import webkit_gtk
+    from youtube_upload.auth import webkit_gtk as backend
     WEBKIT_BACKEND = "gtk"
     WEBKIT_BACKEND = "gtk"
 except ImportError:
 except ImportError:
     WEBKIT_BACKEND = None
     WEBKIT_BACKEND = None
 
 
 def get_code(url, size=(640, 480), title="Google authentication"):
 def get_code(url, size=(640, 480), title="Google authentication"):
-    if WEBKIT_BACKEND == "qt":
-        lib.debug("Using webkit backend: QT")
+    if WEBKIT_BACKEND:
+        lib.debug("Using webkit backend: " + WEBKIT_BACKEND)
         with lib.default_sigint():
         with lib.default_sigint():
-            return webkit_qt.get_code(url, size=size, title=title)
-    elif WEBKIT_BACKEND == "gtk":
-        lib.debug("Using webkit backend: GTK")
-        with lib.default_sigint():
-            return webkit_gtk.get_code(url, size=size, title=title)
+            return backend.get_code(url, size=size, title=title)
     else:
     else:
         raise NotImplementedError("GUI auth requires pywebkitgtk or qtwebkit")
         raise NotImplementedError("GUI auth requires pywebkitgtk or qtwebkit")