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_cursors_menuitem(*args):
self.cursors_menuitem.set_active(self.client.cursors_enabled)
c = self.client
can_toggle_cursors = c.toggle_cursors_bell_notify and c.server_supports_cursors and c.client_supports_cursors
self.cursors_menuitem.set_sensitive(can_toggle_cursors)
if can_toggle_cursors:
set_tooltip_text(self.cursors_menuitem, "Forward custom mouse cursors")
else:
set_tooltip_text(self.cursors_menuitem, "Cannot forward mouse cursors: the feature has been disabled")
self.client.connect("handshake-complete", set_cursors_menuitem)
def set_speedmenu(self, *args):
if self.speed:
can_use = not self.client.mmap_enabled and self.client.encoding in self.client.server_encodings_with_speed 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_bell_menuitem(*args):
self.bell_menuitem.set_active(self.client.bell_enabled)
c = self.client
can_toggle_bell = c.toggle_cursors_bell_notify and c.server_supports_bell and c.client_supports_bell
self.bell_menuitem.set_sensitive(can_toggle_bell)
if can_toggle_bell:
set_tooltip_text(self.bell_menuitem, "Forward system bell")
else:
set_tooltip_text(self.bell_menuitem, "Cannot forward the system bell: the feature has been disabled")
self.client.connect("handshake-complete", set_bell_menuitem)
def btn(label, tooltip, callback, icon_name=None):
btn = gtk.Button(label)
set_tooltip_text(btn, tooltip)
btn.connect("clicked", callback)
if icon_name:
icon = self.get_icon(icon_name)
if icon:
btn.set_image(scaled_image(icon, 24))
hbox.pack_start(btn)
return btn
if icon_pixbuf:
self.window.set_icon(icon_pixbuf)
self.window.set_position(WIN_POS_CENTER)
vbox = gtk.VBox(False, 0)
vbox.set_spacing(15)
# Title
hbox = gtk.HBox(False, 0)
icon_pixbuf = self.get_icon("xpra.png")
if icon_pixbuf and show_about:
logo_button = gtk.Button("")
settings = logo_button.get_settings()
settings.set_property('gtk-button-images', True)
logo_button.connect("clicked", about)
set_tooltip_text(logo_button, "About")
image = gtk.Image()
image.set_from_pixbuf(icon_pixbuf)
logo_button.set_image(image)
hbox.pack_start(logo_button, expand=False, fill=False)
label = gtk.Label("Xpra Bug Report Tool")
label.modify_font(pango.FontDescription("sans 14"))
hbox.pack_start(label, expand=True, fill=True)
vbox.pack_start(hbox)
#the box containing all the input:
ibox = gtk.VBox(False, 0)
ibox.set_spacing(3)
vbox.pack_start(ibox)
# Description
set_history_from_active(self.speed_combo)
hbox.pack_start(self.speed_combo)
vbox.pack_start(hbox)
# Username@Host:Port
hbox = gtk.HBox(False, 0)
hbox.set_spacing(5)
self.username_entry = gtk.Entry(max=128)
self.username_entry.set_width_chars(16)
self.username_entry.connect("changed", self.validate)
set_tooltip_text(self.username_entry, "SSH username")
self.username_label = gtk.Label("@")
self.host_entry = gtk.Entry(max=128)
self.host_entry.set_width_chars(24)
self.host_entry.connect("changed", self.validate)
set_tooltip_text(self.host_entry, "hostname")
self.ssh_port_entry = gtk.Entry(max=5)
self.ssh_port_entry.set_width_chars(5)
self.ssh_port_entry.connect("changed", self.validate)
set_tooltip_text(self.ssh_port_entry, "SSH port")
self.port_entry = gtk.Entry(max=5)
self.port_entry.set_width_chars(5)
self.port_entry.connect("changed", self.validate)
set_tooltip_text(self.port_entry, "port/display")
hbox.pack_start(self.username_entry)
hbox.pack_start(self.username_label)
hbox.pack_start(self.host_entry)
hbox.pack_start(self.ssh_port_entry)
hbox.pack_start(gtk.Label(":"))
hbox.pack_start(self.port_entry)
vbox.pack_start(hbox)
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 in self.client.server_encodings_with_speed 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 btn(label, tooltip, callback, icon_name=None):
btn = gtk.Button(label)
set_tooltip_text(btn, tooltip)
btn.connect("clicked", callback)
if icon_name:
icon = self.get_icon(icon_name)
if icon:
btn.set_image(scaled_image(icon, 24))
hbox.pack_start(btn)
return btn