Can now open saved files with images
This commit is contained in:
parent
77a18d15c4
commit
d0adf42b5f
|
|
@ -312,9 +312,16 @@ def new_file(widget=None):
|
||||||
def open_file(widget=None):
|
def open_file(widget=None):
|
||||||
global root
|
global root
|
||||||
MainWindow.stage.delete(root)
|
MainWindow.stage.delete(root)
|
||||||
|
shutil.rmtree(svlgui.SECURETEMPDIR)
|
||||||
thetarfile = tarfile.open(fileobj=svlgui.file_dialog("open").open("rb"),mode="r:gz")
|
thetarfile = tarfile.open(fileobj=svlgui.file_dialog("open").open("rb"),mode="r:gz")
|
||||||
basefile = thetarfile.extractfile("basefile")
|
basefile = thetarfile.extractfile("basefile")
|
||||||
root, svlgui.Library = pickle.load(basefile)
|
root, svlgui.Library = pickle.load(basefile)
|
||||||
|
svlgui.SECURETEMPDIR = tempfile.mkdtemp()
|
||||||
|
thetarfile.extractall(path=svlgui.SECURETEMPDIR)
|
||||||
|
for i in svlgui.Library:
|
||||||
|
if i.type=="Image":
|
||||||
|
i.path = svlgui.SECURETEMPDIR+"/"+i.path.split(os.sep)[-1]
|
||||||
|
i.set_image(i.path)
|
||||||
MainWindow.stage.add(root, 0, 0)
|
MainWindow.stage.add(root, 0, 0)
|
||||||
MainWindow.stage.draw()
|
MainWindow.stage.draw()
|
||||||
MainWindow.timelinebox.root = root
|
MainWindow.timelinebox.root = root
|
||||||
|
|
|
||||||
12
svlgui.py
12
svlgui.py
|
|
@ -151,6 +151,7 @@ if sys.platform=="linux2":
|
||||||
#'''
|
#'''
|
||||||
import pickle
|
import pickle
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import tempfile
|
||||||
import GUI # Using PyGUI. Experimental.
|
import GUI # Using PyGUI. Experimental.
|
||||||
from GUI import Window as OSXWindow, Button as OSXButton, Image as OSXImage
|
from GUI import Window as OSXWindow, Button as OSXButton, Image as OSXImage
|
||||||
from GUI import Frame as OSXFrame, Color as OSXColor, Grid as OSXGrid
|
from GUI import Frame as OSXFrame, Color as OSXColor, Grid as OSXGrid
|
||||||
|
|
@ -174,6 +175,7 @@ elif sys.platform=="win32":
|
||||||
PLATFORM="win32"
|
PLATFORM="win32"
|
||||||
import pickle
|
import pickle
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import tempfile
|
||||||
import misc_funcs
|
import misc_funcs
|
||||||
import GUI # Using PyGUI. Experimental.
|
import GUI # Using PyGUI. Experimental.
|
||||||
from GUI import Window as OSXWindow, Button as OSXButton, Image as OSXImage
|
from GUI import Window as OSXWindow, Button as OSXButton, Image as OSXImage
|
||||||
|
|
@ -191,6 +193,7 @@ elif sys.platform=="win32":
|
||||||
elif sys.platform=="linux-armv6l":
|
elif sys.platform=="linux-armv6l":
|
||||||
import android
|
import android
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import tempfile
|
||||||
droid = android.Android()
|
droid = android.Android()
|
||||||
SYSTEM="android"
|
SYSTEM="android"
|
||||||
TEMPDIR="/tmp" # TODO:FIXTHIS
|
TEMPDIR="/tmp" # TODO:FIXTHIS
|
||||||
|
|
@ -202,6 +205,7 @@ elif sys.platform=="darwin":
|
||||||
import pickle
|
import pickle
|
||||||
import misc_funcs
|
import misc_funcs
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import tempfile
|
||||||
import GUI # Using PyGUI. Experimental.
|
import GUI # Using PyGUI. Experimental.
|
||||||
from GUI import Window as OSXWindow, Button as OSXButton, Image as OSXImage
|
from GUI import Window as OSXWindow, Button as OSXButton, Image as OSXImage
|
||||||
from GUI import Frame as OSXFrame, Color as OSXColor, Grid as OSXGrid
|
from GUI import Frame as OSXFrame, Color as OSXColor, Grid as OSXGrid
|
||||||
|
|
@ -220,6 +224,9 @@ elif sys.platform=="darwin":
|
||||||
FILE = tarfile.open(name=TEMPDIR+"/Untitled",mode="w:gz")
|
FILE = tarfile.open(name=TEMPDIR+"/Untitled",mode="w:gz")
|
||||||
FILE.close()
|
FILE.close()
|
||||||
|
|
||||||
|
#Used for storing images, sounds, etc.
|
||||||
|
SECURETEMPDIR = tempfile.mkdtemp()
|
||||||
|
|
||||||
__windowlist__=[]
|
__windowlist__=[]
|
||||||
|
|
||||||
if SYSTEM=="osx":
|
if SYSTEM=="osx":
|
||||||
|
|
@ -982,6 +989,9 @@ class Image(object):
|
||||||
elif SYSTEM=="html":
|
elif SYSTEM=="html":
|
||||||
cr.save()
|
cr.save()
|
||||||
pass
|
pass
|
||||||
|
def set_image(self,img):
|
||||||
|
if SYSTEM=="osx":
|
||||||
|
self.image = GUI.Image(file = img)
|
||||||
def hitTest(self,x,y):
|
def hitTest(self,x,y):
|
||||||
hits = False
|
hits = False
|
||||||
# points "a" and "b" forms the anchored segment.
|
# points "a" and "b" forms the anchored segment.
|
||||||
|
|
@ -2121,7 +2131,7 @@ class PublishSettingsWindow:
|
||||||
[swlabel, 5, None, self.c4, None, "nw", ""],
|
[swlabel, 5, None, self.c4, None, "nw", ""],
|
||||||
[htlabel, 5, None, swlabel._int(), None, "nw", ""],
|
[htlabel, 5, None, swlabel._int(), None, "nw", ""],
|
||||||
[Widget(self.impack), 16, None, htlabel._int(), None, "nw", ""],
|
[Widget(self.impack), 16, None, htlabel._int(), None, "nw", ""],
|
||||||
[Widgest(b2),5,None,None,-5,'nw',''],
|
[Widget(b2),5,None,None,-5,'nw',''],
|
||||||
[Widget(b1),None,-5,None,-5,'nw',''])
|
[Widget(b1),None,-5,None,-5,'nw',''])
|
||||||
self.win.present()
|
self.win.present()
|
||||||
def activate2(self):
|
def activate2(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue