configurationengine/source/plugins/symbian/ConeThemePlugin/themeplugin/theme_function.py
equal
deleted
inserted
replaced
26 except ImportError: |
26 except ImportError: |
27 from xml.etree import ElementTree |
27 from xml.etree import ElementTree |
28 |
28 |
29 import os |
29 import os |
30 import logging |
30 import logging |
|
31 import re |
31 |
32 |
32 def convert_hexa_to_decimal(hexa_number): |
33 def convert_hexa_to_decimal(hexa_number): |
33 """ |
34 """ |
34 convert hexa number to decimal number. Hexa number has to have 16 digitals. |
35 convert hexa number to decimal number. Hexa number has to have 16 digitals. |
35 This method split hexa number to two half and convert them to decimal format. |
36 This method split hexa number to two half and convert them to decimal format. |
59 def get_tdf_file(path): |
60 def get_tdf_file(path): |
60 """ |
61 """ |
61 This method takes the name of the tdf file from the .project file |
62 This method takes the name of the tdf file from the .project file |
62 """ |
63 """ |
63 |
64 |
64 path = os.path.join(path,".project") |
65 prj_file_path = os.path.join(path,".project") |
65 etree = ElementTree.parse(path) |
66 if os.path.exists(prj_file_path): |
66 |
67 etree = ElementTree.parse(prj_file_path) |
67 el_name = etree.find("name") |
68 |
68 if el_name != None: |
69 el_name = etree.find("name") |
69 return el_name.text |
70 if el_name != None: |
|
71 return el_name.text |
|
72 else: |
|
73 logging.getLogger('cone.thememl').error("The element name is not in %s" % prj_file_path) |
70 else: |
74 else: |
71 logging.getLogger('cone.thememl').error("The element name is not in %s" % path) |
75 logging.getLogger('cone.thememl').info("No .project file found. Trying to find tdf file.") |
|
76 for root,dirs,files in os.walk(path): |
|
77 for f in files: |
|
78 if f.endswith('tdf'): |
|
79 return re.sub('\.tdf', '', os.path.join(root, f)) |
72 |
80 |
73 |
81 |
74 |
82 |
75 def find_text_in_file(file_path, start_text, end_text): |
83 def find_text_in_file(file_path, start_text, end_text): |
76 """ |
84 """ |