Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Add rich tooltip #127
Browse files Browse the repository at this point in the history
  • Loading branch information
srevinsaju authored May 10, 2020
2 parents ed097a5 + ed5f4c0 commit 356037d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions guiscrcpy/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,13 +753,15 @@ def scan_config_devices_update_list_view(self):
status='Disconnected'
)
)

__sha = hashlib.sha256(
str(i).encode()).hexdigest()[5:5+6]
devices_view_list_item.setToolTip(
"Device: {d}\n"
"<span style='color: #{color}'>Device</snap>: <b>{d}</b>\n"
"Status: {s}".format(
d=i,
s="Disconnected. Right click 'ping' to attempt "
"reconnect",
color=__sha
)
)
devices_view_list_item.setFont(QFont('Noto Sans', pointSize=8))
Expand Down Expand Up @@ -879,19 +881,27 @@ def scan_devices_update_list_view(self):
status=i['status']
)
)
__sha = hashlib.sha256(
str(i['identifier']).encode()
).hexdigest()[5:5 + 6]
devices_view_list_item.setToolTip(
"Device: {d}\n"
"Model: {m}\n"
"Alias: {a}\n"
"Status: {s}\n"
"Transport ID: {t}\n"
"Device: "
"<span style='color: #{inv_color};background-color: #{color}'>"
"<b>{d}</b></span>\n"
"<br>"
"Model: {m}\n<br>"
"Alias: {a}\n<br>"
"Status: {s}\n<br>"
"Transport ID: {t}\n<br>"
"Paired: {p}".format(
d=i['identifier'],
m=i['model'],
a=i['product'],
s=i['status'],
t=i['transport_id'],
p=paired
p=paired,
color=__sha,
inv_color=str(hex(0xFFFFFF - int(__sha, 16))[2:])
)
)

Expand Down

0 comments on commit 356037d

Please sign in to comment.