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
|
|
@ -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
|
||||
|
|
@ -114,8 +116,8 @@ class Galleroob(ReplApplication):
|
|||
try:
|
||||
os.mkdir(dest)
|
||||
except OSError:
|
||||
pass # ignore error on existing directory
|
||||
os.chdir(dest) # fail here if dest couldn't be created
|
||||
pass # ignore error on existing directory
|
||||
os.chdir(dest) # fail here if dest couldn't be created
|
||||
|
||||
i = 0
|
||||
for img in backend.iter_gallery_images(gallery):
|
||||
|
|
@ -123,9 +125,9 @@ class Galleroob(ReplApplication):
|
|||
if i < first:
|
||||
continue
|
||||
|
||||
backend.fillobj(img, ('url','data'))
|
||||
backend.fillobj(img, ('url', 'data'))
|
||||
if img.data is None:
|
||||
backend.fillobj(img, ('url','data'))
|
||||
backend.fillobj(img, ('url', 'data'))
|
||||
if img.data is None:
|
||||
print >>sys.stderr, "Couldn't get page %d, exiting" % i
|
||||
break
|
||||
|
|
@ -136,7 +138,6 @@ class Galleroob(ReplApplication):
|
|||
else:
|
||||
ext = "jpg"
|
||||
|
||||
|
||||
name = '%03d.%s' % (i, ext)
|
||||
print 'Writing file %s' % name
|
||||
|
||||
|
|
@ -155,7 +156,7 @@ class Galleroob(ReplApplication):
|
|||
|
||||
gallery = self.get_object(_id, 'get_gallery')
|
||||
if not gallery:
|
||||
print >>sys.stderr, 'Gallery not found: %s' % _id
|
||||
print >>sys.stderr, 'Gallery not found: %s' % _id
|
||||
return 3
|
||||
self.format(gallery)
|
||||
self.flush()
|
||||
|
|
|
|||
|
|
@ -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,17 +69,19 @@ 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)
|
||||
|
||||
def progress(self, percent, message):
|
||||
self.setValue(int(percent*100))
|
||||
self.setValue(int(percent * 100))
|
||||
self.setLabelText(message)
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue