Commit d6611774f3f5755d10f96c0b998ad67f0da7a99b

Authored by Paulo Henrique Junqueira Amorim
1 parent b0fe7063
Exists in master

Fixed plist access denied files on .exe

invesalius/control.py
@@ -1085,7 +1085,7 @@ class Controller(): @@ -1085,7 +1085,7 @@ class Controller():
1085 if not os.path.isfile(path): 1085 if not os.path.isfile(path):
1086 path = os.path.join(inv_paths.USER_RAYCASTING_PRESETS_DIRECTORY, 1086 path = os.path.join(inv_paths.USER_RAYCASTING_PRESETS_DIRECTORY,
1087 preset_name+".plist") 1087 preset_name+".plist")
1088 - with open(path, 'r+b') as f: 1088 + with open(path, 'rb') as f:
1089 preset = plistlib.load(f, fmt=plistlib.FMT_XML) 1089 preset = plistlib.load(f, fmt=plistlib.FMT_XML)
1090 prj.Project().raycasting_preset = preset 1090 prj.Project().raycasting_preset = preset
1091 # Notify volume 1091 # Notify volume
invesalius/data/volume.py
@@ -356,7 +356,7 @@ class Volume(): @@ -356,7 +356,7 @@ class Volume():
356 if color_preset != "No CLUT": 356 if color_preset != "No CLUT":
357 path = os.path.join(inv_paths.RAYCASTING_PRESETS_DIRECTORY, 357 path = os.path.join(inv_paths.RAYCASTING_PRESETS_DIRECTORY,
358 'color_list', color_preset + '.plist') 358 'color_list', color_preset + '.plist')
359 - with open(path, 'r+b') as f: 359 + with open(path, 'rb') as f:
360 p = plistlib.load(f, fmt=plistlib.FMT_XML) 360 p = plistlib.load(f, fmt=plistlib.FMT_XML)
361 361
362 r = p['Red'] 362 r = p['Red']
invesalius/presets.py
@@ -155,7 +155,7 @@ class Presets(): @@ -155,7 +155,7 @@ class Presets():
155 "Custom":_("Custom")} 155 "Custom":_("Custom")}
156 156
157 157
158 - with open(filename, 'r+b') as f: 158 + with open(filename, 'rb') as f:
159 p = plistlib.load(f, fmt=plistlib.FMT_XML) 159 p = plistlib.load(f, fmt=plistlib.FMT_XML)
160 thresh_mri = p['thresh_mri'].copy() 160 thresh_mri = p['thresh_mri'].copy()
161 thresh_ct = p['thresh_ct'].copy() 161 thresh_ct = p['thresh_ct'].copy()
@@ -183,7 +183,7 @@ def get_wwwl_presets(): @@ -183,7 +183,7 @@ def get_wwwl_presets():
183 183
184 184
185 def get_wwwl_preset_colours(pfile): 185 def get_wwwl_preset_colours(pfile):
186 - with open(pfile, 'r+b') as f: 186 + with open(pfile, 'rb') as f:
187 preset = plistlib.load(f, fmt=plistlib.FMT_XML) 187 preset = plistlib.load(f, fmt=plistlib.FMT_XML)
188 ncolours = len(preset['Blue']) 188 ncolours = len(preset['Blue'])
189 colours = [] 189 colours = []