Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/turtleart.py
diff options
context:
space:
mode:
Diffstat (limited to 'turtleart.py')
-rwxr-xr-xturtleart.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/turtleart.py b/turtleart.py
index 57c34df..ee17366 100755
--- a/turtleart.py
+++ b/turtleart.py
@@ -477,7 +477,7 @@ class TurtleMain():
self.pop_up = gtk.Window()
self.pop_up.set_default_size(600, 400)
self.pop_up.connect('delete_event', self._stop_uploading)
- table = gtk.Table(False, 1, 8)
+ table = gtk.Table( 1, 8,False)
self.pop_up.add(table)
login_label = gtk.Label(_('You must have an account at \
http://turtleartsite.sugarlabs.org to upload your project.'))
@@ -553,7 +553,12 @@ http://turtleartsite.sugarlabs.org to upload your project.'))
description = self.description_entry.get_buffer().get_text(
*self.description_entry.get_buffer().get_bounds())
tafile, imagefile = self.tw.save_for_upload(title)
-
+ if int(os.path.getsize(imagefile))> 950000:
+ import Image
+ while int(os.path.getsize(imagefile))>950000:
+ im = Image.open(imagefile)
+ out = im.resize((int(.9*im.size[0]),int(.9*im.size[1])),Image.ANTIALIAS)
+ out.save(imagefile,quatlity = 100)
c = pycurl.Curl()
c.setopt(c.POST, 1)
c.setopt(c.FOLLOWLOCATION, 1)
@@ -565,18 +570,18 @@ http://turtleartsite.sugarlabs.org to upload your project.'))
('title', title),
('description', description),
('upload_key',key), ('_formname',
- 'image_create')])
+ 'image_create')])
c.perform()
error_code = c.getinfo(c.HTTP_CODE)
c.close
os.remove(imagefile)
os.remove(tafile)
if error_code == 400:
- self.login_message.set_text(_('Failed to upload!'))
+ self.login_message.set_text(_('Failed to upload!'))
else:
- self.pop_up.hide()
- self.uploading = False
-
+ self.pop_up.hide()
+ self.uploading = False
+
if __name__ == "__main__":
TurtleMain()