Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.events.modify_font(fixed)
#how many clipboards to show:
self.clipboards = CLIPBOARDS
tb = TableBuilder()
table = tb.get_table()
labels = [label("Selection")]
labels += [label("Value"), label("Clear"), label("Targets"), label("Actions")]
tb.add_row(*labels)
for selection in self.clipboards:
cs = ClipboardInstance(selection, self.add_event)
get_actions = gtk.HBox()
for x in (cs.get_get_targets_btn, cs.get_target_btn, cs.get_string_btn):
get_actions.pack_start(x)
tb.add_row(label(selection), cs.value_label, cs.clear_label_btn, cs.get_targets, get_actions)
set_actions = gtk.HBox()
for x in (cs.set_target_btn, cs.set_string_btn):
set_actions.pack_start(x)
tb.add_row(None, cs.value_entry, cs.clear_entry_btn, cs.set_targets, set_actions)
vbox.pack_start(table)
vbox.add(self.events)
self.window.add(vbox)
self.window.show_all()
icon = get_icon("clipboard.png")
if icon:
self.window.set_icon(icon)
try:
self.add_event("ALL", "window=%s, xid=%s" % (self.window, hex(self.window.get_window().xid)))
except:
self.add_event("ALL", "window=%s" % self.window)
def maths_labels():
return label(), label(), label(), label(), label()
self.server_latency_labels = maths_labels()
tb.add_row(label("Server Latency (ms)"), *self.server_latency_labels)
self.client_latency_labels = maths_labels()
tb.add_row(label("Client Latency (ms)"), *self.client_latency_labels)
if self.client.windows_enabled:
if self.client.server_info_request:
self.batch_labels = maths_labels()
tb.add_row(label("Batch Delay (ms)"), *self.batch_labels)
self.damage_labels = maths_labels()
tb.add_row(label("Damage Latency (ms)"), *self.damage_labels)
self.quality_labels = maths_labels()
tb.add_row(label("Encoding Quality (pct)"), *self.quality_labels)
self.speed_labels = maths_labels()
tb.add_row(label("Encoding Speed (pct)"), *self.speed_labels)
self.decoding_labels = maths_labels()
tb.add_row(label("Decoding Latency (ms)"), *self.decoding_labels)
self.regions_per_second_labels = maths_labels()
tb.add_row(label("Regions/s"), *self.regions_per_second_labels)
self.regions_sizes_labels = maths_labels()
tb.add_row(label("Pixels/region"), *self.regions_sizes_labels)
self.pixels_per_second_labels = maths_labels()
tb.add_row(label("Pixels/s"), *self.pixels_per_second_labels)
self.windows_managed_label = label()
tb.new_row("Regular Windows", self.windows_managed_label),
self.transient_managed_label = label()
tb.new_row("Transient Windows", self.transient_managed_label),
self.trays_managed_label = label()
tb.new_row("Trays Managed", self.trays_managed_label),
#title row:
tb.attach(title_box(""), 0, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Client"), 1, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Server"), 2, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.inc()
def make_os_str(sys_platform, platform_release, platform_platform, platform_linux_distribution):
s = platform_name(sys_platform, platform_release)
if platform_linux_distribution and len(platform_linux_distribution)==3 and len(platform_linux_distribution[0])>0:
s += "\n%s" % (" ".join(platform_linux_distribution))
elif platform_platform:
s += "\n%s" % platform_platform
return s
LOCAL_PLATFORM_NAME = make_os_str(sys.platform, python_platform.release(), python_platform.platform(), python_platform.linux_distribution())
SERVER_PLATFORM_NAME = make_os_str(self.client._remote_platform, self.client._remote_platform_release, self.client._remote_platform_platform, self.client._remote_platform_linux_distribution)
tb.new_row("Operating System", label(LOCAL_PLATFORM_NAME), label(SERVER_PLATFORM_NAME))
scaps = self.client.server_capabilities
from xpra.__init__ import __version__
tb.new_row("Xpra", label(__version__), label(self.client._remote_version or "unknown"))
cl_rev, cl_ch, cl_date = "unknown", "", ""
try:
from xpra.build_info import BUILD_DATE as cl_date
from xpra.src_info import REVISION as cl_rev, LOCAL_MODIFICATIONS as cl_ch
except:
pass
def make_version_str(version):
if version and type(version) in (tuple, list):
version = ".".join([str(x) for x in version])
return version or "unknown"
def server_info(*prop_names):
for x in prop_names:
v = scaps.get(x)
tb.new_row("Session Started", self.session_started_label)
self.session_connected_label = label()
tb.new_row("Session Connected", self.session_connected_label)
self.input_packets_label = label()
tb.new_row("Packets Received", self.input_packets_label)
self.input_bytes_label = label()
tb.new_row("Bytes Received", self.input_bytes_label)
self.output_packets_label = label()
tb.new_row("Packets Sent", self.output_packets_label)
self.output_bytes_label = label()
tb.new_row("Bytes Sent", self.output_bytes_label)
self.compression_label = label()
tb.new_row("Compression Level", self.compression_label)
self.connection_type_label = label()
tb.new_row("Connection Type", self.connection_type_label)
self.input_encryption_label = label()
tb.new_row("Input Encryption", self.input_encryption_label)
self.output_encryption_label = label()
tb.new_row("Output Encryption", self.output_encryption_label)
self.speaker_label = label()
self.speaker_details = label(font="monospace 10")
tb.new_row("Speaker", self.speaker_label, self.speaker_details)
self.microphone_label = label()
tb.new_row("Microphone", self.microphone_label)
# Details:
tb = self.table_tab("browse.png", "Statistics", self.populate_statistics)
tb.widget_xalign = 1.0
tb.attach(title_box(""), 0, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Latest"), 1, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Minimum"), 2, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
vbox.set_spacing(15)
self.log = maxdeque(maxlen=25)
for x in range(25):
self.log.append("")
self.events = gtk.Label()
fixed = pango.FontDescription('monospace 9')
self.events.modify_font(fixed)
#how many clipboards to show:
self.clipboards = CLIPBOARDS
tb = TableBuilder()
table = tb.get_table()
labels = [label("Selection")]
labels += [label("Value"), label("Clear"), label("Targets"), label("Actions")]
tb.add_row(*labels)
for selection in self.clipboards:
cs = ClipboardInstance(selection, self.add_event)
get_actions = gtk.HBox()
for x in (cs.get_get_targets_btn, cs.get_target_btn, cs.get_string_btn):
get_actions.pack_start(x)
tb.add_row(label(selection), cs.value_label, cs.clear_label_btn, cs.get_targets, get_actions)
set_actions = gtk.HBox()
for x in (cs.set_target_btn, cs.set_string_btn):
set_actions.pack_start(x)
tb.add_row(None, cs.value_entry, cs.clear_entry_btn, cs.set_targets, set_actions)
vbox.pack_start(table)
vbox.add(self.events)
self.window.add(vbox)
self.window.show_all()
self.input_bytes_label = label()
tb.new_row("Bytes Received", self.input_bytes_label)
self.output_packets_label = label()
tb.new_row("Packets Sent", self.output_packets_label)
self.output_bytes_label = label()
tb.new_row("Bytes Sent", self.output_bytes_label)
self.compression_label = label()
tb.new_row("Compression + Encoding", self.compression_label)
self.connection_type_label = label()
tb.new_row("Connection Type", self.connection_type_label)
self.input_encryption_label = label()
tb.new_row("Input Encryption", self.input_encryption_label)
self.output_encryption_label = label()
tb.new_row("Output Encryption", self.output_encryption_label)
self.speaker_label = label()
self.speaker_details = label(font="monospace 10")
tb.new_row("Speaker", self.speaker_label, self.speaker_details)
self.microphone_label = label()
tb.new_row("Microphone", self.microphone_label)
# Details:
tb, stats_box = self.table_tab("browse.png", "Statistics", self.populate_statistics)
tb.widget_xalign = 1.0
tb.attach(title_box(""), 0, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Latest"), 1, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Minimum"), 2, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Average"), 3, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("90 percentile"), 4, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Maximum"), 5, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.inc()
tb.new_row("Server Load", self.server_load_label, label_tooltip="Average over 1, 5 and 15 minutes")
self.session_started_label = label()
tb.new_row("Session Started", self.session_started_label)
self.session_connected_label = label()
tb.new_row("Session Connected", self.session_connected_label)
self.input_packets_label = label()
tb.new_row("Packets Received", self.input_packets_label)
self.input_bytes_label = label()
tb.new_row("Bytes Received", self.input_bytes_label)
self.output_packets_label = label()
tb.new_row("Packets Sent", self.output_packets_label)
self.output_bytes_label = label()
tb.new_row("Bytes Sent", self.output_bytes_label)
self.compression_label = label()
tb.new_row("Compression Level", self.compression_label)
self.connection_type_label = label()
tb.new_row("Connection Type", self.connection_type_label)
self.input_encryption_label = label()
tb.new_row("Input Encryption", self.input_encryption_label)
self.output_encryption_label = label()
tb.new_row("Output Encryption", self.output_encryption_label)
self.speaker_label = label()
self.speaker_details = label(font="monospace 10")
tb.new_row("Speaker", self.speaker_label, self.speaker_details)
self.microphone_label = label()
tb.new_row("Microphone", self.microphone_label)
# Details:
tb = self.table_tab("browse.png", "Statistics", self.populate_statistics)
tb.widget_xalign = 1.0
tb.attach(title_box(""), 0, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.new_row("Session Connected", self.session_connected_label)
self.input_packets_label = label()
tb.new_row("Packets Received", self.input_packets_label)
self.input_bytes_label = label()
tb.new_row("Bytes Received", self.input_bytes_label)
self.output_packets_label = label()
tb.new_row("Packets Sent", self.output_packets_label)
self.output_bytes_label = label()
tb.new_row("Bytes Sent", self.output_bytes_label)
self.compression_label = label()
tb.new_row("Compression Level", self.compression_label)
self.connection_type_label = label()
tb.new_row("Connection Type", self.connection_type_label)
self.input_encryption_label = label()
tb.new_row("Input Encryption", self.input_encryption_label)
self.output_encryption_label = label()
tb.new_row("Output Encryption", self.output_encryption_label)
self.speaker_label = label()
self.speaker_details = label(font="monospace 10")
tb.new_row("Speaker", self.speaker_label, self.speaker_details)
self.microphone_label = label()
tb.new_row("Microphone", self.microphone_label)
# Details:
tb = self.table_tab("browse.png", "Statistics", self.populate_statistics)
tb.widget_xalign = 1.0
tb.attach(title_box(""), 0, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Latest"), 1, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Minimum"), 2, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("Average"), 3, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
tb.attach(title_box("90 percentile"), 4, xoptions=gtk.EXPAND|gtk.FILL, xpadding=0)
vbox.set_spacing(15)
self.log = maxdeque(maxlen=25)
for x in range(25):
self.log.append("")
self.events = gtk.Label()
fixed = pango.FontDescription('monospace 9')
self.events.modify_font(fixed)
#how many clipboards to show:
self.clipboards = CLIPBOARDS
tb = TableBuilder()
table = tb.get_table()
labels = [label("Selection")]
labels += [label("Value"), label("Clear"), label("Targets"), label("Actions")]
tb.add_row(*labels)
for selection in self.clipboards:
cs = ClipboardInstance(selection, self.add_event)
get_actions = gtk.HBox()
for x in (cs.get_get_targets_btn, cs.get_target_btn, cs.get_string_btn):
get_actions.pack_start(x)
tb.add_row(label(selection), cs.value_label, cs.clear_label_btn, cs.get_targets, get_actions)
set_actions = gtk.HBox()
for x in (cs.set_target_btn, cs.set_string_btn):
set_actions.pack_start(x)
tb.add_row(None, cs.value_entry, cs.clear_entry_btn, cs.set_targets, set_actions)
vbox.pack_start(table)
vbox.add(self.events)
self.window.add(vbox)
self.window.show_all()
return version or "unknown"
def server_info(*prop_names):
for x in prop_names:
v = scaps.get(x)
if v is not None:
return v
if self.client.server_last_info:
v = self.client.server_last_info.get(x)
if v is not None:
return v
return None
def server_version_info(*prop_names):
return make_version_str(server_info(*prop_names))
tb.new_row("Revision", label(cl_rev), label(make_version_str(self.client._remote_revision)))
tb.new_row("Local Changes", label(cl_ch), label(server_version_info("build.local_modifications", "local_modifications")))
tb.new_row("Build date", label(cl_date), label(server_info("build_date", "build.date")))
def client_version_info(prop_name):
info = "unknown"
if hasattr(gtk, prop_name):
info = make_version_str(getattr(gtk, prop_name))
return info
if is_gtk3():
tb.new_row("PyGobject", label(gobject._version))
tb.new_row("Client GDK", label(gdk._version))
tb.new_row("GTK", label(gtk._version), label(server_version_info("gtk_version")))
else:
tb.new_row("PyGTK", label(client_version_info("pygtk_version")), label(server_version_info("pygtk.version", "pygtk_version")))
tb.new_row("GTK", label(client_version_info("gtk_version")), label(server_version_info("gtk.version", "gtk_version")))
tb.new_row("Python", label(python_platform.python_version()), label(server_version_info("server.python.version", "python_version", "python.version")))
cl_gst_v, cl_pygst_v = "", ""
try: