Commit c5ede16c0524d757547d970206dcb270ed69dbad

Authored by Paulo Henrique Junqueira Amorim
1 parent 1d21c8fc

FIX: bug in open directory in the Windows

invesalius/control.py
@@ -258,12 +258,15 @@ class Controller(): @@ -258,12 +258,15 @@ class Controller():
258 258
259 def OnSaveProject(self, pubsub_evt): 259 def OnSaveProject(self, pubsub_evt):
260 filename = prj.Project().name 260 filename = prj.Project().name
  261 + filename = filename.replace(' ','')
261 dir_ = tempfile.mkdtemp(filename) 262 dir_ = tempfile.mkdtemp(filename)
262 prj.Project().SavePlistProject(dir_, filename) 263 prj.Project().SavePlistProject(dir_, filename)
263 264
264 def OnOpenProject(self, pubsub_evt): 265 def OnOpenProject(self, pubsub_evt):
265 - filename = pubsub_evt.data  
266 - 266 + filename = os.path.abspath(pubsub_evt.data)
  267 +
  268 + print filename
  269 +
267 proj = prj.Project() 270 proj = prj.Project()
268 proj.OpenPlistProject(filename) 271 proj.OpenPlistProject(filename)
269 proj.SetAcquisitionModality(proj.modality) 272 proj.SetAcquisitionModality(proj.modality)
invesalius/data/mask.py
@@ -61,7 +61,7 @@ class Mask(): @@ -61,7 +61,7 @@ class Mask():
61 61
62 def OpenPList(self, filename): 62 def OpenPList(self, filename):
63 mask = plistlib.readPlist(filename) 63 mask = plistlib.readPlist(filename)
64 - dirpath = os.path.split(filename)[0] 64 + dirpath = os.path.abspath(os.path.split(filename)[0])
65 for key in mask: 65 for key in mask:
66 print "Key", key 66 print "Key", key
67 if key == 'imagedata': 67 if key == 'imagedata':
invesalius/data/surface.py
@@ -61,7 +61,7 @@ class Surface(): @@ -61,7 +61,7 @@ class Surface():
61 61
62 def OpenPList(self, filename): 62 def OpenPList(self, filename):
63 surface = plistlib.readPlist(filename) 63 surface = plistlib.readPlist(filename)
64 - dirpath = os.path.split(filename)[0] 64 + dirpath = os.path.abspath(os.path.split(filename)[0])
65 for key in surface: 65 for key in surface:
66 if key == 'polydata': 66 if key == 'polydata':
67 filepath = os.path.split(surface[key]["$vtp"])[-1] 67 filepath = os.path.split(surface[key]["$vtp"])[-1]
invesalius/project.py
@@ -147,6 +147,7 @@ class Project(object): @@ -147,6 +147,7 @@ class Project(object):
147 147
148 def SavePlistProject(self, dir_, filename): 148 def SavePlistProject(self, dir_, filename):
149 filename = os.path.join(dir_, filename) 149 filename = os.path.join(dir_, filename)
  150 +
150 project = {} 151 project = {}
151 152
152 for key in self.__dict__: 153 for key in self.__dict__:
@@ -187,7 +188,7 @@ class Project(object): @@ -187,7 +188,7 @@ class Project(object):
187 #print "antes", self.__dict__ 188 #print "antes", self.__dict__
188 189
189 # Path were extracted project is 190 # Path were extracted project is
190 - dirpath = os.path.split(filelist[0])[0] 191 + dirpath = os.path.abspath(os.path.split(filelist[0])[0])
191 #print "* dirpath", dirpath 192 #print "* dirpath", dirpath
192 193
193 for key in project: 194 for key in project: