Update and reorganise themes (#893)
* Drop the subfolders for GUI themes * Remove bundled font support * Add safe file read function * Allow loading themes from multiple locations * Clean up unused variables * Clean up icons class * Merge icon theme icons * Update icon theme class * Remove guiDark config setting * Fix tests * Fix handling of default theme * Update icon readmes * Add test for getGuiItem common function
This commit is contained in:
committed by
GitHub
parent
be3376272e
commit
15ec1496c5
@@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import os
|
||||
import json
|
||||
import hashlib
|
||||
import logging
|
||||
@@ -415,6 +416,24 @@ def jsonEncode(data, n=0, nmax=0):
|
||||
# File and File System Functions
|
||||
# =============================================================================================== #
|
||||
|
||||
def readTextFile(filePath):
|
||||
"""Read the content of a text file in a robust manner.
|
||||
"""
|
||||
if not os.path.isfile(filePath):
|
||||
return ""
|
||||
|
||||
fileText = ""
|
||||
try:
|
||||
with open(filePath, mode="r", encoding="utf-8") as inFile:
|
||||
fileText = inFile.read()
|
||||
except Exception:
|
||||
logger.error("Could not read file: %s", filePath)
|
||||
logException()
|
||||
return ""
|
||||
|
||||
return fileText
|
||||
|
||||
|
||||
def makeFileNameSafe(theText):
|
||||
"""Returns a filename safe version of the text.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user