Commits

Brendan Howell committed d3b2f52 Merge

Merged in jonnor/pycessing/setup-image-fixes1 (pull request #1)

Comments (0)

Files changed (5)

         self.file_name = file_name
         self.loaded = False
         self.rotation = 0
-        self.scalex = None
-        self.scaley = None
+        self.scalex = 1.0
+        self.scaley = 1.0
         
         
     def _loadSurface_(self):
         """load image from file or file_obj"""
+
         try:
-            path = os.path.join(PROJECT_DIR, self.file_name)
-            surface = pygame.image.load(path).convert_alpha()
-        except:
-            path = self.file_name
-            buf = io.BytesIO(path.read())
-            surface = pygame.image.load(buf).convert_alpha()
+            imagelike = io.BytesIO(self.file_name.read())
+        except AttributeError:
+            imagelike = os.path.join(PROJECT_DIR, self.file_name)
+        surface = pygame.image.load(imagelike).convert_alpha()
         
         self.width = surface.get_width()
         self.height = surface.get_height()    
 
     def _loadSurface_(self):
         """load image from file or file_obj"""
+
         try:
-            path = os.path.join(PROJECT_DIR, self.file_name)
-            self.surface = pygame.image.load(path).convert_alpha()
-        except:
-            path = self.file_name
-            buf = io.BytesIO(path.read())
-            self.surface = pygame.image.load(buf).convert_alpha()
+            imagelike = io.BytesIO(self.file_name.read())
+        except AttributeError:
+            imagelike = os.path.join(PROJECT_DIR, self.file_name)
+        self.surface = pygame.image.load(imagelike).convert_alpha()
+
         self.original_surface = self.surface.copy()
         self.loaded = True
     
 """
-    drawing.py
+    pycess.py
     Copyright 2009 Brendan Howell (brendan@howell-ersatz.com)
 
     This file is part of PyCessing.
 """
-    drawing.py
+    run.py
     Copyright 2012 Brendan Howell (brendan@howell-ersatz.com)
 
     This file is part of PyCessing.
 from drawing_cairo import *
 import images
 import typo
-from images import Image
+from images import Image2 as Image
 from sounds import Sound
 from typo import ScreenText
 
          #packages = ["mainwindow.py","run.py"],
          py_modules = ["mainwindow","run","drawing_cairo","images","pycess","sounds","typo"],
          data_files = [("examples",glob(r'examples/*')),
-                       ("help",glob(r'help/*')),
+                       ("help",glob(r'help/*.html')),
+                       ("help/media/css", glob(r'help/media/css/*')),
+                       ("help/media/examples", glob(r'help/media/examples/*')),
                        ("icons",glob(r'icons/*')),
          ],
          version = VERSION,
 """
-    drawing.py
+    sounds.py
     Copyright 2009 Brendan Howell (brendan@howell-ersatz.com)
 
     This file is part of PyCessing.