Handle the case where insetgraphics has no size_kind token

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5129 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2002-08-28 09:03:45 +00:00
parent 3c7c7a3209
commit 1d1289f503

View File

@ -44,32 +44,34 @@ def change_insetgraphics(lines):
k = find_token2(lines, "size_type", i, j) k = find_token2(lines, "size_type", i, j)
if k == -1: if k == -1:
k = find_token2(lines, "size_kind", i, j) k = find_token2(lines, "size_kind", i, j)
size_type = string.split(lines[k])[1] if k != -1:
del lines[k] size_type = string.split(lines[k])[1]
j = j-1 del lines[k]
if size_type in ["0", "original"]: j = j-1
j = del_token(lines, "width", i, j) if size_type in ["0", "original"]:
j = del_token(lines, "height", i, j) j = del_token(lines, "width", i, j)
j = del_token(lines, "scale", i, j) j = del_token(lines, "height", i, j)
elif size_type in ["2", "scale"]: j = del_token(lines, "scale", i, j)
j = del_token(lines, "width", i, j) elif size_type in ["2", "scale"]:
j = del_token(lines, "height", i, j) j = del_token(lines, "width", i, j)
if get_value(lines, "scale", i, j) == "100": j = del_token(lines, "height", i, j)
if get_value(lines, "scale", i, j) == "100":
j = del_token(lines, "scale", i, j)
else:
j = del_token(lines, "scale", i, j) j = del_token(lines, "scale", i, j)
else:
j = del_token(lines, "scale", i, j)
k = find_token2(lines, "lyxsize_type", i, j) k = find_token2(lines, "lyxsize_type", i, j)
if k == -1: if k == -1:
k = find_token2(lines, "lyxsize_kind", i, j) k = find_token2(lines, "lyxsize_kind", i, j)
lyxsize_type = string.split(lines[k])[1] if k != -1:
del lines[k] lyxsize_type = string.split(lines[k])[1]
j = j-1 del lines[k]
j = del_token(lines, "lyxwidth", i, j) j = j-1
j = del_token(lines, "lyxheight", i, j) j = del_token(lines, "lyxwidth", i, j)
if lyxsize_type not in ["2", "scale"] or \ j = del_token(lines, "lyxheight", i, j)
get_value(lines, "lyxscale", i, j) == "100": if lyxsize_type not in ["2", "scale"] or \
j = del_token(lines, "lyxscale", i, j) get_value(lines, "lyxscale", i, j) == "100":
j = del_token(lines, "lyxscale", i, j)
i = i+1 i = i+1