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@21821 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 22, 2019
1 parent 6df2582 commit fd1e228
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 25 deletions.
25 changes: 16 additions & 9 deletions src/xpra/server/mixins/clipboard_server.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2010-2018 Antoine Martin <antoine@xpra.org>
# Copyright (C) 2010-2019 Antoine Martin <antoine@xpra.org>
# Copyright (C) 2008 Nathaniel Smith <njs@pobox.com>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import os.path

from xpra.log import Logger
log = Logger("clipboard")

from xpra.platform.features import CLIPBOARDS
from xpra.util import csv, nonl, XPRA_CLIPBOARD_NOTIFICATION_ID
from xpra.scripts.config import FALSE_OPTIONS
from xpra.server.mixins.stub_server_mixin import StubServerMixin
from xpra.log import Logger

log = Logger("clipboard")


"""
Expand Down Expand Up @@ -87,15 +87,18 @@ def init_clipboard(self):
clipboard_filter_res = []
if self.clipboard_filter_file:
if not os.path.exists(self.clipboard_filter_file):
log.error("invalid clipboard filter file: '%s' does not exist - clipboard disabled!", self.clipboard_filter_file)
log.error("invalid clipboard filter file: '%s' does not exist - clipboard disabled!",
self.clipboard_filter_file)
return
try:
with open(self.clipboard_filter_file, "r" ) as f:
for line in f:
clipboard_filter_res.append(line.strip())
log("loaded %s regular expressions from clipboard filter file %s", len(clipboard_filter_res), self.clipboard_filter_file)
log("loaded %s regular expressions from clipboard filter file %s",
len(clipboard_filter_res), self.clipboard_filter_file)
except:
log.error("Error: reading clipboard filter file %s - clipboard disabled!", self.clipboard_filter_file, exc_info=True)
log.error("Error: reading clipboard filter file %s - clipboard disabled!",
self.clipboard_filter_file, exc_info=True)
return
try:
from xpra.clipboard.gdk_clipboard import GDKClipboardProtocolHelper
Expand Down Expand Up @@ -207,7 +210,8 @@ def clipboard_nesting_check(self, action, packet_type, ss):
ss.send_clipboard_enabled("probable clipboard loop detected")
body = "Too many clipboard requests,\n"+\
"a clipboard synchronization loop is likely to be causing this problem"
ss.may_notify(XPRA_CLIPBOARD_NOTIFICATION_ID, "Clipboard synchronization is now disabled", body, icon_name="clipboard")
ss.may_notify(XPRA_CLIPBOARD_NOTIFICATION_ID,
"Clipboard synchronization is now disabled", body, icon_name="clipboard")
return False
return True

Expand Down Expand Up @@ -251,5 +255,8 @@ def init_packet_handlers(self):
self._authenticated_packet_handlers.update({
"set-clipboard-enabled": self._process_clipboard_enabled_status,
})
for x in ("token", "request", "contents", "contents-none", "pending-requests", "enable-selections", "loop-uuids"):
for x in (
"token", "request", "contents", "contents-none",
"pending-requests", "enable-selections", "loop-uuids",
):
self._authenticated_ui_packet_handlers["clipboard-%s" % x] = self._process_clipboard_packet
6 changes: 3 additions & 3 deletions src/xpra/server/mixins/dbusrpc_server.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2010-2018 Antoine Martin <antoine@xpra.org>
# Copyright (C) 2010-2019 Antoine Martin <antoine@xpra.org>
# Copyright (C) 2008 Nathaniel Smith <njs@pobox.com>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import os

from xpra.server.mixins.stub_server_mixin import StubServerMixin
from xpra.log import Logger

log = Logger("rpc")
dbuslog = Logger("dbus", "rpc")

from xpra.server.mixins.stub_server_mixin import StubServerMixin


"""
Mixin for servers that handle DBUS and RPC requests.
Expand Down
20 changes: 11 additions & 9 deletions src/xpra/server/mixins/display_manager.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2010-2018 Antoine Martin <antoine@xpra.org>
# Copyright (C) 2010-2019 Antoine Martin <antoine@xpra.org>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

from xpra.log import Logger
log = Logger("screen")

from xpra.util import iround, log_screen_sizes, engs
from xpra.server.mixins.stub_server_mixin import StubServerMixin
from xpra.log import Logger

log = Logger("screen")

