Button to reset theme designer settings

main
Bob Mottram 2021-12-05 12:52:59 +00:00
parent 930f38d23e
commit 74d87fe54c
20 changed files with 44 additions and 23 deletions

View File

@ -317,6 +317,7 @@ from cache import storePersonInCache
from cache import getPersonFromCache
from cache import getPersonPubKey
from httpsig import verifyPostHeaders
from theme import resetThemeDesignerSettings
from theme import setThemeFromDesigner
from theme import scanThemesForScripts
from theme import importTheme
@ -2150,10 +2151,15 @@ class PubServer(BaseHTTPRequestHandler):
urllib.parse.unquote_plus(themeParams)
print('themeDesigner1')
# theme designer screen, back button
# theme designer screen, reset button
# See htmlThemeDesigner
if 'submitThemeDesignerCancel=' in themeParams or \
if 'submitThemeDesignerReset=' in themeParams or \
'submitThemeDesigner=' not in themeParams:
if 'submitThemeDesignerReset=' in themeParams:
resetThemeDesignerSettings(baseDir, themeName, domain,
allowLocalNetworkAccess,
systemLanguage)
if callingDomain.endswith('.onion') and onionDomain:
originPathStr = \
'http://' + onionDomain + usersPath + '/' + defaultTimeline

View File

@ -502,6 +502,21 @@ def setThemeFromDesigner(baseDir: str, themeName: str, domain: str,
allowLocalNetworkAccess, systemLanguage)
def resetThemeDesignerSettings(baseDir: str, themeName: str, domain: str,
allowLocalNetworkAccess: bool,
systemLanguage: str) -> None:
"""Resets the theme designer settings
"""
customVariablesFile = baseDir + '/accounts/theme.json'
if os.path.isfile(customVariablesFile):
try:
os.remove(customVariablesFile)
except OSError:
print('EX: unable to remove theme designer settings on reset')
setTheme(baseDir, themeName, domain,
allowLocalNetworkAccess, systemLanguage)
def _readVariablesFile(baseDir: str, themeName: str,
variablesFile: str,
allowLocalNetworkAccess: bool) -> None:

View File

@ -500,5 +500,5 @@
"New feed URL": "موجز جديد URL",
"New link title and URL": "عنوان الارتباط الجديد وعنوان URL",
"Theme Designer": "مصمم المظهر",
"Reset": ""
"Reset": "إعادة ضبط"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "URL de feed nou",
"New link title and URL": "Títol i URL de l'enllaç nous",
"Theme Designer": "Dissenyador temàtic",
"Reset": ""
"Reset": "Restableix"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "URL porthiant newydd",
"New link title and URL": "Teitl dolen ac URL newydd",
"Theme Designer": "Dylunydd Thema",
"Reset": ""
"Reset": "Ail gychwyn"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "Neue Feed-URL",
"New link title and URL": "Neuer Linktitel und URL",
"Theme Designer": "Themendesigner",
"Reset": ""
"Reset": "Zurücksetzen"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "New feed URL",
"New link title and URL": "New link title and URL",
"Theme Designer": "Theme Designer",
"Reset": ""
"Reset": "Reset"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "URL de nuevo feed",
"New link title and URL": "Nuevo título de enlace y URL",
"Theme Designer": "Diseñadora de temas",
"Reset": ""
"Reset": "Reiniciar"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "Nouvelle URL de flux",
"New link title and URL": "Nouveau titre et URL du lien",
"Theme Designer": "Concepteur de thème",
"Reset": ""
"Reset": "Réinitialiser"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "URL beathaithe nua",
"New link title and URL": "Teideal nasc nua agus URL",
"Theme Designer": "Dearthóir Téama",
"Reset": ""
"Reset": "Athshocraigh"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "नया फ़ीड URL",
"New link title and URL": "नया लिंक शीर्षक और URL",
"Theme Designer": "थीम डिजाइनर",
"Reset": ""
"Reset": "रीसेट"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "Nuovo URL del feed",
"New link title and URL": "Nuovo titolo e URL del collegamento",
"Theme Designer": "Progettista di temi",
"Reset": ""
"Reset": "Ripristina"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "新しいフィードURL",
"New link title and URL": "新しいリンクのタイトルとURL",
"Theme Designer": "テーマデザイナー",
"Reset": ""
"Reset": "リセット"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "URL-ya feed nû",
"New link title and URL": "Sernav û URL-ya girêdana nû",
"Theme Designer": "Theme Designer",
"Reset": ""
"Reset": "Reset"
}

View File

@ -496,5 +496,5 @@
"New feed URL": "New feed URL",
"New link title and URL": "New link title and URL",
"Theme Designer": "Theme Designer",
"Reset": ""
"Reset": "Reset"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "Novo URL de feed",
"New link title and URL": "Novo título e URL do link",
"Theme Designer": "Designer de Tema",
"Reset": ""
"Reset": "Redefinir"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "URL нового канала",
"New link title and URL": "Новое название ссылки и URL",
"Theme Designer": "Дизайнер тем",
"Reset": ""
"Reset": "Сброс настроек"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "URL mpya ya mipasho",
"New link title and URL": "Kichwa kipya cha kiungo na URL",
"Theme Designer": "Mbuni wa Mandhari",
"Reset": ""
"Reset": "Weka upya"
}

View File

@ -500,5 +500,5 @@
"New feed URL": "新供稿网址",
"New link title and URL": "新链接标题和 URL",
"Theme Designer": "主题设计师",
"Reset": ""
"Reset": "重启"
}

View File

@ -203,14 +203,14 @@ def htmlThemeDesigner(cssCache: {}, baseDir: str,
themeForm += ' <form method="POST" action="' + \
'/users/' + nickname + '/changeThemeSettings">\n'
timelineKey = accessKeys['menuTimeline']
resetKey = accessKeys['menuLogout']
submitKey = accessKeys['submitButton']
themeForm += \
' <center>\n' + \
' <button type="submit" class="button" ' + \
'name="submitThemeDesignerCancel" ' + \
'accesskey="' + timelineKey + '">' + \
translate['Go Back'] + '</button>\n' + \
'name="submitThemeDesignerReset" ' + \
'accesskey="' + resetKey + '">' + \
translate['Reset'] + '</button>\n' + \
' <button type="submit" class="button" ' + \
'name="submitThemeDesigner" accesskey="' + submitKey + '">' + \
translate['Submit'] + '</button>\n </center>\n'