Improve hex2ratio.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36090 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-11-04 21:32:11 +00:00
parent 2d7bbab89f
commit 586b5685f5

View File

@ -352,8 +352,11 @@ def revert_layout_command(document, name, LaTeXname, position):
def hex2ratio(s):
val = string.atoi(s, 16)
if val != 0:
val += 1
return str(val / 256.0)
try:
val = int(s, 16)
except:
val = 0
if val != 0:
val += 1
return str(val / 256.0)