Skip to content

Commit

Permalink
#1101: make the desktop-scaling value parsing code more helpful in ca…
Browse files Browse the repository at this point in the history
…se of errors

git-svn-id: https://xpra.org/svn/Xpra/trunk@11849 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 4, 2016
1 parent a82eeae commit 76059de
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,11 @@ def parse_scaling(self, desktop_scaling):
for l in limp:
try:
ldef = l.split(":")
assert len(ldef)==2, "could not find 2 parts separated by ':'"
assert len(ldef)==2, "could not find 2 parts separated by ':' in '%s'" % ldef
dims = ldef[0].split("x")
assert len(dims)==2, "could not find 2 dimensions separated by 'x'"
assert len(dims)==2, "could not find 2 dimensions separated by 'x' in '%s'" % ldef[0]
x, y = int(dims[0]), int(dims[1])
scaleparts = ldef[1].split("x")
scaleparts = ldef[1].replace("/", "x").split("x")
assert len(scaleparts)<=2, "found more than 2 scaling dimensions!"
if len(scaleparts)==1:
sx = sy = float(scaleparts[0])
Expand Down Expand Up @@ -521,6 +521,10 @@ def parse_item(v):
pass
scalinglog.warn("Warning: failed to parse scaling value '%s'", v)
return None
if desktop_scaling.find("x")>0 and desktop_scaling.find(":")>0:
scalinglog.warn("Warning: found both 'x' and ':' in desktop-scaling fixed value")
scalinglog.warn(" maybe the 'auto:' prefix is missing?")
return 1, 1
#split if we have two dimensions: "1600x1200" -> ["1600", "1200"], if not: "2" -> ["2"]
values = desktop_scaling.replace(",", "x").split("x", 1)
x = parse_item(values[0])
Expand Down

0 comments on commit 76059de

Please sign in to comment.