mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon into main
commit
207cbd792c
|
|
@ -11,6 +11,7 @@ import html
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import select
|
import select
|
||||||
|
import webbrowser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from random import randint
|
from random import randint
|
||||||
from utils import getStatusNumber
|
from utils import getStatusNumber
|
||||||
|
|
@ -37,9 +38,26 @@ from pgp import pgpEncryptToActor
|
||||||
|
|
||||||
|
|
||||||
def _clearScreen() -> None:
|
def _clearScreen() -> None:
|
||||||
|
"""Clears the screen
|
||||||
|
"""
|
||||||
os.system('cls' if os.name == 'nt' else 'clear')
|
os.system('cls' if os.name == 'nt' else 'clear')
|
||||||
|
|
||||||
|
|
||||||
|
def _showDesktopBanner() -> None:
|
||||||
|
"""Shows the banner at the top
|
||||||
|
"""
|
||||||
|
bannerFilename = 'banner.txt'
|
||||||
|
if not os.path.isfile(bannerFilename):
|
||||||
|
bannerTheme = 'starlight'
|
||||||
|
bannerFilename = 'theme/' + bannerTheme + '/banner.txt'
|
||||||
|
if not os.path.isfile(bannerFilename):
|
||||||
|
return
|
||||||
|
with open(bannerFilename, 'r') as bannerFile:
|
||||||
|
banner = bannerFile.read()
|
||||||
|
if banner:
|
||||||
|
print(banner + '\n')
|
||||||
|
|
||||||
|
|
||||||
def _waitForKeypress(timeout: int, debug: bool) -> str:
|
def _waitForKeypress(timeout: int, debug: bool) -> str:
|
||||||
"""Waits for a keypress with a timeout
|
"""Waits for a keypress with a timeout
|
||||||
Returns the key pressed, or None on timeout
|
Returns the key pressed, or None on timeout
|
||||||
|
|
@ -379,12 +397,7 @@ def _showLocalBox(boxName: str,
|
||||||
|
|
||||||
# title
|
# title
|
||||||
_clearScreen()
|
_clearScreen()
|
||||||
bannerFilename = 'theme/starlight/banner.txt'
|
_showDesktopBanner()
|
||||||
if os.path.isfile(bannerFilename):
|
|
||||||
with open(bannerFilename, 'r') as bannerFile:
|
|
||||||
banner = bannerFile.read()
|
|
||||||
if banner:
|
|
||||||
print(banner + '\n')
|
|
||||||
print(indent + boxName.upper() + '\n')
|
print(indent + boxName.upper() + '\n')
|
||||||
|
|
||||||
maxPostIndex = len(index)
|
maxPostIndex = len(index)
|
||||||
|
|
@ -419,6 +432,8 @@ 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
|
||||||
|
if speakerJson.get('detectedLinks'):
|
||||||
|
content = '🔗' + content
|
||||||
print(indent + str(posStr) + ' | ' + str(name) + ' | ' +
|
print(indent + str(posStr) + ' | ' + str(name) + ' | ' +
|
||||||
str(published) + ' | ' + str(content) + ' |')
|
str(published) + ' | ' + str(content) + ' |')
|
||||||
ctr += 1
|
ctr += 1
|
||||||
|
|
@ -619,17 +634,12 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
"""Runs the notifications and screen reader client,
|
"""Runs the notifications and screen reader client,
|
||||||
which announces new inbox items
|
which announces new inbox items
|
||||||
"""
|
"""
|
||||||
indent = ' '
|
indent = ' '
|
||||||
if showNewPosts:
|
if showNewPosts:
|
||||||
indent = ''
|
indent = ''
|
||||||
|
|
||||||
_clearScreen()
|
_clearScreen()
|
||||||
bannerFilename = 'theme/starlight/banner.txt'
|
_showDesktopBanner()
|
||||||
if os.path.isfile(bannerFilename):
|
|
||||||
with open(bannerFilename, 'r') as bannerFile:
|
|
||||||
banner = bannerFile.read()
|
|
||||||
if banner:
|
|
||||||
print(banner + '\n')
|
|
||||||
|
|
||||||
espeak = None
|
espeak = None
|
||||||
if screenreader:
|
if screenreader:
|
||||||
|
|
@ -863,7 +873,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
screenreader, systemLanguage, espeak,
|
screenreader, systemLanguage, espeak,
|
||||||
currSentIndex, 10)
|
currSentIndex, 10)
|
||||||
currTimeline = 'sent'
|
currTimeline = 'sent'
|
||||||
elif keyPress == 'show' or keyPress.startswith('show in'):
|
elif (keyPress == 'show' or keyPress.startswith('show in') or
|
||||||
|
keyPress == 'clear'):
|
||||||
currInboxIndex = 0
|
currInboxIndex = 0
|
||||||
_showLocalBox('inbox',
|
_showLocalBox('inbox',
|
||||||
screenreader, systemLanguage, espeak,
|
screenreader, systemLanguage, espeak,
|
||||||
|
|
@ -1130,3 +1141,16 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
systemLanguage, espeak)
|
systemLanguage, espeak)
|
||||||
else:
|
else:
|
||||||
print('No --screenreader option was specified')
|
print('No --screenreader option was specified')
|
||||||
|
elif keyPress.startswith('open '):
|
||||||
|
if speakerJson.get('detectedLinks'):
|
||||||
|
sayStr = 'Opening web links in browser.'
|
||||||
|
_sayCommand(sayStr, sayStr, originalScreenReader,
|
||||||
|
systemLanguage, espeak)
|
||||||
|
for url in speakerJson['detectedLinks']:
|
||||||
|
if '://' in url:
|
||||||
|
webbrowser.open(url)
|
||||||
|
else:
|
||||||
|
sayStr = 'There are no web links to open.'
|
||||||
|
_sayCommand(sayStr, sayStr, originalScreenReader,
|
||||||
|
systemLanguage, espeak)
|
||||||
|
print('')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue