Skip to content

Commit

Permalink
fix more pylint warnings
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@21904 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 28, 2019
1 parent a94b0ce commit f671edd
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/xpra/server/window/metadata.py
Expand Up @@ -40,7 +40,7 @@ def raw():
return {}
return {propname: ""}
return {propname: v.encode("utf-8")}
elif propname in ("pid", "workspace", "bypass-compositor", "depth", "opacity", "quality", "speed"):
if propname in ("pid", "workspace", "bypass-compositor", "depth", "opacity", "quality", "speed"):
v = raw()
assert v is not None, "%s is None!" % propname
default_value = {
Expand All @@ -55,12 +55,12 @@ def raw():
#so don't bother sending anything:
return {}
return {propname : v}
elif propname == "size-hints":
if propname == "size-hints":
#just to confuse things, this is renamed
#and we have to filter out ratios as floats (already exported as pairs anyway)
v = dict(raw())
return {"size-constraints": v}
elif propname == "strut":
if propname == "strut":
strut = raw()
if not strut:
strut = {}
Expand All @@ -69,60 +69,65 @@ def raw():
if not strut and skip_defaults:
return {}
return {"strut": strut}
elif propname == "class-instance":
if propname == "class-instance":
c_i = raw()
if c_i is None:
return {}
return {"class-instance": [x.encode("utf-8") for x in c_i]}
elif propname == "client-machine":
if propname == "client-machine":
client_machine = raw()
if client_machine is None:
import socket
client_machine = socket.gethostname()
if client_machine is None:
return {}
return {"client-machine": client_machine.encode("utf-8")}
elif propname == "transient-for":
if propname == "transient-for":
wid = None
if get_transient_for:
wid = get_transient_for(window)
if wid:
return {"transient-for" : wid}
return {}
elif propname in ("window-type", "shape", "menu", "children"):
if propname in ("window-type", "shape", "menu", "children"):
v = raw()
if not v and skip_defaults:
return {}
#always send unchanged:
return {propname : raw()}
elif propname in ("decorations", ):
if propname=="decorations":
#-1 means unset, don't send it
v = raw()
if v<0:
return {}
return {propname : v}
elif propname in ("iconic", "fullscreen", "maximized", "above", "below", "shaded", "sticky", "skip-taskbar", "skip-pager", "modal", "focused"):
if propname in ("iconic", "fullscreen", "maximized",
"above", "below",
"shaded", "sticky",
"skip-taskbar", "skip-pager",
"modal", "focused",
):
v = raw()
if v is False and skip_defaults:
#we can skip those when the window is first created,
#but not afterwards when those attributes are toggled
return {}
#always send these when requested
return {propname : bool(raw())}
elif propname in ("has-alpha", "override-redirect", "tray", "shadow", "set-initial-position"):
if propname in ("has-alpha", "override-redirect", "tray", "shadow", "set-initial-position"):
v = raw()
if v is False and skip_defaults:
#save space: all these properties are assumed false if unspecified
return {}
return {propname : v}
elif propname in ("role", "fullscreen-monitors"):
if propname in ("role", "fullscreen-monitors"):
v = raw()
if v is None or v=="":
return {}
return {propname : v}
elif propname == "xid":
if propname == "xid":
return {"xid" : hex(raw() or 0)}
elif propname == "group-leader":
if propname == "group-leader":
gl = raw()
if not gl or not get_window_id:
return {}
Expand All @@ -138,11 +143,11 @@ def raw():
#the properties below are not actually exported to the client (yet?)
#it was just easier to handle them here
#(convert to a type that can be encoded for xpra info):
elif propname in ("state", "protocols"):
if propname in ("state", "protocols"):
return {"state" : tuple(raw() or [])}
elif propname == "allowed-actions":
if propname == "allowed-actions":
return {"allowed-actions" : tuple(raw())}
elif propname == "frame":
if propname == "frame":
frame = raw()
if not frame:
return {}
Expand Down

0 comments on commit f671edd

Please sign in to comment.