Display the sid value in tooltips in hex and dec format(#34).

This commit is contained in:
DYefremov
2020-09-12 11:33:17 +03:00
parent f8f1536213
commit 1f51766dea

View File

@@ -929,23 +929,35 @@ class Application(Gtk.Application):
pol = ", {}: {},".format(get_message("Pol"), srv.pol) if srv.pol else ","
fec = "{}: {}".format("FEC", srv.fec) if srv.fec else ","
ht = "{}{}: {}\n{}: {}\n{}: {}\n{}: {}{} {}, {}: {}\n{}"
ht = "{}{}: {}\n{}: {}\n{}: {}\n{}: {}{} {}, {}\n{}"
return ht.format(header,
get_message("Package"), srv.package,
get_message("System"), srv.system,
get_message("Freq"), srv.freq,
get_message("Rate"), srv.rate, pol, fec, "SID", srv.ssid,
get_message("Rate"), srv.rate, pol, fec, self.get_ssid_info(srv),
ref)
def get_hint_for_srv_list(self, srv):
""" Returns short info about service as formatted string for using as hint. """
return "{}{}".format(*self.get_hint_header_info(srv))
header, ref = self.get_hint_header_info(srv)
return "{}{}\n{}".format(header, self.get_ssid_info(srv), ref)
def get_hint_header_info(self, srv):
header = "{}: {}\n{}: {}\n".format(get_message("Name"), srv.service, get_message("Type"), srv.service_type)
ref = "{}: {}".format(get_message("Service reference"), srv.picon_id.rstrip(".png"))
return header, ref
def get_ssid_info(self, srv):
""" Returns SID representation in hex and dec formats. """
try:
dec = "{0: 04d}".format(int(srv.ssid, 16))
except ValueError as e:
log("SID value conversion error: {}".format(e))
else:
return "SID: 0x{} ({})".format(srv.ssid, dec)
return "SID: 0x{}".format(srv.ssid)
# ***************** Drag-and-drop *********************#
def on_view_drag_begin(self, view, context):