Extra announces for timeline

merge-requests/21/head
Bob Mottram 2021-03-12 20:38:36 +00:00
parent 29b5c87433
commit 7919864a74
1 changed files with 38 additions and 11 deletions

View File

@ -335,7 +335,9 @@ def _readLocalBoxPost(boxName: str, index: int,
nameStr, gender) nameStr, gender)
def _showLocalBox(boxName: str, startPostIndex=0, noOfPosts=10) -> None: def _showLocalBox(boxName: str,
screenreader: str, systemLanguage: str, espeak,
startPostIndex=0, noOfPosts=10) -> None:
"""Shows locally stored posts for a given subdirectory """Shows locally stored posts for a given subdirectory
""" """
homeDir = str(Path.home()) homeDir = str(Path.home())
@ -354,9 +356,11 @@ def _showLocalBox(boxName: str, startPostIndex=0, noOfPosts=10) -> None:
index.append(f) index.append(f)
break break
if not index: if not index:
print('You have no ' + boxName + ' posts yet.') sayStr = 'You have no ' + boxName + ' posts yet.'
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
maxPostIndex = len(index) maxPostIndex = len(index)
index.sort(reverse=True) index.sort(reverse=True)
ctr = 0
for pos in range(startPostIndex, startPostIndex + noOfPosts): for pos in range(startPostIndex, startPostIndex + noOfPosts):
if pos >= maxPostIndex: if pos >= maxPostIndex:
break break
@ -381,6 +385,11 @@ def _showLocalBox(boxName: str, startPostIndex=0, noOfPosts=10) -> None:
content = (content[:40]) if len(content) > 40 else content content = (content[:40]) if len(content) > 40 else content
print(str(posStr) + ' | ' + str(name) + ' | ' + print(str(posStr) + ' | ' + str(name) + ' | ' +
str(published) + ' | ' + str(content) + ' |') str(published) + ' | ' + str(content) + ' |')
ctr +=1
sayStr = str(ctr) + ' ' + boxName + ' posts were shown.'
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
print('') print('')
@ -728,42 +737,60 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
break break
elif keyPress.startswith('show dm'): elif keyPress.startswith('show dm'):
currDMIndex = 0 currDMIndex = 0
_showLocalBox('dm', currDMIndex, 10) _showLocalBox('dm',
screenreader, systemLanguage, espeak,
currDMIndex, 10)
currTimeline = 'dm' currTimeline = 'dm'
elif keyPress.startswith('show sen'): elif keyPress.startswith('show sen'):
currSentIndex = 0 currSentIndex = 0
_showLocalBox('sent', currSentIndex, 10) _showLocalBox('sent',
screenreader, systemLanguage, espeak,
currSentIndex, 10)
currTimeline = 'sent' currTimeline = 'sent'
elif keyPress == 'show' or keyPress.startswith('show in'): elif keyPress == 'show' or keyPress.startswith('show in'):
currInboxIndex = 0 currInboxIndex = 0
_showLocalBox('inbox', currInboxIndex, 10) _showLocalBox('inbox',
screenreader, systemLanguage, espeak,
currInboxIndex, 10)
currTimeline = 'inbox' currTimeline = 'inbox'
elif keyPress.startswith('next'): elif keyPress.startswith('next'):
if currTimeline == 'dm': if currTimeline == 'dm':
currDMIndex += 10 currDMIndex += 10
_showLocalBox('dm', currDMIndex, 10) _showLocalBox('dm',
screenreader, systemLanguage, espeak,
currDMIndex, 10)
elif currTimeline == 'sent': elif currTimeline == 'sent':
currSentIndex += 10 currSentIndex += 10
_showLocalBox('sent', currSentIndex, 10) _showLocalBox('sent',
screenreader, systemLanguage, espeak,
currSentIndex, 10)
elif currTimeline == 'inbox': elif currTimeline == 'inbox':
currInboxIndex += 10 currInboxIndex += 10
_showLocalBox('inbox', currInboxIndex, 10) _showLocalBox('inbox',
screenreader, systemLanguage, espeak,
currInboxIndex, 10)
elif keyPress.startswith('prev'): elif keyPress.startswith('prev'):
if currTimeline == 'dm': if currTimeline == 'dm':
currDMIndex -= 10 currDMIndex -= 10
if currDMIndex < 0: if currDMIndex < 0:
currDMIndex = 0 currDMIndex = 0
_showLocalBox('dm', currDMIndex, 10) _showLocalBox('dm',
screenreader, systemLanguage, espeak,
currDMIndex, 10)
elif currTimeline == 'sent': elif currTimeline == 'sent':
currSentIndex -= 10 currSentIndex -= 10
if currSentIndex < 0: if currSentIndex < 0:
currSentIndex = 0 currSentIndex = 0
_showLocalBox('sent', currSentIndex, 10) _showLocalBox('sent',
screenreader, systemLanguage, espeak,
currSentIndex, 10)
elif currTimeline == 'inbox': elif currTimeline == 'inbox':
currInboxIndex -= 10 currInboxIndex -= 10
if currInboxIndex < 0: if currInboxIndex < 0:
currInboxIndex = 0 currInboxIndex = 0
_showLocalBox('inbox', currInboxIndex, 10) _showLocalBox('inbox',
screenreader, systemLanguage, espeak,
currInboxIndex, 10)
elif keyPress.startswith('read '): elif keyPress.startswith('read '):
postIndexStr = keyPress.split('read ')[1] postIndexStr = keyPress.split('read ')[1]
if postIndexStr.isdigit(): if postIndexStr.isdigit():