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:
Laurent Bachelier 2012-03-12 21:37:51 +01:00 committed by Romain Bignon
commit 062f2c4c3e
10 changed files with 30 additions and 16 deletions

View file

@ -8,6 +8,7 @@
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
from __future__ import with_statement
from weboob.capabilities.video import ICapVideo
from weboob.tools.backend import BaseBackend

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# 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.tools.backend import BaseBackend, BackendConfig
@ -83,4 +84,3 @@ class CreditMutuelBackend(BaseBackend, ICapBank):
with self.browser:
return self.browser.transfer(account, to, amount, reason)

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# 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.tools.backend import BaseBackend, BackendConfig
@ -58,7 +59,6 @@ class FreeMobileBackend(BaseBackend, ICapBill):
else:
raise SubscriptionNotFound()
def iter_history(self, subscription):
raise NotImplementedError()
@ -70,4 +70,3 @@ class FreeMobileBackend(BaseBackend, ICapBill):
with self.browser:
for detail in self.browser.get_details():
yield detail

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# 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.tools.backend import BaseBackend, BackendConfig

View file

@ -17,6 +17,8 @@
# You should have received a copy of the GNU Affero General Public License
# 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.tools.backend import BaseBackend

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# 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.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.tools.backend import BaseBackend
from .browser import RadioFranceBrowser, RadioFranceVideo

View file

@ -17,6 +17,8 @@
# You should have received a copy of the GNU Affero General Public License
# 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.tools.backend import BaseBackend

View file

@ -1,9 +1,12 @@
#!/usr/bin/env python
from __future__ import with_statement
import glob
import subprocess
import os
import sys
def check_executable(executable):
with open('/dev/null', 'w') as 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
sys.exit(1)
def install_xdg():
print 'installing desktop menu files'
check_executable('xdg-desktop-menu')

View file

@ -17,6 +17,8 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from __future__ import with_statement
import sys
import os
from re import search, sub
@ -136,7 +138,6 @@ class Galleroob(ReplApplication):
else:
ext = "jpg"
name = '%03d.%s' % (i, ext)
print 'Writing file %s' % name

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from __future__ import with_statement
from PyQt4.QtGui import QDialog, QTreeWidgetItem, QLabel, QFormLayout, \
QMessageBox, QPixmap, QImage, QIcon, QHeaderView, \
@ -56,6 +57,7 @@ class RepositoriesDialog(QDialog):
fp.write(self.ui.reposEdit.toPlainText())
self.accept()
class IconFetcher(QThread):
def __init__(self, weboob, item, minfo):
QThread.__init__(self)
@ -67,6 +69,7 @@ class IconFetcher(QThread):
self.weboob.repositories.retrieve_icon(self.minfo)
self.emit(SIGNAL('retrieved'), self)
class ProgressDialog(IProgress, QProgressDialog):
def __init__(self, *args, **kwargs):
QProgressDialog.__init__(self, *args, **kwargs)
@ -78,6 +81,7 @@ class ProgressDialog(IProgress, QProgressDialog):
def error(self, message):
QMessageBox.critical(self, self.tr('Error'), '%s' % message, QMessageBox.Ok)
class BackendCfg(QDialog):
def __init__(self, weboob, caps=None, parent=None):
QDialog.__init__(self, parent)