mirror of https://gitlab.com/bashrc2/epicyon
Don't overwrite default themes during import
parent
e7ae1c0561
commit
f06d1b20b3
|
@ -0,0 +1,16 @@
|
|||
Blue
|
||||
Debian
|
||||
Default
|
||||
Hacker
|
||||
Henge
|
||||
Indymediaclassic
|
||||
Indymediamodern
|
||||
Lcd
|
||||
Light
|
||||
Night
|
||||
Pixel
|
||||
Purple
|
||||
Rc3
|
||||
Solidaric
|
||||
Starlight
|
||||
Zen
|
2
tests.py
2
tests.py
|
@ -101,6 +101,7 @@ from content import removeLongWords
|
|||
from content import replaceContentDuplicates
|
||||
from content import removeTextFormatting
|
||||
from content import removeHtmlTag
|
||||
from theme import updateDefaultThemesList
|
||||
from theme import setCSSparam
|
||||
from linked_data_sig import generateJsonSignature
|
||||
from linked_data_sig import verifyJsonSignature
|
||||
|
@ -3721,6 +3722,7 @@ def testRoles() -> None:
|
|||
|
||||
def runAllTests():
|
||||
print('Running tests...')
|
||||
updateDefaultThemesList(os.getcwd())
|
||||
testFunctions()
|
||||
testRoles()
|
||||
testSkills()
|
||||
|
|
20
theme.py
20
theme.py
|
@ -52,6 +52,13 @@ def importTheme(baseDir: str, filename: str) -> bool:
|
|||
return False
|
||||
if not newThemeName:
|
||||
return False
|
||||
|
||||
# if the theme name in the default themes list?
|
||||
defaultThemesFilename = baseDir + '/defaultthemes.txt'
|
||||
if os.path.isfile(defaultThemesFilename):
|
||||
if newThemeName.title() + '\n' in open(defaultThemesFilename).read():
|
||||
newThemeName = newThemeName + '2'
|
||||
|
||||
themeDir = baseDir + '/theme/' + newThemeName
|
||||
if not os.path.isdir(themeDir):
|
||||
os.mkdir(themeDir)
|
||||
|
@ -791,3 +798,16 @@ def setTheme(baseDir: str, name: str, domain: str,
|
|||
_setThemeInConfig(baseDir, name)
|
||||
_setClearCacheFlag(baseDir)
|
||||
return result
|
||||
|
||||
|
||||
def updateDefaultThemesList(baseDir: str) -> None:
|
||||
"""Recreates the list of default themes
|
||||
"""
|
||||
themeNames = getThemesList(baseDir)
|
||||
defaultThemesFilename = baseDir + '/defaultthemes.txt'
|
||||
defaultThemesFile = open(defaultThemesFilename, "w+")
|
||||
if not defaultThemesFile:
|
||||
return
|
||||
for name in themeNames:
|
||||
defaultThemesFile.write(name + '\n')
|
||||
defaultThemesFile.close()
|
||||
|
|
Loading…
Reference in New Issue