Skip to content

Commit

Permalink
Re #10705 SaveFormats list of formats as css string with formats
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Dec 11, 2014
1 parent 8a60a8b commit f119e6a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Code/Mantid/scripts/Inelastic/DirectPropertyManager.py
Expand Up @@ -281,14 +281,20 @@ def __set__(self,instance,value):
prop_helpers.gen_setter(instance.__dict__,'save_format',set());
return

# check string, if it is empty, clear save format, if not -- continue
# check string
if isinstance(value,str):
if value[:1] == '.':
value = value[1:];
subformats = value.split(',')
if len(subformats)>1:
self.__set__(instance,subformats)
return
else:
value = subformats[0]
if value[:1] == '.':
value = value[1:];

if not(value in SaveFormat.save_formats):
instance.log("Trying to set saving in unknown format: \""+str(value)+"\" No saving will occur for this format")
return
if not(value in SaveFormat.save_formats):
instance.log("Trying to set saving in unknown format: \""+str(value)+"\" No saving will occur for this format")
return
elif isinstance(value,list) or isinstance(value,set):
# set single default save format recursively
for val in value:
Expand Down
8 changes: 8 additions & 0 deletions Code/Mantid/scripts/Inelastic/DirectReductionProperties.py
Expand Up @@ -293,6 +293,14 @@ def mask_run(self):
def mask_run(self,value):
object.__setattr__(self,'_mask_run',value)

# -----------------------------------------------------------------------------
@property
def log_to_mantid(self):
""" Property specify if high level log should be printed to stdout or added to common Mantid log"""
return self._log_to_mantid
@log_to_mantid.setter
def log_to_mantid(self,val):
object.__setarrt__(self,'_log_to_mantid',bool(val))

# -----------------------------------------------------------------------------
# Service properties (used by class itself)
Expand Down
9 changes: 9 additions & 0 deletions Code/Mantid/scripts/test/DirectPropertyManagerTest.py
Expand Up @@ -267,6 +267,15 @@ def test_save_format(self):
self.assertTrue('nxs' in formats)
self.assertTrue('nxspe' in formats)

propman.save_format = None
self.assertTrue(len(propman.save_format)==0)
propman.save_format = 'spe,.nxs'
formats = propman.save_format;
self.assertTrue(len(formats)==2)
self.assertTrue('nxs' in formats)
self.assertTrue('spe' in formats)


def test_allowed_values(self):

propman = self.prop_man
Expand Down

0 comments on commit f119e6a

Please sign in to comment.