merge-requests/30/head
Bob Mottram 2022-06-14 14:52:33 +01:00
parent 2371e20541
commit d0a6c58e78
1 changed files with 18 additions and 53 deletions

View File

@ -852,12 +852,10 @@ def _desktop_show_actor(base_dir: str, actor_json: {}, translate: {},
def _desktop_show_profile(session, nickname: str, domain: str, def _desktop_show_profile(session, nickname: str, domain: str,
http_prefix: str, base_dir: str, box_name: str, base_dir: str, index: int, box_json: {},
page_number: int, index: int, box_json: {},
system_language: str, system_language: str,
screenreader: str, espeak, screenreader: str, espeak,
translate: {}, your_actor: str, translate: {}, post_json_object: {},
post_json_object: {},
signing_priv_key_pem: str) -> {}: signing_priv_key_pem: str) -> {}:
"""Shows the profile of the actor for the given post """Shows the profile of the actor for the given post
Returns the actor json Returns the actor json
@ -901,13 +899,10 @@ def _desktop_show_profile(session, nickname: str, domain: str,
return actor_json return actor_json
def _desktop_show_profile_from_handle(session, nickname: str, domain: str, def _desktop_show_profile_from_handle(session, domain: str, base_dir: str,
http_prefix: str, base_dir: str, handle: str, system_language: str,
box_name: str, handle: str,
system_language: str,
screenreader: str, espeak, screenreader: str, espeak,
translate: {}, your_actor: str, translate: {},
post_json_object: {},
signing_priv_key_pem: str) -> {}: signing_priv_key_pem: str) -> {}:
"""Shows the profile for a handle """Shows the profile for a handle
Returns the actor json Returns the actor json
@ -985,9 +980,7 @@ def _desktop_show_box(indent: str,
your_actor: str, box_name: str, box_json: {}, your_actor: str, box_name: str, box_json: {},
translate: {}, translate: {},
screenreader: str, system_language: str, espeak, screenreader: str, system_language: str, espeak,
page_number: int, page_number: int) -> bool:
new_replies: bool,
new_dms: bool) -> bool:
"""Shows online timeline """Shows online timeline
""" """
number_width = 2 number_width = 2
@ -1429,8 +1422,6 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
content = None content = None
cached_webfingers = {} cached_webfingers = {}
person_cache = {} person_cache = {}
new_replies_exist = False
new_dms_exist = False
pgp_key_upload = False pgp_key_upload = False
say_str = indent + 'Loading translations file' say_str = indent + 'Loading translations file'
@ -1502,12 +1493,9 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
signing_priv_key_pem) signing_priv_key_pem)
else: else:
inbox_json = box_json inbox_json = box_json
new_dms_exist = False
new_replies_exist = False
if inbox_json: if inbox_json:
_new_desktop_notifications(your_actor, inbox_json, notify_json) _new_desktop_notifications(your_actor, inbox_json, notify_json)
if notify_json.get('dmNotify'): if notify_json.get('dmNotify'):
new_dms_exist = True
if notify_json.get('dmNotifyChanged'): if notify_json.get('dmNotifyChanged'):
_desktop_notification(notification_type, _desktop_notification(notification_type,
"Epicyon", "Epicyon",
@ -1515,7 +1503,6 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
if notification_sounds: if notification_sounds:
_play_notification_sound(dm_sound_filename, player) _play_notification_sound(dm_sound_filename, player)
if notify_json.get('repliesNotify'): if notify_json.get('repliesNotify'):
new_replies_exist = True
if notify_json.get('repliesNotifyChanged'): if notify_json.get('repliesNotifyChanged'):
_desktop_notification(notification_type, _desktop_notification(notification_type,
"Epicyon", "Epicyon",
@ -1532,9 +1519,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
your_actor, curr_timeline, box_json, your_actor, curr_timeline, box_json,
translate, translate,
None, system_language, espeak, None, system_language, espeak,
page_number, page_number)
new_replies_exist,
new_dms_exist)
desktop_shown = True desktop_shown = True
prev_timeline_first_id = timeline_first_id prev_timeline_first_id = timeline_first_id
else: else:
@ -1580,9 +1565,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
your_actor, curr_timeline, box_json, your_actor, curr_timeline, box_json,
translate, translate,
screenreader, system_language, espeak, screenreader, system_language, espeak,
page_number, page_number)
new_replies_exist, new_dms_exist)
new_dms_exist = False
elif command_str.startswith('show rep'): elif command_str.startswith('show rep'):
page_number = 1 page_number = 1
prev_timeline_first_id = '' prev_timeline_first_id = ''
@ -1596,10 +1579,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
your_actor, curr_timeline, box_json, your_actor, curr_timeline, box_json,
translate, translate,
screenreader, system_language, espeak, screenreader, system_language, espeak,
page_number, page_number)
new_replies_exist, new_dms_exist)
# Turn off the replies indicator
new_replies_exist = False
elif command_str.startswith('show b'): elif command_str.startswith('show b'):
page_number = 1 page_number = 1
prev_timeline_first_id = '' prev_timeline_first_id = ''
@ -1613,10 +1593,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
your_actor, curr_timeline, box_json, your_actor, curr_timeline, box_json,
translate, translate,
screenreader, system_language, espeak, screenreader, system_language, espeak,
page_number, page_number)
new_replies_exist, new_dms_exist)
# Turn off the replies indicator
new_replies_exist = False
elif (command_str.startswith('show sen') or elif (command_str.startswith('show sen') or
command_str.startswith('show out')): command_str.startswith('show out')):
page_number = 1 page_number = 1
@ -1631,8 +1608,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
your_actor, curr_timeline, box_json, your_actor, curr_timeline, box_json,
translate, translate,
screenreader, system_language, espeak, screenreader, system_language, espeak,
page_number, page_number)
new_replies_exist, new_dms_exist)
elif (command_str == 'show' or command_str.startswith('show in') or elif (command_str == 'show' or command_str.startswith('show in') or
command_str == 'clear'): command_str == 'clear'):
page_number = 1 page_number = 1
@ -1656,8 +1632,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
your_actor, curr_timeline, box_json, your_actor, curr_timeline, box_json,
translate, translate,
screenreader, system_language, espeak, screenreader, system_language, espeak,
page_number, page_number)
new_replies_exist, new_dms_exist)
elif (command_str.startswith('read ') or elif (command_str.startswith('read ') or
command_str.startswith('show ') or command_str.startswith('show ') or
command_str == 'read' or command_str == 'read' or
@ -1699,14 +1674,11 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
if post_json_object: if post_json_object:
actor_json = \ actor_json = \
_desktop_show_profile(session, nickname, domain, _desktop_show_profile(session, nickname, domain,
http_prefix, base_dir, base_dir, post_index,
curr_timeline,
page_number, post_index,
box_json, box_json,
system_language, system_language,
screenreader, screenreader,
espeak, translate, espeak, translate,
your_actor,
post_json_object, post_json_object,
signing_priv_key_pem) signing_priv_key_pem)
else: else:
@ -1718,16 +1690,12 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
profile_handle = post_index_str profile_handle = post_index_str
_desktop_clear_screen() _desktop_clear_screen()
_desktop_show_banner() _desktop_show_banner()
_desktop_show_profile_from_handle(session, _desktop_show_profile_from_handle(session, domain,
nickname, domain, base_dir,
http_prefix, base_dir,
curr_timeline,
profile_handle, profile_handle,
system_language, system_language,
screenreader, screenreader,
espeak, translate, espeak, translate,
your_actor,
None,
signing_priv_key_pem) signing_priv_key_pem)
say_str = 'Press Enter to continue...' say_str = 'Press Enter to continue...'
say_str2 = _highlight_text(say_str) say_str2 = _highlight_text(say_str)
@ -1742,12 +1710,10 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
post_index = int(post_index_str) post_index = int(post_index_str)
actor_json = \ actor_json = \
_desktop_show_profile(session, nickname, domain, _desktop_show_profile(session, nickname, domain,
http_prefix, base_dir, base_dir, post_index,
curr_timeline,
page_number, post_index,
box_json, box_json,
system_language, screenreader, system_language, screenreader,
espeak, translate, your_actor, espeak, translate,
None, signing_priv_key_pem) None, signing_priv_key_pem)
say_str = 'Press Enter to continue...' say_str = 'Press Enter to continue...'
say_str2 = _highlight_text(say_str) say_str2 = _highlight_text(say_str)
@ -2581,5 +2547,4 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
your_actor, curr_timeline, box_json, your_actor, curr_timeline, box_json,
translate, translate,
screenreader, system_language, screenreader, system_language,
espeak, page_number, espeak, page_number)
new_replies_exist, new_dms_exist)