Fix Python 2.5 support
And fix some PEP8 style issues (mostly about spaces) while I was there. refs #806
This commit is contained in:
parent
db85b651d4
commit
062f2c4c3e
10 changed files with 30 additions and 16 deletions
|
|
@ -8,10 +8,11 @@
|
||||||
# To Public License, Version 2, as published by Sam Hocevar. See
|
# To Public License, Version 2, as published by Sam Hocevar. See
|
||||||
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.capabilities.video import ICapVideo
|
from weboob.capabilities.video import ICapVideo
|
||||||
from weboob.tools.backend import BaseBackend
|
from weboob.tools.backend import BaseBackend
|
||||||
from .browser import CappedBrowser,CappedVideo
|
from .browser import CappedBrowser, CappedVideo
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['CappedBackend']
|
__all__ = ['CappedBackend']
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.capabilities.bank import ICapBank, AccountNotFound, Recipient, Account
|
from weboob.capabilities.bank import ICapBank, AccountNotFound, Recipient, Account
|
||||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||||
|
|
@ -83,4 +84,3 @@ class CreditMutuelBackend(BaseBackend, ICapBank):
|
||||||
|
|
||||||
with self.browser:
|
with self.browser:
|
||||||
return self.browser.transfer(account, to, amount, reason)
|
return self.browser.transfer(account, to, amount, reason)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.capabilities.bill import ICapBill, SubscriptionNotFound
|
from weboob.capabilities.bill import ICapBill, SubscriptionNotFound
|
||||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||||
|
|
@ -58,16 +59,14 @@ class FreeMobileBackend(BaseBackend, ICapBill):
|
||||||
else:
|
else:
|
||||||
raise SubscriptionNotFound()
|
raise SubscriptionNotFound()
|
||||||
|
|
||||||
|
|
||||||
def iter_history(self, subscription):
|
def iter_history(self, subscription):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def get_pdf(self, account):
|
def get_pdf(self, account):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
# The subscription is actually useless, but maybe for the futur...
|
# The subscription is actually useless, but maybe for the futur...
|
||||||
def get_details(self, subscription):
|
def get_details(self, subscription):
|
||||||
with self.browser:
|
with self.browser:
|
||||||
for detail in self.browser.get_details():
|
for detail in self.browser.get_details():
|
||||||
yield detail
|
yield detail
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
||||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.capabilities.housing import ICapHousing, City, Housing, HousingPhoto
|
from weboob.capabilities.housing import ICapHousing, City, Housing, HousingPhoto
|
||||||
from weboob.tools.backend import BaseBackend
|
from weboob.tools.backend import BaseBackend
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.capabilities.base import NotLoaded
|
from weboob.capabilities.base import NotLoaded
|
||||||
from weboob.capabilities.video import ICapVideo
|
from weboob.capabilities.video import ICapVideo
|
||||||
|
|
@ -24,7 +25,6 @@ from weboob.capabilities.radio import ICapRadio, Radio, Stream, Emission
|
||||||
from weboob.capabilities.collection import ICapCollection, CollectionNotFound, Collection
|
from weboob.capabilities.collection import ICapCollection, CollectionNotFound, Collection
|
||||||
from weboob.tools.backend import BaseBackend
|
from weboob.tools.backend import BaseBackend
|
||||||
|
|
||||||
|
|
||||||
from .browser import RadioFranceBrowser, RadioFranceVideo
|
from .browser import RadioFranceBrowser, RadioFranceVideo
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -40,8 +40,8 @@ class RadioFranceBackend(BaseBackend, ICapRadio, ICapCollection, ICapVideo):
|
||||||
LICENSE = 'AGPLv3+'
|
LICENSE = 'AGPLv3+'
|
||||||
BROWSER = RadioFranceBrowser
|
BROWSER = RadioFranceBrowser
|
||||||
|
|
||||||
_MP3_URL = u'http://mp3.live.tv-radio.com/%s/all/%s.mp3'
|
_MP3_URL = u'http://mp3.live.tv-radio.com/%s/all/%s.mp3'
|
||||||
_MP3_HD_URL = u'http://mp3.live.tv-radio.com/%s/all/%shautdebit.mp3'
|
_MP3_HD_URL = u'http://mp3.live.tv-radio.com/%s/all/%shautdebit.mp3'
|
||||||
_RADIOS = {'franceinter': (u'France Inter', True),
|
_RADIOS = {'franceinter': (u'France Inter', True),
|
||||||
'franceculture': (u'France Culture', True),
|
'franceculture': (u'France Culture', True),
|
||||||
'franceinfo': (u'France Info', False),
|
'franceinfo': (u'France Info', False),
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.capabilities.housing import ICapHousing, City, Housing, HousingPhoto
|
from weboob.capabilities.housing import ICapHousing, City, Housing, HousingPhoto
|
||||||
from weboob.tools.backend import BaseBackend
|
from weboob.tools.backend import BaseBackend
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def check_executable(executable):
|
def check_executable(executable):
|
||||||
with open('/dev/null', 'w') as devnull:
|
with open('/dev/null', 'w') as devnull:
|
||||||
process = subprocess.Popen(['which', executable], stdout=devnull)
|
process = subprocess.Popen(['which', executable], stdout=devnull)
|
||||||
|
|
@ -14,6 +17,7 @@ def check_executable(executable):
|
||||||
print >>sys.stderr, 'Error: %s is not installed on your system.' % executable
|
print >>sys.stderr, 'Error: %s is not installed on your system.' % executable
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def install_xdg():
|
def install_xdg():
|
||||||
print 'installing desktop menu files'
|
print 'installing desktop menu files'
|
||||||
check_executable('xdg-desktop-menu')
|
check_executable('xdg-desktop-menu')
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from re import search, sub
|
from re import search, sub
|
||||||
|
|
@ -114,8 +116,8 @@ class Galleroob(ReplApplication):
|
||||||
try:
|
try:
|
||||||
os.mkdir(dest)
|
os.mkdir(dest)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass # ignore error on existing directory
|
pass # ignore error on existing directory
|
||||||
os.chdir(dest) # fail here if dest couldn't be created
|
os.chdir(dest) # fail here if dest couldn't be created
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for img in backend.iter_gallery_images(gallery):
|
for img in backend.iter_gallery_images(gallery):
|
||||||
|
|
@ -123,9 +125,9 @@ class Galleroob(ReplApplication):
|
||||||
if i < first:
|
if i < first:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
backend.fillobj(img, ('url','data'))
|
backend.fillobj(img, ('url', 'data'))
|
||||||
if img.data is None:
|
if img.data is None:
|
||||||
backend.fillobj(img, ('url','data'))
|
backend.fillobj(img, ('url', 'data'))
|
||||||
if img.data is None:
|
if img.data is None:
|
||||||
print >>sys.stderr, "Couldn't get page %d, exiting" % i
|
print >>sys.stderr, "Couldn't get page %d, exiting" % i
|
||||||
break
|
break
|
||||||
|
|
@ -136,7 +138,6 @@ class Galleroob(ReplApplication):
|
||||||
else:
|
else:
|
||||||
ext = "jpg"
|
ext = "jpg"
|
||||||
|
|
||||||
|
|
||||||
name = '%03d.%s' % (i, ext)
|
name = '%03d.%s' % (i, ext)
|
||||||
print 'Writing file %s' % name
|
print 'Writing file %s' % name
|
||||||
|
|
||||||
|
|
@ -155,7 +156,7 @@ class Galleroob(ReplApplication):
|
||||||
|
|
||||||
gallery = self.get_object(_id, 'get_gallery')
|
gallery = self.get_object(_id, 'get_gallery')
|
||||||
if not gallery:
|
if not gallery:
|
||||||
print >>sys.stderr, 'Gallery not found: %s' % _id
|
print >>sys.stderr, 'Gallery not found: %s' % _id
|
||||||
return 3
|
return 3
|
||||||
self.format(gallery)
|
self.format(gallery)
|
||||||
self.flush()
|
self.flush()
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
from PyQt4.QtGui import QDialog, QTreeWidgetItem, QLabel, QFormLayout, \
|
from PyQt4.QtGui import QDialog, QTreeWidgetItem, QLabel, QFormLayout, \
|
||||||
QMessageBox, QPixmap, QImage, QIcon, QHeaderView, \
|
QMessageBox, QPixmap, QImage, QIcon, QHeaderView, \
|
||||||
|
|
@ -56,6 +57,7 @@ class RepositoriesDialog(QDialog):
|
||||||
fp.write(self.ui.reposEdit.toPlainText())
|
fp.write(self.ui.reposEdit.toPlainText())
|
||||||
self.accept()
|
self.accept()
|
||||||
|
|
||||||
|
|
||||||
class IconFetcher(QThread):
|
class IconFetcher(QThread):
|
||||||
def __init__(self, weboob, item, minfo):
|
def __init__(self, weboob, item, minfo):
|
||||||
QThread.__init__(self)
|
QThread.__init__(self)
|
||||||
|
|
@ -67,17 +69,19 @@ class IconFetcher(QThread):
|
||||||
self.weboob.repositories.retrieve_icon(self.minfo)
|
self.weboob.repositories.retrieve_icon(self.minfo)
|
||||||
self.emit(SIGNAL('retrieved'), self)
|
self.emit(SIGNAL('retrieved'), self)
|
||||||
|
|
||||||
|
|
||||||
class ProgressDialog(IProgress, QProgressDialog):
|
class ProgressDialog(IProgress, QProgressDialog):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
QProgressDialog.__init__(self, *args, **kwargs)
|
QProgressDialog.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
def progress(self, percent, message):
|
def progress(self, percent, message):
|
||||||
self.setValue(int(percent*100))
|
self.setValue(int(percent * 100))
|
||||||
self.setLabelText(message)
|
self.setLabelText(message)
|
||||||
|
|
||||||
def error(self, message):
|
def error(self, message):
|
||||||
QMessageBox.critical(self, self.tr('Error'), '%s' % message, QMessageBox.Ok)
|
QMessageBox.critical(self, self.tr('Error'), '%s' % message, QMessageBox.Ok)
|
||||||
|
|
||||||
|
|
||||||
class BackendCfg(QDialog):
|
class BackendCfg(QDialog):
|
||||||
def __init__(self, weboob, caps=None, parent=None):
|
def __init__(self, weboob, caps=None, parent=None):
|
||||||
QDialog.__init__(self, parent)
|
QDialog.__init__(self, parent)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue