PIL isn't part of standard lib
This commit is contained in:
parent
d20c102642
commit
134f6ac286
|
|
@ -370,6 +370,8 @@ def open_file(widget=None):
|
|||
if i.type=="Image":
|
||||
i.path = svlgui.SECURETEMPDIR+"/"+i.path.split(os.sep)[-1]
|
||||
i.set_image(i.path)
|
||||
if not hasattr(i, 'iname'):
|
||||
i.iname = None
|
||||
MainWindow.stage.add(root, 0, 0)
|
||||
MainWindow.stage.draw()
|
||||
MainWindow.timelinebox.root = root
|
||||
|
|
@ -391,9 +393,17 @@ def save_file(widget=None):
|
|||
lastpath = os.path.abspath(".")
|
||||
for i in svlgui.Library:
|
||||
if i.type=="Image":
|
||||
os.chdir(os.sep.join(i.path.split(os.sep)[:-1]))
|
||||
print "i.path: ",i.path
|
||||
try:
|
||||
os.chdir(os.sep.join(i.path.split(os.sep)[:-1]) or i.origpath)
|
||||
i.path = i.path.split(os.sep)[-1]
|
||||
thetarfile.add(i.path.split(os.sep)[-1])
|
||||
except OSError:
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
os.chdir(tmpdir)
|
||||
i.pilimage.save(i.path)
|
||||
thetarfile.add(i.path)
|
||||
os.remove(i.path)
|
||||
os.chdir(lastpath)
|
||||
thetarfile.close()
|
||||
svlgui.FILE = thetarfile
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class MainWindow:
|
|||
self.hbox1.add(self.buttonbox)
|
||||
self.vbox1 = svlgui.VBox(700,-1)
|
||||
self.hbox1.add(self.vbox1)
|
||||
self.stage = svlgui.Canvas(800,600)
|
||||
self.stage = svlgui.Canvas(1200,1100)
|
||||
self.timeline = svlgui.Canvas(2048,100)
|
||||
self.timelineref = svlgui.Canvas(128,100)
|
||||
self.timelinehbox = svlgui.HBox()
|
||||
|
|
@ -191,7 +191,7 @@ class MainWindowOSX:
|
|||
unity = False
|
||||
self.window = svlgui.Window("Lightningbeam")
|
||||
self.menu = svlgui.Menu(True, None)
|
||||
self.stage = svlgui.Canvas(800,600)
|
||||
self.stage = svlgui.Canvas(1200,1100)
|
||||
misc_funcs.stage = self.stage
|
||||
self.layerbox = svlgui.Canvas(128,320)
|
||||
self.timelinebox = svlgui.FramesCanvas(2000,320)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ import random
|
|||
import colors
|
||||
import platform
|
||||
import re
|
||||
try:
|
||||
from PIL import Image as PILimage
|
||||
except ImportError:
|
||||
GLEnablable = False
|
||||
|
||||
'''
|
||||
# Tool mode. Keyboard shortcut is the same key. Modes are:
|
||||
|
|
@ -1035,6 +1039,7 @@ class Image(object):
|
|||
dict = self.__dict__.copy()
|
||||
print dict
|
||||
dict['image'] = None
|
||||
dict['pilimage'] = None
|
||||
return dict
|
||||
def __init__(self,image,x=0,y=0,animated=False,canvas=None,htiles=1,vtiles=1,skipl=False):
|
||||
if not skipl:
|
||||
|
|
@ -1051,7 +1056,9 @@ class Image(object):
|
|||
self.linecolor = None
|
||||
self.fillcolor = None
|
||||
self.name = image.split(sep)[-1]
|
||||
self.iname = None
|
||||
self.path = image
|
||||
self.pilimage = PILimage.open(image)
|
||||
self.type="Image"
|
||||
if animated:
|
||||
self.animated = True
|
||||
|
|
@ -1674,6 +1681,8 @@ class frame:
|
|||
else:
|
||||
for i in self.objs:
|
||||
if not i.obj in [j.obj for j in misc_funcs.lastval(self.parent.frames,self.parent.frames.index(self)).objs]:
|
||||
if not hasattr(i.obj, "iname"):
|
||||
i.obj.iname = None
|
||||
if i.obj.iname:
|
||||
retval = retval+".put "+i.obj.iname+"="+i.name+" x="+str(i.x)+" y="+str(i.y)+"\n"
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue