Skip to content

Commit

Permalink
more pylint warning fixes
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@21713 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 19, 2019
1 parent 8eff179 commit fe01a96
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions src/xpra/x11/models/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
CWBorderWidth : "BorderWidth",
}
def configure_bits(value_mask):
return "|".join((v for k,v in CW_MASK_TO_NAME.items() if (k&value_mask)))
return "|".join(v for k,v in CW_MASK_TO_NAME.items() if k&value_mask)


VALIDATE_CONFIGURE_REQUEST = envbool("XPRA_VALIDATE_CONFIGURE_REQUEST", False)
Expand Down Expand Up @@ -149,7 +149,9 @@ class WindowModel(BaseWindowModel):
})

_property_names = BaseWindowModel._property_names + [
"size-hints", "icon-title", "icon", "decorations", "modal", "set-initial-position", "iconic"]
"size-hints", "icon-title", "icon", "decorations",
"modal", "set-initial-position", "iconic",
]
_dynamic_property_names = BaseWindowModel._dynamic_property_names + [
"size-hints", "icon-title", "icon", "decorations", "modal", "iconic"]
_initial_x11_properties = BaseWindowModel._initial_x11_properties + [
Expand Down Expand Up @@ -483,7 +485,8 @@ def _do_update_client_geometry(self, window_size_cb, window_position_cb):

def do_xpra_configure_event(self, event):
cxid = get_xwindow(self.corral_window)
geomlog("WindowModel.do_xpra_configure_event(%s) corral=%#x, client=%#x, managed=%s", event, cxid, self.xid, self._managed)
geomlog("WindowModel.do_xpra_configure_event(%s) corral=%#x, client=%#x, managed=%s",
event, cxid, self.xid, self._managed)
if not self._managed:
return
if event.window==self.corral_window:
Expand All @@ -492,7 +495,8 @@ def do_xpra_configure_event(self, event):
return
if event.window!=self.client_window:
#we only care about events on the client window
geomlog("WindowModel.do_xpra_configure_event: event is not on the client window but on %#x, ignored", get_xwindow(event.window))
geomlog("WindowModel.do_xpra_configure_event: event is not on the client window but on %#x, ignored",
get_xwindow(event.window))
return
if self.corral_window is None or not self.corral_window.is_visible():
geomlog("WindowModel.do_xpra_configure_event: corral window is not visible")
Expand Down Expand Up @@ -562,7 +566,8 @@ def resize_corral_window(self, x, y, w, h):
def do_child_configure_request_event(self, event):
cxid = get_xwindow(self.corral_window)
hints = self.get_property("size-hints")
geomlog("do_child_configure_request_event(%s) client=%#x, corral=%#x, value_mask=%s, size-hints=%s", event, self.xid, cxid, configure_bits(event.value_mask), hints)
geomlog("do_child_configure_request_event(%s) client=%#x, corral=%#x, value_mask=%s, size-hints=%s",
event, self.xid, cxid, configure_bits(event.value_mask), hints)
if event.value_mask & CWStackMode:
geomlog(" restack above=%s, detail=%s", event.above, event.detail)
# Also potentially update our record of what the app has requested:
Expand Down Expand Up @@ -620,7 +625,8 @@ def process_client_message_event(self, event):
#honour hints:
hints = self.get_property("size-hints")
w, h = self.calc_constrained_size(w, h, hints)
geomlog("_NET_MOVERESIZE_WINDOW on %s (data=%s, current geometry=%s, new geometry=%s)", self, event.data, geom, (x,y,w,h))
geomlog("_NET_MOVERESIZE_WINDOW on %s (data=%s, current geometry=%s, new geometry=%s)",
self, event.data, geom, (x,y,w,h))
with xswallow:
X11Window.configureAndNotify(self.xid, x, y, w, h)
return True
Expand Down Expand Up @@ -658,7 +664,8 @@ def _handle_icon_title_change(self):

def _handle_motif_wm_hints_change(self):
#motif_hints = self.prop_get("_MOTIF_WM_HINTS", "motif-hints")
motif_hints = prop_get(self.client_window, "_MOTIF_WM_HINTS", "motif-hints", ignore_errors=False, raise_xerrors=True)
motif_hints = prop_get(self.client_window, "_MOTIF_WM_HINTS", "motif-hints",
ignore_errors=False, raise_xerrors=True)
metalog("_MOTIF_WM_HINTS=%s", motif_hints)
if motif_hints:
if motif_hints.flags & (2**MotifWMHints.DECORATIONS_BIT):
Expand Down Expand Up @@ -697,7 +704,12 @@ def _handle_wm_normal_hints_change(self):
hminw, hminh = mhints.intlistget("min_size", (0, 0), 2, 2)
hmaxw, hmaxh = mhints.intlistget("max_size", (MAX_WINDOW_SIZE, MAX_WINDOW_SIZE), 2, 2)
d = self.get("decorations", -1)
decorated = d==-1 or any((d & 2**b) for b in (MotifWMHints.ALL_BIT, MotifWMHints.TITLE_BIT, MotifWMHints.MINIMIZE_BIT, MotifWMHints.MAXIMIZE_BIT))
decorated = d==-1 or any((d & 2**b) for b in (
MotifWMHints.ALL_BIT,
MotifWMHints.TITLE_BIT,
MotifWMHints.MINIMIZE_BIT,
MotifWMHints.MAXIMIZE_BIT,
))
cminw, cminh, cmaxw, cmaxh = self.size_constraints
if decorated:
#min-size only applies to decorated windows
Expand All @@ -706,9 +718,9 @@ def _handle_wm_normal_hints_change(self):
if cminh>0 and cminh>hminh:
hminh = cminh
#max-size applies to all windows:
if cmaxw>0 and cmaxw<hmaxw:
if 0<cmaxw<hmaxw:
hmaxw = cmaxw
if cmaxh>0 and cmaxh<hmaxh:
if 0<cmaxh<hmaxh:
hmaxh = cmaxh
#if the values mean something, expose them:
if hminw>0 or hminw>0:
Expand Down

0 comments on commit fe01a96

Please sign in to comment.