#!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage preferences of the script'''
import xml.etree.ElementTree as xmlMod
from settingMod.VersionList import *

class Preferences:
	'''class dedicated to script preferences settings'''
	
	
	def __init__(self, xml= None):
		'''initialize preferences object with default value or values extracted from an xml object'''
		if xml is None:
			self.defaultInit()
		else:
			self.fromXml(xml)
	
	
	
	
	
	def defaultInit(self):
		'''initialize preferences object with default value'''
		
		self.blenderVersionList = VersionList()
	
	
	
	
	
	def fromXml(self, xml):
		'''initialize preferences object with values extracted from an xml object'''
		
		self.blenderVersionList = VersionList( xml.find('versionsList') )
	
	
	
	
	
	def toXml(self):
		'''export preferences settings into xml syntaxed string'''
		xml = '<?xml version="1.0" encoding="UTF-8"?>\n'
		
		xml += '<preferences>\n'
		
		# export blender version list
		xml += self.blenderVersionList.toXml()
		
		xml += '</preferences>\n'
		
		return xml
	
	
	
	
	
	def see(self, log):
		'''method to see preferences settings and access edition menu'''
		
	
	
	
	
	
	
	
	
	
	
	

@@ -159,16 +159,26 @@
 import *
+%0Aimport os
 %0A%0Aclass 
@@ -766,16 +766,19 @@
 ist') )%0A
+%09%09%0A
 %09%0A%09%0A%09%0A%09%0A
@@ -1160,18 +1160,540 @@
 menu'''%0A
-
 %09%09
+change = False%0A%09%09log.menuIn('Preferences')%0A%09%09%0A%09%09while True:%0A%09%09%09#print log and preferences%0A%09%09%09os.system('clear')%0A%09%09%09log.print()%0A%09%09%09print('''    Preferences%5Cn%0A1- Blender versions%0A0- Save and quit''')%0A%09%09%09%0A%09%09%09%0A%09%09%0A%09%09%09#treat available actions%0A%09%09%09choice= input('menu?').strip().lower()%0A%09%09%09if choice in %5B'0', 'q', 'quit', 'cancel'%5D:%0A%09%09%09%09log.menuOut()# quit preferences menu%0A%09%09%09%09return change%0A%09%09%09elif choice == '1':%0A%09%09%09%09change = (self.blenderVersionList.see(log) or change)%0A%09%09%09else:%0A%09%09%09%09log.write('%5C033%5B31munknow request%5C033%5B0m%5Cn')
 %0A%09%0A%09%0A%09%0A%09

implement Preferences.see() method : the menu to access prefenences