Browse Source

Add compatibility with PyQt5 and python3.

PyQt5 is used by calibre since version 2.0.

Python3 is used by calibre since version 5.0.
master
ibu ☉ radempa 2 years ago
parent
commit
208bcae522
  1. 16
      theanarchistlibrary_store/theanarchistlibrary_plugin.py

16
theanarchistlibrary_store/theanarchistlibrary_plugin.py

@ -2,13 +2,17 @@ __license__ = 'GPL 3'
__copyright__ = '2012, Ruben Pollan <meskio@sindominio.net>'
__docformat__ = 'restructuredtext en'
import urllib2
from contextlib import closing
try:
from urllib.parse import quote
except:
from urllib2 import quote
try:
from PyQt5.Qt import QUrl
except:
from PyQt4.Qt import QUrl
from contextlib import closing
import json
from PyQt4.Qt import QUrl
from calibre import browser
from calibre.gui2 import open_url
from calibre.gui2.store import StorePlugin
@ -30,7 +34,7 @@ class TheAnarchistLibraryStore(BasicStoreConfig, StorePlugin):
d.exec_()
def search(self, query, max_results=10, timeout=60):
url = 'http://theanarchistlibrary.org/search?fmt=json&query=' + urllib2.quote(query)
url = 'http://theanarchistlibrary.org/search?fmt=json&query=' + quote(query)
br = browser()

Loading…
Cancel
Save