Setting keyboard shortcuts for timeline

merge-requests/30/head
Bob Mottram 2021-04-22 13:45:31 +01:00
parent 597ae365dc
commit 6254c30c63
3 changed files with 94 additions and 54 deletions

View File

@ -7852,7 +7852,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
if GETstartTime: if GETstartTime:
self._benchmarkGETtimings(GETstartTime, GETtimings, self._benchmarkGETtimings(GETstartTime, GETtimings,
'show status done', 'show status done',
@ -7981,7 +7982,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized, self.server.themeName, authorized, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8103,7 +8105,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized, self.server.themeName, authorized, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8226,7 +8229,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8349,7 +8353,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8481,7 +8486,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8609,7 +8615,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8698,7 +8705,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized, self.server.themeName, authorized, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8804,7 +8812,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8930,7 +8939,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -9048,7 +9058,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -9156,7 +9167,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.themeName, self.server.themeName,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner) self.server.textModeBanner,
self.server.accessKeys)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -14477,6 +14489,9 @@ def runDaemon(brochMode: bool,
# ASCII/ANSI text banner used in shell browsers, such as Lynx # ASCII/ANSI text banner used in shell browsers, such as Lynx
httpd.textModeBanner = getTextModeBanner(baseDir) httpd.textModeBanner = getTextModeBanner(baseDir)
# key shortcuts SHIFT + ALT + [key]
httpd.accessKeys = {}
httpd.unitTest = unitTest httpd.unitTest = unitTest
httpd.allowLocalNetworkAccess = allowLocalNetworkAccess httpd.allowLocalNetworkAccess = allowLocalNetworkAccess
if unitTest: if unitTest:

View File

@ -44,7 +44,8 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
authorized: bool, moderationActionStr: str, authorized: bool, moderationActionStr: str,
theme: str, peertubeInstances: [], theme: str, peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the moderation feed as html """Show the moderation feed as html
This is what you see when selecting the "mod" timeline This is what you see when selecting the "mod" timeline
""" """
@ -60,7 +61,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, moderationActionStr, theme, authorized, moderationActionStr, theme,
peertubeInstances, allowLocalNetworkAccess, peertubeInstances, allowLocalNetworkAccess,
textModeBanner) textModeBanner, accessKeys)
def htmlAccountInfo(cssCache: {}, translate: {}, def htmlAccountInfo(cssCache: {}, translate: {},

View File

@ -116,7 +116,8 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
theme: str, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the timeline as html """Show the timeline as html
""" """
enableTimingLog = False enableTimingLog = False
@ -478,25 +479,26 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
menuNewswire: usersPath + '/newswiremobile', menuNewswire: usersPath + '/newswiremobile',
menuLinks: usersPath + '/linksmobile' menuLinks: usersPath + '/linksmobile'
} }
navAccessKeys = { if not accessKeys:
menuProfile: 'p', accessKeys = {
menuInbox: 'i', menuProfile: 'p',
menuSearch: '/', menuInbox: 'i',
menuNewPost: 'n', menuSearch: '/',
menuCalendar: 'c', menuNewPost: 'n',
menuDM: 'd', menuCalendar: 'c',
menuReplies: 'r', menuDM: 'd',
menuOutbox: 's', menuReplies: 'r',
menuBookmarks: 'k', menuOutbox: 's',
menuShares: 'h', menuBookmarks: 'k',
menuBlogs: 'b', menuShares: 'h',
menuNewswire: 'w', menuBlogs: 'b',
menuLinks: 'l', menuNewswire: 'w',
menuModeration: 'm' menuLinks: 'l',
} menuModeration: 'm'
}
if moderator: if moderator:
navLinks[menuModeration] = usersPath + '/moderation#modtimeline' navLinks[menuModeration] = usersPath + '/moderation#modtimeline'
tlStr += htmlKeyboardNavigation(textModeBanner, navLinks, navAccessKeys, tlStr += htmlKeyboardNavigation(textModeBanner, navLinks, accessKeys,
None, usersPath, translate, None, usersPath, translate,
followApprovals) followApprovals)
@ -910,7 +912,8 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the shares timeline as html """Show the shares timeline as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -931,7 +934,8 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlInbox(cssCache: {}, defaultTimeline: str, def htmlInbox(cssCache: {}, defaultTimeline: str,
@ -953,7 +957,8 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the inbox as html """Show the inbox as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -974,7 +979,8 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlBookmarks(cssCache: {}, defaultTimeline: str, def htmlBookmarks(cssCache: {}, defaultTimeline: str,
@ -996,7 +1002,8 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the bookmarks as html """Show the bookmarks as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -1017,7 +1024,8 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlEvents(cssCache: {}, defaultTimeline: str, def htmlEvents(cssCache: {}, defaultTimeline: str,
@ -1039,7 +1047,8 @@ def htmlEvents(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the events as html """Show the events as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -1060,7 +1069,8 @@ def htmlEvents(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlInboxDMs(cssCache: {}, defaultTimeline: str, def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
@ -1082,7 +1092,8 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the DM timeline as html """Show the DM timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1098,7 +1109,8 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlInboxReplies(cssCache: {}, defaultTimeline: str, def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
@ -1120,7 +1132,8 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the replies timeline as html """Show the replies timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1137,7 +1150,8 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlInboxMedia(cssCache: {}, defaultTimeline: str, def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
@ -1159,7 +1173,8 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the media timeline as html """Show the media timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1176,7 +1191,8 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlInboxBlogs(cssCache: {}, defaultTimeline: str, def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
@ -1198,7 +1214,8 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the blogs timeline as html """Show the blogs timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1215,7 +1232,8 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlInboxFeatures(cssCache: {}, defaultTimeline: str, def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
@ -1238,7 +1256,8 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
theme: str, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the features timeline as html """Show the features timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1255,7 +1274,8 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlInboxNews(cssCache: {}, defaultTimeline: str, def htmlInboxNews(cssCache: {}, defaultTimeline: str,
@ -1277,7 +1297,8 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the news timeline as html """Show the news timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1294,7 +1315,8 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)
def htmlOutbox(cssCache: {}, defaultTimeline: str, def htmlOutbox(cssCache: {}, defaultTimeline: str,
@ -1316,7 +1338,8 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
authorized: bool, theme: str, authorized: bool, theme: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str) -> str: textModeBanner: str,
accessKeys: {}) -> str:
"""Show the Outbox as html """Show the Outbox as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -1334,4 +1357,5 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
showPublishAsIcon, fullWidthTimelineButtonHeader, showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner) allowLocalNetworkAccess, textModeBanner,
accessKeys)