From ebcfb1747fd5671f20a5a106b26574f9e277d4e8 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Tue, 25 Jan 2022 15:40:53 +0100 Subject: [PATCH] raw images root path now supports directory paths that contain non ascii characters --- Makefile | 2 +- src/ij-plugins/Ipr/Lipase/Define_Raw_Images_Root.py | 2 +- src/lipase/settings.py | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0c2f216..31c5db7 100644 --- a/Makefile +++ b/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 diff --git a/src/ij-plugins/Ipr/Lipase/Define_Raw_Images_Root.py b/src/ij-plugins/Ipr/Lipase/Define_Raw_Images_Root.py index f6322d6..fdf88c1 100644 --- a/src/ij-plugins/Ipr/Lipase/Define_Raw_Images_Root.py +++ b/src/ij-plugins/Ipr/Lipase/Define_Raw_Images_Root.py @@ -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()) diff --git a/src/lipase/settings.py b/src/lipase/settings.py index 841335c..a964a02 100644 --- a/src/lipase/settings.py +++ b/src/lipase/settings.py @@ -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: