Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_keyboard_sync_tooltip():
if not self.client.toggle_keyboard_sync:
set_tooltip_text(self.keyboard_sync_menuitem, "This server does not support changes to keyboard synchronization")
elif self.client.keyboard_sync:
set_tooltip_text(self.keyboard_sync_menuitem, "Disable keyboard synchronization (prevents spurious key repeats on high latency connections)")
else:
set_tooltip_text(self.keyboard_sync_menuitem, "Enable keyboard state synchronization")
def keyboard_sync_toggled(*args):
def set_keyboard_sync_tooltip():
if not self.client.toggle_keyboard_sync:
set_tooltip_text(self.keyboard_sync_menuitem, "This server does not support changes to keyboard synchronization")
elif self.client.keyboard_sync:
set_tooltip_text(self.keyboard_sync_menuitem, "Disable keyboard synchronization (prevents spurious key repeats on high latency connections)")
else:
set_tooltip_text(self.keyboard_sync_menuitem, "Enable keyboard state synchronization")
def keyboard_sync_toggled(*args):
def set_notifications_menuitem(*args):
self.notifications_menuitem.set_active(self.client.notifications_enabled)
c = self.client
can_notify = c.toggle_cursors_bell_notify and c.server_supports_notifications and c.client_supports_notifications
self.notifications_menuitem.set_sensitive(can_notify)
if can_notify:
set_tooltip_text(self.notifications_menuitem, "Forward system notifications")
else:
set_tooltip_text(self.notifications_menuitem, "Cannot forward system notifications: the feature has been disabled")
self.client.connect("handshake-complete", set_notifications_menuitem)
def microphone_state(*args):
if not self.client.server_sound_receive:
microphone.set_sensitive(False)
set_tooltip_text(microphone, "Server does not support microphone forwarding")
return
microphone.set_sensitive(True)
microphone.set_submenu(self.make_soundsubmenu(is_microphone_on, self.mic_on, self.mic_off, "microphone-changed"))
self.client.connect("handshake-complete", microphone_state)
def set_speedmenu(self, *args):
if self.speed:
can_use = not self.client.mmap_enabled and self.client.encoding=="x264" and self.client.change_speed
self.speed.set_sensitive(can_use)
if self.client.mmap_enabled:
set_tooltip_text(self.speed, "Quality is always 100% with mmap")
elif not self.client.change_speed:
set_tooltip_text(self.speed, "Server does not support changing speed")
elif self.client.encoding!="x264":
set_tooltip_text(self.speed, "Not supported with %s encoding" % self.client.encoding)
else:
set_tooltip_text(self.speed, "Encoding latency vs size")
def set_qualitymenu(self, *args):
if self.quality:
can_use = not self.client.mmap_enabled and self.client.encoding in ("jpeg", "webp", "x264")
self.quality.set_sensitive(can_use)
if can_use:
set_tooltip_text(self.quality, "Minimum picture quality")
else:
set_tooltip_text(self.quality, "Not supported with %s encoding" % self.client.encoding)
def speaker_state(*args):
if not self.client.server_sound_send:
speaker.set_sensitive(False)
set_tooltip_text(speaker, "Server does not support speaker forwarding")
return
speaker.set_sensitive(True)
speaker.set_submenu(self.make_soundsubmenu(is_speaker_on, self.spk_on, self.spk_off, "speaker-changed"))
self.client.connect("handshake-complete", speaker_state)
def populate_speed_menu(speed_options, current_speed, set_cb):
option_to_text = {}
for k,v in speed_options.items():
option_to_text[v] = k
found_match = False
items = {}
for s in sorted(speed_options.values()):
t = option_to_text.get(s)
qi = CheckMenuItem(t)
qi.set_draw_as_radio(True)
candidate_match = s>=current_speed
qi.set_active(not found_match and candidate_match)
found_match |= candidate_match
qi.connect('activate', set_cb)
if s>0:
set_tooltip_text(qi, "%s%%" % s)
speed_submenu.append(qi)
items[s] = qi
return items
self.speed_menu_items = populate_speed_menu(self.speed_options, max(0, self.client.speed), set_cb=self.set_speed)