diff --git a/invesalius/data/mask.py b/invesalius/data/mask.py index 18254b7..e1f33c7 100644 --- a/invesalius/data/mask.py +++ b/invesalius/data/mask.py @@ -51,12 +51,13 @@ class Mask(): Publisher.subscribe(self.OnFlipVolume, 'Flip volume') Publisher.subscribe(self.OnSwapVolumeAxes, 'Swap volume axes') - def SavePlist(self, dir_temp): + def SavePlist(self, dir_temp, filelist): mask = {} filename = u'mask_%d' % self.index mask_filename = u'%s.dat' % filename mask_filepath = os.path.join(dir_temp, mask_filename) - self._save_mask(mask_filepath) + filelist[self.temp_file] = mask_filename + #self._save_mask(mask_filepath) mask['index'] = self.index mask['name'] = self.name @@ -69,8 +70,13 @@ class Mask(): mask['mask_shape'] = self.matrix.shape plist_filename = filename + '.plist' - plist_filepath = os.path.join(dir_temp, plist_filename) - plistlib.writePlist(mask, plist_filepath) + #plist_filepath = os.path.join(dir_temp, plist_filename) + + temp_plist = tempfile.mktemp() + plistlib.writePlist(mask, temp_plist) + + filelist[temp_plist] = plist_filename + return plist_filename def OpenPList(self, filename): diff --git a/invesalius/data/surface.py b/invesalius/data/surface.py index a29222b..da5b5d2 100644 --- a/invesalius/data/surface.py +++ b/invesalius/data/surface.py @@ -21,6 +21,7 @@ import multiprocessing import os import plistlib import random +import tempfile import weakref import vtk @@ -62,11 +63,14 @@ class Surface(): else: self.name = name - def SavePlist(self, dir_temp): + def SavePlist(self, dir_temp, filelist): filename = 'surface_%d' % self.index vtp_filename = filename + '.vtp' vtp_filepath = os.path.join(dir_temp, vtp_filename) pu.Export(self.polydata, vtp_filepath, bin=True) + + filelist[vtp_filepath] = vtp_filename + surface = {'colour': self.colour, 'index': self.index, 'name': self.name, @@ -76,8 +80,12 @@ class Surface(): 'volume': self.volume, } plist_filename = filename + '.plist' - plist_filepath = os.path.join(dir_temp, filename + '.plist') - plistlib.writePlist(surface, plist_filepath) + #plist_filepath = os.path.join(dir_temp, filename + '.plist') + temp_plist = tempfile.mktemp() + plistlib.writePlist(surface, temp_plist) + + filelist[temp_plist] = plist_filename + return plist_filename def OpenPList(self, filename): -- libgit2 0.21.2