"""
Mixin for servers that handle displays.
Expand Down Expand Up @@ -113,7 +112,8 @@ def do_parse_screen_info(self, ss, desktop_size):
if not ss.screen_sizes:
log.info(" client root window size is %sx%s", dw, dh)
else:
log.info(" client root window size is %sx%s with %s display%s:", dw, dh, len(ss.screen_sizes), engs(ss.screen_sizes))
log.info(" client root window size is %sx%s with %s display%s:",
dw, dh, len(ss.screen_sizes), engs(ss.screen_sizes))
log_screen_sizes(dw, dh, ss.screen_sizes)
except:
dw, dh = None, None
Expand Down Expand Up @@ -161,7 +161,8 @@ def send_updated_screen_size(self):
if ss.updated_desktop_size(root_w, root_h, max_w, max_h):
count +=1
if count>0:
log.info("sent updated screen size to %s client%s: %sx%s (max %sx%s)", count, engs(count), root_w, root_h, max_w, max_h)
log.info("sent updated screen size to %s client%s: %sx%s (max %sx%s)",
count, engs(count), root_w, root_h, max_w, max_h)

def get_max_screen_size(self):
max_w, max_h = self.get_root_window_size()
Expand All @@ -171,7 +172,7 @@ def _get_desktop_size_capability(self, server_source, root_w, root_h):
client_size = server_source.desktop_size
log("client resolution is %s, current server resolution is %sx%s", client_size, root_w, root_h)
if not client_size:
""" client did not specify size, just return what we have """
#client did not specify size, just return what we have
return root_w, root_h
client_w, client_h = client_size
w = min(client_w, root_w)
Expand Down Expand Up @@ -209,7 +210,8 @@ def _process_desktop_size(self, proto, packet):
self.set_screen_size(width, height)
if len(packet)>=4:
log.info("received updated display dimensions")
log.info("client display size is %sx%s with %s screen%s:", width, height, len(ss.screen_sizes), engs(ss.screen_sizes))
log.info("client display size is %sx%s with %s screen%s:",
width, height, len(ss.screen_sizes), engs(ss.screen_sizes))
log_screen_sizes(width, height, ss.screen_sizes)
self.calculate_workarea(width, height)
#ensures that DPI and antialias information gets reset:
Expand Down Expand Up @@ -237,7 +239,7 @@ def calculate_desktops(self):
#newer clients send bytes...
try :
v = dn.decode("utf8")
except:
except UnicodeDecodeError:
v = dn
if v!="0" or i!=0:
name = v
Expand Down
3 changes: 2 additions & 1 deletion src/xpra/server/mixins/input_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ def _adjust_pointer(self, proto, wid, pointer):
if dx!=0 or dy!=0:
px, py = pointer[:2]
ax, ay = px+dx, py+dy
mouselog("client %2i: server window position: %12s, client window position: %24s, pointer=%s, adjusted: %s", ss.counter, pos, mapped_at, pointer, (ax, ay))
mouselog("client %2i: server window position: %12s, client window position: %24s, pointer=%s, adjusted: %s",
ss.counter, pos, mapped_at, pointer, (ax, ay))
return [ax, ay]+list(pointer[2:])
return pointer

Expand Down
3 changes: 2 additions & 1 deletion src/xpra/server/mixins/window_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ def _process_buffer_refresh(self, proto, packet):
#may have been destroyed since the request was made
log("invalid window specified for refresh: %s", wid)
return
log("process_buffer_refresh for windows: %s options=%s, client_properties=%s", wid_windows, options, client_properties)
log("process_buffer_refresh for windows: %s options=%s, client_properties=%s",
wid_windows, options, client_properties)
batch_props = options.dictget("batch", {})
if batch_props or client_properties:
#change batch config and/or client properties
Expand Down
5 changes: 3 additions & 2 deletions src/xpra/server/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def cleanup_protocol(self, protocol):
#from this connection as these could potentially set some keys pressed, etc
try:
del self._potential_protocols[protocol]
except:
except KeyError:
pass
source = self._server_sources.pop(protocol, None)
if source:
Expand Down Expand Up @@ -912,4 +912,5 @@ def invalid_packet():
except KeyboardInterrupt:
raise
except:
netlog.error("Unhandled error while processing a '%s' packet from peer using %s", packet_type, handler, exc_info=True)
netlog.error("Unhandled error while processing a '%s' packet from peer using %s",
packet_type, handler, exc_info=True)

0 comments on commit fd1e228

Please sign in to comment.