raw images root path now supports directory paths that contain non ascii characters
This commit is contained in:
parent
442645d710
commit
ebcfb1747f
2
Makefile
2
Makefile
|
@ -7,7 +7,7 @@ TEMP_PATH:=$(shell echo ~/work/lipase/tmp)
|
|||
TESTS_OUTPUT_DATA_PATH:=$(TEMP_PATH)
|
||||
LIB_SRC_FILES=$(shell find ./src/lipase -name "*.py")
|
||||
PLUGINS_SRC_FILES=$(shell find ./src/ij-plugins -name "*.py")
|
||||
LIPASE_VERSION=1.05
|
||||
LIPASE_VERSION=1.06
|
||||
|
||||
BUILD_ROOT_PATH:=$(TEMP_PATH)/build
|
||||
PACKAGE_FILE_PATH=$(BUILD_ROOT_PATH)/lipase-$(LIPASE_VERSION).zip
|
||||
|
|
|
@ -19,7 +19,7 @@ from lipase.settings import UserSettings
|
|||
|
||||
def run_script():
|
||||
settings = UserSettings()
|
||||
settings.raw_images_root_path = str(RAW_IMAGES_ROOT_PATH)
|
||||
settings.raw_images_root_path = unicode(RAW_IMAGES_ROOT_PATH)
|
||||
settings.save()
|
||||
# global INFO
|
||||
# INFO = "the root directory containing raw images (%s) has been stored in your settings file %s" % (str(RAW_IMAGES_ROOT_PATH), settings.get_settings_file_path())
|
||||
|
|
|
@ -3,26 +3,27 @@ import json
|
|||
#from os.path import expanduser
|
||||
#import os.path
|
||||
import os
|
||||
from . import logger
|
||||
|
||||
|
||||
class UserSettings(object):
|
||||
"""User settings."""
|
||||
|
||||
attributes = {'raw_images_root_path': {'type': str}}
|
||||
attributes = {'raw_images_root_path': {'type': unicode}}
|
||||
|
||||
def __init__(self):
|
||||
"""constructor."""
|
||||
self.settings = {} # json dictionary
|
||||
self.raw_images_root_path = 'bla'
|
||||
self.raw_images_root_path = u'bla'
|
||||
try:
|
||||
with open(self.get_settings_file_path(), 'r') as json_file:
|
||||
self.settings = json.load(json_file)
|
||||
except IOError as error:
|
||||
print('Failed to read %s : %s' % (self.get_settings_file_path(), error))
|
||||
logger.error('Failed to read %s : %s' % (self.get_settings_file_path(), error))
|
||||
|
||||
def __getattr__(self, attr):
|
||||
"""Override __getattr__ to check the validity of settings attributes names."""
|
||||
print('getting %s' % (attr,))
|
||||
logger.debug('getting %s' % (attr,))
|
||||
if attr == 'settings':
|
||||
return self.__dict__['settings']
|
||||
else:
|
||||
|
@ -31,7 +32,7 @@ class UserSettings(object):
|
|||
|
||||
def __setattr__(self, attr, value):
|
||||
"""Override __setattr__ to check the validity of settings attributes names."""
|
||||
print('setting %s to %s' % (attr, value))
|
||||
logger.debug('setting %s to %s' % (attr, value))
|
||||
if attr == 'settings':
|
||||
self.__dict__['settings'] = value
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue