Skip to content
Snippets Groups Projects
Commit 25787b21 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

striping comments in htcfile to avoid appending tabs during open-save procedure

parent 6d8d520c
No related branches found
No related tags found
No related merge requests found
......@@ -133,8 +133,8 @@ class HTCSection(HTCContents):
begin_comments = ""
def __init__(self, name, begin_comments="", end_comments=""):
self.name_ = name
self.begin_comments = begin_comments
self.end_comments = end_comments
self.begin_comments = begin_comments.strip(" \t")
self.end_comments = end_comments.strip(" \t")
self.contents = OrderedDict()
@staticmethod
......@@ -174,7 +174,7 @@ class HTCLine(HTCContents):
name = name[:name.index("__")]
self.name_ = name
self.values = list(values)
self.comments = comments
self.comments = comments.strip(" \t")
def __repr__(self):
return str(self)
......@@ -228,7 +228,7 @@ class HTCOutputSection(HTCSection):
def line_from_line(self, lines):
while lines[0].strip() == "":
while len(lines) and lines[0].strip() == "":
lines.pop(0)
name = lines[0].split()[0].strip()
if name in ['filename', 'data_format', 'buffer', 'time']:
......
......@@ -334,6 +334,7 @@ class HTCFile(HTCContents, HTCDefaults):
exe_file = os.path.join(self.modelpath, exe)
#print (from_unix(getmtime(res_file)), from_unix(getmtime(htc_file)))
if (isfile(htc_file) and isfile(res_file) and isfile(exe_file) and
str(HTCFile(htc_file))==str(self) and
getmtime(res_file) > getmtime(htc_file) and getmtime(res_file) > getmtime(exe_file)):
if "".join(self.readfilelines(htc_file)) == str(self):
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment