[postr] Avoid hard coded file size limit (#551472)
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [postr] Avoid hard coded file size limit (#551472)
- Date: Wed, 4 Nov 2009 22:15:46 +0000 (UTC)
commit 08f23abdee0ef5beb4f0661d3c6f18ae1ebbd8f0
Author: Germán Póo-Caamaño <gpoo gnome org>
Date: Wed Nov 4 19:13:59 2009 -0300
Avoid hard coded file size limit (#551472)
Uses the API to ask Flickr the maximum file size allowed to
upload pictures.
src/StatusBar.py | 1 +
src/postr.py | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/StatusBar.py b/src/StatusBar.py
index 1865db3..4cc7aed 100644
--- a/src/StatusBar.py
+++ b/src/StatusBar.py
@@ -46,6 +46,7 @@ class StatusBar(gtk.Label):
def update_quota(self):
"""Call Flickr to get the current upload quota, and update the status bar."""
def got_quota(rsp):
+ self.maxfile = int(rsp.find("user/filesize").get("maxmb"))
if int(rsp.find("user").get("ispro")):
self.quota = None
else:
diff --git a/src/postr.py b/src/postr.py
index 7351064..3b38f86 100644
--- a/src/postr.py
+++ b/src/postr.py
@@ -586,9 +586,9 @@ class Postr(UniqueApp):
d.show_all()
return
- if filesize > 20 * 1024 * 1024:
+ if filesize > self.statusbar.maxfile * 1024 * 1024:
d = ErrorDialog(self.window)
- d.set_from_string("Image %s is too large, images must be no larger than 20MB in size." % filename)
+ d.set_from_string("Image %s is too large, images must be no larger than %dMB in size." % (filename, self.statusbar.maxfile))
d.show_all()
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]