Indentation for notification client

merge-requests/30/head
Bob Mottram 2021-03-15 13:43:50 +00:00
parent 4444d3cd3a
commit 988925b285
1 changed files with 14 additions and 3 deletions

View File

@ -356,6 +356,7 @@ def _showLocalBox(boxName: str,
startPostIndex=0, noOfPosts=10) -> None: startPostIndex=0, noOfPosts=10) -> None:
"""Shows locally stored posts for a given subdirectory """Shows locally stored posts for a given subdirectory
""" """
indent = ' '
homeDir = str(Path.home()) homeDir = str(Path.home())
if not os.path.isdir(homeDir + '/.config'): if not os.path.isdir(homeDir + '/.config'):
os.mkdir(homeDir + '/.config') os.mkdir(homeDir + '/.config')
@ -375,7 +376,17 @@ def _showLocalBox(boxName: str,
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak) _sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
print('') print('')
return return
# title
_clearScreen() _clearScreen()
bannerFilename = 'theme/starlight/banner.txt'
if os.path.isfile(bannerFilename):
with open(bannerFilename, 'r') as bannerFile:
banner = bannerFile.read()
if banner:
print(banner + '\n')
print('\n' + indent + boxName.capitalize() + '\n')
maxPostIndex = len(index) maxPostIndex = len(index)
index.sort(reverse=True) index.sort(reverse=True)
ctr = 0 ctr = 0
@ -408,13 +419,13 @@ def _showLocalBox(boxName: str,
while len(content) < 40: while len(content) < 40:
content += ' ' content += ' '
content = (content[:40]) if len(content) > 40 else content content = (content[:40]) if len(content) > 40 else content
print(str(posStr) + ' | ' + str(name) + ' | ' + print(indent + str(posStr) + ' | ' + str(name) + ' | ' +
str(published) + ' | ' + str(content) + ' |') str(published) + ' | ' + str(content) + ' |')
ctr += 1 ctr += 1
print('') print('')
sayStr = boxName + ' posts ' + str(startPostIndex + 1) + \ sayStr = indent + boxName + ' posts ' + str(startPostIndex + 1) + \
' to ' + str(startPostIndex + ctr) + '. ' ' to ' + str(startPostIndex + ctr) + '. '
sayStr += 'Use the next and prev commands to navigate.' sayStr += 'Use the next and prev commands to navigate.'
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak) _sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
@ -609,7 +620,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
which announces new inbox items which announces new inbox items
""" """
_clearScreen() _clearScreen()
bannerFilename = 'theme/default/banner.txt' bannerFilename = 'theme/starlight/banner.txt'
if os.path.isfile(bannerFilename): if os.path.isfile(bannerFilename):
with open(bannerFilename, 'r') as bannerFile: with open(bannerFilename, 'r') as bannerFile:
banner = bannerFile.read() banner = bannerFile.read()