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@21912 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 1, 2019
1 parent 6c3cd8e commit 0687554
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/xpra/client/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def up(prefix, d):
key = self.get_encryption_key()
if key is None:
self.warn_and_quit(EXIT_ENCRYPTION, "encryption key is missing")
return
return None
self._protocol.set_cipher_in(self.encryption, iv, key, key_salt, iterations, padding)
netlog("encryption capabilities: %s", dict((k,v) for k,v in capabilities.items() if k.startswith("cipher")))
capabilities.update(self.hello_extra)
Expand Down
7 changes: 5 additions & 2 deletions src/xpra/client/gtk3/cairo_backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def __repr__(self):
def _do_paint_rgb(self, cairo_format, has_alpha, img_data, x, y, width, height, rowstride, options):
""" must be called from UI thread """
log("cairo._do_paint_rgb(%s, %s, %s %s, %s, %s, %s, %s, %s, %s) set_image_surface_data=%s, use pixbuf=%s",
FORMATS.get(cairo_format, cairo_format), has_alpha, len(img_data), type(img_data), x, y, width, height, rowstride, options, set_image_surface_data, CAIRO_USE_PIXBUF)
FORMATS.get(cairo_format, cairo_format), has_alpha, len(img_data),
type(img_data), x, y, width, height,
rowstride, options, set_image_surface_data, CAIRO_USE_PIXBUF)
rgb_format = options.strget(b"rgb_format", "RGB")
if set_image_surface_data and not CAIRO_USE_PIXBUF:
if (cairo_format==cairo.FORMAT_RGB24 and rgb_format in ("RGB", "BGR")) or \
Expand All @@ -58,7 +60,8 @@ def _do_paint_rgb(self, cairo_format, has_alpha, img_data, x, y, width, height,

if rgb_format in ("RGB", "RGBA", "RGBX"):
data = GLib.Bytes(img_data)
pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(data, GdkPixbuf.Colorspace.RGB, has_alpha, 8, width, height, rowstride)
pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(data, GdkPixbuf.Colorspace.RGB,
has_alpha, 8, width, height, rowstride)
self.cairo_paint_pixbuf(pixbuf, x, y, options)
return True

Expand Down
7 changes: 5 additions & 2 deletions src/xpra/server/source/audio_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def audio_loop_check(self, mode="speaker"):
log.warn(" %s", x)
return False

def start_sending_sound(self, codec=None, volume=1.0, new_stream=None, new_buffer=None, skip_client_codec_check=False):
def start_sending_sound(self, codec=None, volume=1.0,
new_stream=None, new_buffer=None, skip_client_codec_check=False):
assert self.hello_sent
log("start_sending_sound(%s)", codec)
ss = None
Expand Down Expand Up @@ -161,7 +162,9 @@ def start_sending_sound(self, codec=None, volume=1.0, new_stream=None, new_buffe
return None
from xpra.sound.wrapper import start_sending_sound
plugins = self.sound_properties.strlistget("plugins", [])
ss = start_sending_sound(plugins, self.sound_source_plugin, None, codec, volume, True, [codec], self.pulseaudio_server, self.pulseaudio_id)
ss = start_sending_sound(plugins, self.sound_source_plugin,
None, codec, volume, True, [codec],
self.pulseaudio_server, self.pulseaudio_id)
self.sound_source = ss
log("start_sending_sound() sound source=%s", ss)
if not ss:
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/server/source/client_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from xpra.server.source.source_stats import GlobalPerformanceStatistics
from xpra.server.source.clientinfo_mixin import ClientInfoMixin
from xpra.server import server_features
from xpra.log import Logger

CC_BASES = [ClientInfoMixin]
#TODO: notifications mixin
Expand Down Expand Up @@ -61,7 +62,6 @@
CC_BASES = tuple(CC_BASES)
ClientConnectionClass = type('ClientConnectionClass', CC_BASES, {})

from xpra.log import Logger
log = Logger("server")
elog = Logger("encoding")
keylog = Logger("keyboard")
Expand All @@ -79,7 +79,7 @@
BANDWIDTH_DETECTION = envbool("XPRA_BANDWIDTH_DETECTION", True)
MIN_BANDWIDTH = envint("XPRA_MIN_BANDWIDTH", 5*1024*1024)
AUTO_BANDWIDTH_PCT = envint("XPRA_AUTO_BANDWIDTH_PCT", 80)
assert AUTO_BANDWIDTH_PCT>1 and AUTO_BANDWIDTH_PCT<=100, "invalid value for XPRA_AUTO_BANDWIDTH_PCT: %i" % AUTO_BANDWIDTH_PCT
assert 1<AUTO_BANDWIDTH_PCT<=100, "invalid value for XPRA_AUTO_BANDWIDTH_PCT: %i" % AUTO_BANDWIDTH_PCT
YIELD = envbool("XPRA_YIELD", False)

counter = AtomicInteger()
Expand Down
11 changes: 9 additions & 2 deletions src/xpra/x11/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,11 @@ def update_wm_state(prop):
iconic = event.data[0]
log("WM_CHANGE_STATE: %s, serial=%s, last unmap serial=%#x",
ICONIC_STATE_STRING.get(iconic, iconic), event.serial, self.last_unmap_serial)
if iconic in (IconicState, NormalState) and self.serial_after_last_unmap(event.serial) and not self.is_OR() and not self.is_tray():
if (
iconic in (IconicState, NormalState) and
self.serial_after_last_unmap(event.serial) and
not self.is_OR() and not self.is_tray()
):
self._updateprop("iconic", iconic==IconicState)
return True
elif event.message_type=="_NET_WM_MOVERESIZE":
Expand All @@ -761,7 +765,10 @@ def update_wm_state(prop):
ndesktops = prop_get(root, "_NET_NUMBER_OF_DESKTOPS", "u32", ignore_errors=True)
workspacelog("received _NET_WM_DESKTOP: workspace=%s, number of desktops=%s",
workspacestr(workspace), ndesktops)
if ndesktops>0 and (workspace in (WORKSPACE_UNSET, WORKSPACE_ALL) or (workspace>=0 and workspace<ndesktops)):
if ndesktops>0 and (
workspace in (WORKSPACE_UNSET, WORKSPACE_ALL) or
0<=workspace<ndesktops
):
self.move_to_workspace(workspace)
else:
workspacelog.warn("invalid _NET_WM_DESKTOP request: workspace=%s, number of desktops=%s",
Expand Down

0 comments on commit 0687554

Please sign in to comment.